Cancel
Showing results for 
Search instead for 
Did you mean: 

Running method at end of simulation other than Endsim

Pioneer
Pioneer

Hi forum,

 

I want to run method after the end of simulation.

I am starting the simulation in a method and  wants to run the remaing codes once simulation is finished. 

How can i do it in the same method,

That is without using endsim.

 

Regards,

Abhirath

14 REPLIES 14

Betreff: Running method at end of simulation other than Endsim

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello Abhirath,

 

you can watch the attribute isrunning of the eventcontroller. So you method can look like:

[fist code]

waituntil not root.eventcontroller.isRunning prio 1

[code after simulation run has stopped]

 

Hope this will help

 

Regards

 

GG

Regards
GG

------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution

Betreff: Running method at end of simulation other than Endsim

Pioneer
Pioneer

Hello GG,

Thanks for the replay.

 

I tried the same but dint get the results.

 

I am attaching a model were in the method is suppose to start simulation and after simulation is complete some modification are done in Tablefile and a promt message is displayed. But the message is displayed before the simulation starts and no modifications are done.

 

Please suggest the changes required so that the modifications and message pops up after the simulation is completed.

 

Thanking you,

With regards,

 

ABHIRATH

 

Re: Running method at end of simulation other than Endsim

Creator
Creator

Hello, Abhirath.

Why do you want to run a method at the end of simulation and you can not use the EndSim method?

I am wondering this just for better understand what do you need.

Regards, Rafael

Re: Running method at end of simulation other than Endsim

Pioneer
Pioneer

Hello RafaelCarmanini,

 

The model i am working on has multiple simulation that has to be runned.

The whole model is controlled throught dilogbox and buttons,

The problem with endsim is that when ever i run a perticular simulation the other codes which are suppose to happen while running a differt simulation also get exicuted, which is slowing down my model.

So i am looking for other options.

 

 

Regards,

ABHIRATH

Betreff: Running method at end of simulation other than Endsim

Creator
Creator

Hello, Abhirath.

I made some changes in your model. Look at the "Init" method and the breakpoint I inserted there. When the simulation reaches this breakpoint, the simulation seems to already completed the simulation time defined on "Settings" tab of EventControler.

Is this what you need?

Regards, Rafael

Betreff: Running method at end of simulation other than Endsim

Pioneer
Pioneer

Thankyou Rafael for the relpy..

Can you plese save the model in version 13 and post again.

 

Regards,

ABHIRATH

Re: Running method at end of simulation other than Endsim

Siemens Phenom Siemens Phenom
Siemens Phenom

Even if Rafaels approach looks like your solution I would like to ask whether you're aware of the Experiment Manager. Often your kind of question can (dependent of the use case) be solved by it.


Regards

Always consider using the AttributeExplorer!

Betreff: Running method at end of simulation other than Endsim

Creator
Creator

Hello,

Here is attached the model I changed in version 13.0.

Regards, Rafael

Betreff: Running method at end of simulation other than Endsim

Pioneer
Pioneer

Hello Rafael,

 

Thanks again for the model.

But this still doesnt solve my problem.

 

My model has different simulation runs where in i capture different data, then i modify the data based on the simulation run that has been done. The problem is in part of the modification of data I do.

 

For example,

 

I run simulation1 and collect data AA and do modification on data AA using codeA.

I run simulation2 and collect data BB and do modification2 on data BB using codeB.

 

But now when i run simulation1 or simulation2 both data AA and BB are getting modified because endsim or init menthod has both codeA and codeB.

 

What i want to do is,

when simulation1 ends only codeA must be exicuted.

when simulation2 ends only codeB must be exicuted.

 

Plese suggest me the modifications required for doing so,

 

Thanking You,

ABHIRATH