Cancel
Showing results for 
Search instead for 
Did you mean: 

endSim of distributed simulation

Genius
Genius

Hello,

 

I use the ExperiementManager to launch several simulations.

 

I want to save my model after each simulation run. Without distributed simulation that works perfectly but when I want to use distributed simulation it just saves the last one.

So I try to catch the endSim to save my model, but...

 

  • I try to use an endSim method, it doesn't work
  • I try to use a waituntil EventControler.isRunning, it doesn't work
  • I try to use the UserEvaluation method, it doesn't work

 

Is there a way to catch the endSim before the "remoteEndSim" ?

7 REPLIES

Betreff: endSim of distributed simulation

Gears Phenom Gears Phenom
Gears Phenom

Hello rpinon,

have you checked out the "save-model" option of the ExperimentManager? Maybe it's what you need:

grafik.png

Best Regards,
Alex

____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!

Betreff: endSim of distributed simulation

Genius
Genius

Hello,

 

Yes, I use it for a non distributed simulation and It works.

But with the distributed mode it saves only the last experience.

 

Regards 

Betreff: endSim of distributed simulation

Gears Phenom Gears Phenom
Gears Phenom

OK, then how about the user-evaluation-method (also under advanced settings)? This should work. I've tried it (but I used distributed simulation only on my local computer, not on several machines). Maybe you used an invalid folder/filepath? The folder must already exist for the saveModel-function. If you don't provide a specific filepath, it may save the model, but I don't know where (definitely not at the location suggested by the documentation...). Try this code:

 

-- After an observation you can perform special evaluations.
(localExp, localRun: integer;
 unused: integer /*always 0*/)
is
	sDestFolder : string; 
do
	
	-- save model-file for each observation
	sDestFolder := "C:\xxx\ExpModels";
	saveModel(to_str(sDestFolder, "\Model_",localExp,"_",localRun,".spp"));
	
end;
____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!

Betreff: endSim of distributed simulation

Gears Phenom Gears Phenom
Gears Phenom

Hello

 

If needed you can add the following to create a folder to save the files into.

 

 

if NOT ExistsFile(sDestFolder) then
startExtProc(To_Str("cmd.exe /C mkdir \"", sDestFolder, "\""), false, true);
end;

 

JamesM

Betreff: endSim of distributed simulation

Genius
Genius

So,

 

I test your solution (simulation attached) and I have exactly the same result :

  • non distributed ==> 3 saves
  • distributed ==> 1 save

I don't know why but, it seems that experiments in distributed are like observation.

See below :

 

 noDist.pngdist.png

 

Maybe it is the problem. 

 

Regards,

Betreff: endSim of distributed simulation

Gears Phenom Gears Phenom
Gears Phenom

In this model, the attribute "ModelDir" is an empty string, so you create an invalid filepath and "savemodel" is not executed successfully. When I provide a valid filepath and directly use the savemodel-function, your model works and saves like a charm for me, with and without distribution.

If it still doesn't work: what Patch-Version do you have?

____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!

Betreff: endSim of distributed simulation

Genius
Genius

I use Plant simulation 13.0.0.

 

And i get my mistake.

 

in my "evaluation method", I use the variable "currExpNo" and with distributed simulation "currExpNo" doesn't exist or doesn't change.

 

I change to "localExp" and now it work.

-- After an observation you can perform special evaluations.
param localExp, localRun: integer,
unused: integer /*always 0*/

print "EVAL Experiment",localExp," Observation: ",localRun

var ModDirLoc := to_str(ModelDir,"\\",savefile,localExp,".spp")
executeSilent("param modStr:string saveModel(modStr,false,false)",ModDirLoc)

 

thanks a lot for your answers Smiley Wink