MATLAB Answers

0

How can I run my simulation for multiple scenarios and save the measurement result to 'To file' block corresponding each scenarios? (Normal Mode simulation)

Asked by Davye Mak on 8 Jun 2017
Latest activity Answered by Rahul Kumar on 29 Aug 2018
Dear everyone,
My name is Davye Mak, a research student at Institute of Technology of Cambodia, majoring in Electrical and Energy Engineering.
Currently, I'm working on determining the PV hosting Capacity of a low voltage distribution network. The network model is built with Matlab/Simulink. So, now I need to run simulation for different scenarios and record the measurement results corresponding to each scenarios. I use to "To file" block to save the measurement result in to ".mat" file, but I don't know how to run the simulation for multiple scenarios and save the result corresponding for each scenarios to different ".mat" files.
I have gone through the webinar video whose title is "Performing power system studies, Part 3: Running Multiple Scenarios Using Multiple Cores", which the simulation is run in Rapid Acceleration Mode. Thus, I am trying to apply this method with the Rapid Accelerator in my model, but the error always occur which show that my model cannot be run with Rapid Accelerator.
Therefore, I hope there is someone here can tell me in detail about how to run simulation in "normal mode" where I can store the measurement result for each scenarios by using "To file" block or any other methods that I can save my measurement result from simulink simulation corresponding to each scenarios.
Your help would be very useful to my current work.
I hope there will be someone who could help me through this.
Best regards, Davye Mak

  0 Comments

Sign in to comment.

1 Answer

Answer by Rahul Kumar on 29 Aug 2018

If you are using R2017a or later, you could create an array of SimulationInput objects (https://www.mathworks.com/help/simulink/slref/simulink.simulationinput-class.html) and use the sim command to run your simulations. If there are 'To File' blocks, the file names would be automatically appended with a unique runId. The SimulationInput object could also be used to specify any changes to the model (model or block parameters or variables) that might be needed for that particular scenario.
For example:
in(1:10) = Simulink.SimulationInput('my_model'); % my_model has 'To File' blocks
out = sim(in); % This will create the mat files
You could also run them in parallel using parsim command if you have the Parallel Computing Toolbox.

  0 Comments

Sign in to comment.