question

Cameron Seams avatar image
0 Likes"
Cameron Seams asked Steven Hamoen answered

How to call the simulation time as a variable to insert into an equation?

I am in need of a function to call the simulation time and use this value in an equation. For example, if I run my model for 3 days, how do I call the simulation duration (3 days) instead of hard coding the number 3 into my equation? The goal is to the make the equation dynamic. Help is much appreciated.

dashboardstimesimulation timeglobal variable
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Steven Hamoen avatar image
3 Likes"
Steven Hamoen answered
@Cameron Seams

you can simply use the function time(). It returns the current simulation time in seconds

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Michael Kramer avatar image
1 Like"
Michael Kramer answered

@Cameron Seams, you can set the simulation time using the function stoptime(100) for example, to stop at 100 time units.

To set the integer "StopTime," pass -1 into the function, i.e. int StopTime = stoptime(-1);

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.