Professional Documents
Culture Documents
1 Introduction
For version before V7SP5, SIMPLORER supports value triggering only. Time point triggering was not supported. With SP5 the simulator will have a new feature Time Trigger. Using this feature the user can specify synchronization points at which the simulator will be forced to do a calculation. A time trigger event can be scheduled once or periodical.
2 Intention
Imagine a state machine that has to perform certain operations at exactly specified time points, e.g. at t1 = 1 ms, t2 = 2 ms, etc. To trigger these events, the simulator will approach t1 with some step size h. It will ignore t1 until t > t1, then discard the last step and reduce h. The simulator doses some kind of interpolation to find the new h. From then on, h will be successively increased until again t > t1 and the same procedure starts anew. This whole process continues until t1 is being stepped over by hmin. This has many drawbacks. First, the simulation accuracy suffers considerably because t1 is only hit by an error depending on hmin. Second, simulation speed suffers extremely (especially for clocked systems and alike) because SIMPLORER takes a lot of extra steps (e.g. many hundreds depending on h, hmin, and hmax) just to trigger this event roughly. If the model itself knows the point where the condition goes true, it could set the step size to synchronize exactly to this point.
3 Handling
The backplane includes now a trigger list. Its a sorted list with all scheduled events. After a time step, when the simulator calculates the step size for the next time step, it includes this list for the step size calculation. New functions to schedule and unschedule events are available in the system now. The functions can be called from the State graph and the C-Interface. ScheduleTrigger or SCHED - will create a new trigger. DeScheduleTrigger or DESCHED - will remove a trigger Page 1 12/16/2005
Call the function ScheduleTrigger or SCHED with the same name will delete the existing time trigger with that name and schedule a new one. Definition of more than one time triggers for a time point is possible. Unscheduling has no effect as long as one trigger for that time point is active. Only if all triggers removed, the simulator will not synchronize at that time point.
SCHED sets variable dTEv1 to current simulation time plus 1 microsecond and synchronize at time t + 1u. Whenever a SCHED action type is encountered, ScheduleEvent will be called by the simulator. A new trigger is created in the Backplane and sorted into the trigger list. The Simulator includes these trigger list to calculate the step size for the next time step. A transition condition looks like:
COND: dTEv1
/* transition TRUE if dTEv1 has been reached, simulator triggers exactly on dTEv1 */ or
COND: dTEv1 OR R1.I >= I_Max
/* transition TRUE if dTEv1 has been reached (simulator triggers exactly on dTEv1) or current through R1 greater than or equal to some variable I_Max*/ There will be a DESCHED action type that executes DescheduleEvent. The according action looks like: UNSCHED dTEv1 /* removes the value of dTEv1 from the trigger list */ The $$ will set dTEv1 to the right side value and schedule the event once the state becomes active. Thus, it might also be omitted because the SCHED type seems to form a unique definition. However, the DEL type also goes along with the ##-operator although one seems to suffice. Again: This new action/transition combination corresponds to the delay operator (##), where a certain state graph transition will become TRUE after a certain time has elapsed, e.g.:
Page 2
12/16/2005
/* switch if time elapsed and current less than its maximum, ... */
pszName - user defined non-ambiguous name for the time trigger dAbsSyncTime - absolute time of the next trigger time in seconds dPeriod - period length for the trigger in seconds, 0.0 mean no periodical Calling the ScheduleTrigger function twice with the same name will remove the first trigger from the list and insert a new one. For example:
ScheduleTrigger (MyTrig, 1e-3); ScheduleTrigger (MyTrig, 1.5e-3, 0.5e-3);
Only the second trigger at time 1.5ms with a period length of 0.5ms is active. At time 1ms the simulator will not explicitly synchronize.
//functions to deschedule user model sync time points void DeScheduleTrigger (LPCTSTR pszName);
Page 3
12/16/2005
Page 4
12/16/2005