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 12-20-2010
Jan Van Belle Jan Van Belle is offline
Flexsim User
 
Join Date: Apr 2010
Posts: 4
Downloads: 0
Uploads: 0
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 0
Jan Van Belle is on a distinguished road
Default Problem with resetmodel()

Hi,

when I try to reset a model (resetmodel()) in the On Run Stop trigger, Flexsim just quits. Can someone explain what I do wrong?

Many thanks in advance!
  #2  
Old 12-20-2010
Anthony Johnson's Avatar
Anthony Johnson Anthony Johnson is offline
Manager of Product Development
 
Join Date: Jul 2007
Posts: 440
Downloads: 86
Uploads: 4
Thanks: 171
Thanked 899 Times in 288 Posts
Rep Power: 735
Anthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond repute
Default

The resetmodel() command may actually cause the OnRunStop to fire. So you call resetmodel(), which calls your OnRunStop, which calls resetmodel(), which calls your OnRunStop... until you get stack overflow and crash. Try doing instead:

if(time() > 0) resetmodel();

Although that may still not work. If not, try:

if(time() > 0)
{
setnodenum(node("MAIN:/project/exec/time"), 0);
resetmodel();
}
The Following 2 Users Say Thank You to Anthony Johnson For This Useful Post:
Jan Van Belle (12-22-2010)



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.