Cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger method in beginning of simulation and end.

Creator
Creator

Hi 

 

I would like to know how to trigger a Method at the start of your simulation with time? The reason for this is the method reads in values from a text and assigns values to variables which is used during the simualtion.

 

I also would like to know how to trigger a Method at the end of your simulation run (end time of EventController)? Reason is that values which was generated during the simulation needs to be written into a list which is then written into a textfile.

 

Any advice, help, code or alternative methods will be appreciated! 

 

 

 

2 REPLIES 2

Re: Trigger method in beginning of simulation and end.

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

For initializing your simulation you can use any method with the name init. The eventcontroller calls each init-method in the model before start the experiment. For works after end of the simulation you can use a method with the name endSim. This is also called by the eventcontroller after end of each experiment.

 

When you look for an option to call a method at each start/stop of the experiment you can use an observer for EventController.isRunning.

Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: Trigger method in beginning of simulation and end.

Creator
Creator
Thanx alot Steffen!