previous next Up Title Contents

Main Simulation Process

Employing a bottom-up approach to analysing the AudPerGen.c program the main simulation process is explained first. This is stage (vi) in the standard program format illustrated in figure [3]. The following code runs the auditory periphery simulation using specified modules and parameters:-

	printf("\nStarting main process...\n\n" );
	DoProcess( GenerateSignal, stimulus );
	PrintProcessName_EarObject("1-stimulus: '%s'.\n", stimulus );
	if (!stimulus->outSignal->rampFlag ) {
		RampUpOutSignal_Ramp(stimulus, Sine_Ramp, rampInterval );
		printf("\tAudPerGen: Stimulus has been ramped.\n" );
	CalcIntensities_GenAnalysis(intensity, stimulus->outSignal,
rampInterval );
	printf("\tStimulus intensity = %g dB SPL.\n", intensity[CHANNEL] );
	DoProcess( RunModel, pEFilter );
	PrintProcessName_EarObject("2-Outer-/middle-ear: '%s'.\n", pEFilter );
	DoProcess( RunModel, bMFilter );
	PrintProcessName_EarObject("3-Basilar membrane: '%s'.\n", bMFilter );
	DoProcess( RunModel, recptPotn );
	PrintProcessName_EarObject("4-IHC Receptor potential: '%s'.\n", recptPotn
	DoProcess( RunModel, hairCell );
	PrintProcessName_EarObject("5-Inner hair cell (IHC): '%s'.\n", hairCell
	WriteOutSignal_DataFile(outputFile, hairCell );

Figure [5]: AudPerGen.c-Simulation Process

The DoProcess(...) command calls the module routines to execute the appropriate process. The first argument of the command is the required process routine and the second is the process data structure (or rather a pointer to the data structure) to work on, as shown in figure [6].

Figure [6]: DoProcess(...) Command Structure The process data structure is called an EarObject. It has an input and output signal field. All processes use EarObjects to handle data. In the program the EarObjects have been given names to reflect the respective process in the auditory periphery model. Each EarObject can have a particular module associated with it, which defines the process performed on its data. The parameters for the module can be read from a parameter file (specific to each module). In the generic programming level the particular process to be performed on each EarObject is defined when it is initialised. Initialisation of EarObjects is explained in a later sub-section below.

In general each process, using an EarObject, assumes that its input signal is produced by another process. It uses the input signal (without changing it) and produces an output signal. The connections between the EarObjects, describing the data flow, must be set up before hand. This is done using the ConnectOutSignalToIn_EarObject(...) command which is described below. A more detailed description of the EarObject data structure is provided later in this document.

The main simulation code can employ any of the routines available to the CRL. Each CRL routine, unless called within the Do...(...) command, is named using the CRL routine naming convention. This is described in the reference chapter, later in this manual. In general routine names have the form Function_Module. The PrintProcessName_EarObject(...) is used to access the name of the process performed on an EarObject. The WriteOutSignal_DataFile(...) routine is used to write an EarObject's output signal to file. The type of file written depends upon the suffix given for the file name. The "if" statement provides an example of how an EarObject's signals may be accessed. In this case the output signal is tested to see if it requires ramping (ramping click stimuli is problematic). If so then the RampUpOutSignal_Ramp(...) is used upon the stimulus EarObject. The CalcIntensities_GenAnalysis(...) is used to calculate the intensity of the stimulus' EarObject's output signal.

previous next Up Title Contents