ATTENTION

This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #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
  #2  
Old 02-26-2008
Cliff King's Avatar
Cliff King Cliff King is offline
Vice President Technical Services
 
Join Date: Jul 2007
Location: Utah
Posts: 272
Downloads: 158
Uploads: 14
Thanks: 102
Thanked 304 Times in 110 Posts
Rep Power: 412
Cliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud of
Default

Is there a reason why you don't put your "ADDITIONAL CODE" before the go() command in your code? If you want code to be executed at different simulation times, then user defined events (userevents) or delayed messages (senddelayedmessage) are the way to go.


Thread Thread Starter Forum Replies Last Post
Displaying the simulation time with the various date/time formats. Regan Blackett Tips and Tricks 12 11-12-2012 08:01 AM
Stop conveyor on loading mathiasds Q&A 2 11-20-2007 04:31 PM
Stop message with information (Debugging) Tom David Tips and Tricks 0 09-20-2007 01:10 AM


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.