The RTSim module

Warning, this is for developers only. If you are not a C/C++ programmer, this page will not be of any use to you.

The RTSim module simplifies incorporating NICO networks in your C/C++ applications. You can train a network using the regular tools, (BackProp etc.), and then use the functions of the RTSim module to load and run the network in your own application.

Unlike the regular tools, RTSim functions in a pipeline fashion, so you push input vectors to an RTSim object and pull out output vectors as they become available. There's no need to wait until a whole file is processed. The RTSim module has been used at KTH to implement a real time hybrid ANN/HMM speech recognition system.

The source code is in .../libRTSim.c and .../lib/RTSim.h of the version 1.1 NICO distribution.

Functions

This function is used to generate an RTSimulator object from a Net object.
You can use the LodNet() function in the RTDNN.c code to get the pointer to a Net struct.
RTSimulator *CompileRTSim(Net *network);
This function is used to generate an RTSim object from a NetWork object. Typically you would use the function CompileRTSim to get the RTSimulator object though.
You use the LodNet() and the Compile() functions in the RTDNN.c, and Simulation.c code to get the pointer to a Net struct.
RTSimulator *MakeRTSim(NetWork *net);
The following four functions are used to query the RTSimulator object about the size and location of the input and output vectors.
void RTSimInputSize(RTSimulator *work, int *num_streams, int **stream_sizes);
float **GetRTSimInputVectors(RTSimulator *work);
void RTSimOutputSize(RTSimulator *work, int *num_streams, int **stream_sizes);
float **GetRTSimOutputVectors(RTSimulator *work);
Initializes the RTSimulator object. The file_name parameter is only used to set the values of the special purpose filename units.
void RTSimInitialize(RTSimulator *work, char *file_name);
Returns non-zero iff the RTSimulator is waiting for more input.
int RTSimCheckInput(RTSimulator *work);
To push  input  to the RTSimulator, fill the input vectors with data and then call this function. The location of the input vectors are fetched using the function: GetRTSimInputVectors().
int RTSimInput(RTSimulator *work);
Call this function to tell the RTSimulator that there is no more input to come.
void RTSimInputEnd(RTSimulator *work);
Returns non-zero iff there is output to be popped.
int RTSimCheckOutput(RTSimulator *work);
To pop output from the RTSimulator, call this function and then read the data from the output vectors. The location of the output vectors are fetched using the function: GetRTSimOutputVectors().
int RTSimOutput(RTSimulator *work);
Returns the number of input vectors pushed to the RTSimulator after the last call to RTSimInitialize().
int RTSimTime(RTSimulator *work);
Frees the RTSimulator object. However, the Network object pointed to by the RTSimultor is not freed.
void FreeRTSim(RTSimulator *work);