View Single Post
  #1  
Old 02-26-2008
Fadhlullah Bin Rahmat Fadhlullah Bin Rahmat is offline
Flexsim User
 
Join Date: Feb 2008
Posts: 8
Downloads: 0
Uploads: 0
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Fadhlullah Bin Rahmat is on a distinguished road
Default How to run tasks after stop time?

Hi,

The codes below is what I've implemented in my Model StartUp Code Section. So, once I compile the model, the following codes will be executed. However, I've a major problem. Here are the codes:

================================================== =====
/*open EXCEL worksheet*/
excelopen("C:/airport.xls");
excelsetsheet("Sheet1");

/*reading necessary values from EXCEL*/
optimisation = excelreadnum(3,2);
no_of_counters_open = excelreadnum(5,2);

/*used only for optimisation*/
if(optimisation==1){

cmdloadbyextension("c:/state.fst",1);
stop_time = 136;
setnodenum(node("project/exec/stoptime",main()),stop_time);
setnodenum(node("/1/1/3",main()),2147483647);
excelclose(1);

}

reset();
go();
//ADDITIONAL CODES HERE

================================================== =====
As you can see from the code in red, the model is set to stop at 136 units of simulation time. However, since the code in blue sets the simulation running time to be unlimited, I can't seem to run the additional codes after the final go(), as the model will go immediately to 136 and stopped.

What I've done is to create a User Event every 50 time units, and will have to pause the simulation just to check the time. Then the simulation just ran into infinite loops, hanging my workstation in the process.

Anyone has any suggestion or idea how do I get around this? Or have I implemented it wrongly?

Regards,
Fad
Reply With Quote