I want to change the parameter parSize
at certain times. For example, the parameter parSize
should be equal to 50 at XX:XX o'clock and equal to 30 at YY:YY o'clock. This change of the parameter is repeated every day at the same time.
The time when the parameter should be changed can be entered manually by the end user before the simulation starts. The parameters for each time are stored separated by hour and minutes as int.
My approach is to trigger a cyclic event for each parameter change, which repeats every day at time XX:XX, YY:YY, etc.
Is there a better way to change parameters at a certain time of the day (repeated everyday)?
How can I trigger an event with my input int
parameters (one for hour, one for minutes) of the time? So that occurrence date not set manually in the selection window, but by code and my end user input parameters?
Use a DynamicEvent object named MyDynamicEvent
instead.
Give it 2 arguments of type double:
minsToDailyChange
(in mins since midnight).newValue
For each of the 7 changes per day, call create_MyDynamicEvent(0, SECOND, minsFromMidnightForThisChange, newValue)
on the start of the model
In the action code, write:
set_parSize(newValue);
create_MyDynamicEvent(24, HOUR, minsFromMidnightForThisChange, newValue)
Now, you have 7 parallel DEs that manage themselves and will change the value every 24 hrs to the new value required.