PDA

View Full Version : exit after certain time


Raul Paz
06-02-2009, 03:39 PM
I have people waiting in a queu, if they wait more than 8 minutes they leave, how can i simulate this without using a delayed message

Phil BoBo
06-02-2009, 05:15 PM
Why don't you want to use a delayed message?

Attached is a sample model that shows an easy way to do this by using a delayed message. Is there any reason why this way won't work for your situation?

Raul Paz
06-02-2009, 07:37 PM
they thanks a lot i ended up using the delayed message, i just wanted to see if there was another way because am not to familiar with the use of delayed messages, but i learned something new so thxs a lot

JMEngelhart
07-02-2009, 10:13 AM
I did just that in a recent model. I wanted to give the user the option to have the model stop after 24hours to see how much they had processed.
I used the following:
if (Hrs24 == 1)
{
if (getnodenum(node("MAIN:/project/exec/time")) >= 86400)
{
stop ();
}
}

The Hrs24 is a variable that tells me if I want to do the stop or not. The 86400 is 24 hours in seconds.
I had this in a hotlink in my GUI.

Carsten Seehafer
07-03-2009, 01:48 AM
@JMEngelhart: You can use a "User Event" to do the same. Just set "First Event Time" to 86400 and enter stop() into the script window of your User Event. If you want to stop the run time every day you can select "Repeat event" and enter "Repeat Event Time".

zhang xin
07-19-2009, 07:04 AM
Why don't you want to use a delayed message?

Attached is a sample model that shows an easy way to do this by using a delayed message. Is there any reason why this way won't work for your situation?

Phil, I wonder if I can use moveobject command instead of hold and releaseitem. Is there any side effect?

Phil BoBo
07-20-2009, 09:56 AM
Calling moveobject() directly doesn't let the objects' default functionality do its thing, such as objects being blocked, ports being closed, max content being met, transports being used, etc.

You can also run into trouble if there are pending events that assume the object is going to be somewhere and it isn't there because you called moveobject() on it rather than letting the objects move the flow items around naturally.