C/C++ Interface Extension
There are two predefined functions that call ScheduleEvent and DescheduleEvent from inside a C-Model. Calling the Schedule or DeSchedule function are only allowed in SimInit() or SimValidate(), otherwise a error message occurs. The Sim2000User.h header file is extended and includes 2 new function prototypes:
//functions to schedule user model sync time points
void ScheduleTrigger (LPCTSTR pszName, double dAbsSyncTime, double dPeriod = 0.0);
where,
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 means no period
Calling the ScheduleTrigger function a second time with the same name will overwrite the previous 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 necessarily synchronize.
//functions to deschedule user model sync time points
void DeScheduleTrigger (LPCTSTR pszName);
where,
pszName – trigger name corresponding with the name used in ScheduleTrigger()