Jump to content
Saurya Mishra

Automated simulation and capturing data

Recommended Posts



I am trying to do a Monte Carlo simulation on my model. I am varying the inputs based on a Normal distribution to see how the output behaves.

I need help with 2 things here.

1. Is there a way to automate the execution of the simulation, so that it simulates multiple times (say 1000 times)

2. is it possible to capture the data in a .csv file by appending it, so that i get data from all the simulations, and that it is not overwritten everytime the simulation runs.




Share this post

Link to post
Share on other sites

Hi Syurya,


I have no exact solution for your task, but look at the example "moonlanding_opt.scm" in Demo Browser, Activate, Games. The combination of elements in super block "next last" and "Restart" in "optimize" allows you to run a defined number of simulations.


The ToCSV block overwrites the file at every new simulation :(. I suggested a modification to the development team, but expect it not before next release. You can try to write your own C block with fopen(filename, 'a') (or similar). It should be easier than the output of an event activation ;)


Best regards,

Share this post

Link to post
Share on other sites

Ciao Saurya,

Please here you find a possible solution implemented using Activate 2019.


1- Open Activate2019 go under tools->oml editor and load Master2019.oml.

This file is the master that will generate a new input file (input2019.csv) for the Activate model (Slave2019.scm) at any iteration of the for cycle and will run in batch mode

the Activate model Slave2019.scm.




2- Slave2019.scm will generate a different csv file for each run (authomatically named run1.csv, run2.csv... so that it is easy for You to identify which run the data refers at) 


3- To run the example just remember to adjust the paths according to your installation (also inside the *.bat file).


4- Unfortunately for the moment isn't possible to append the data in the same .csv. A possible solution for that may be to do only 1 run longer (final time= time for a run * runs number)

and change input when (simulation time) / (time for a run)=integer number.


Best Regards,







Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now