How to Start fixed simulation time after line is full

How to Start fixed simulation time after line is full

thomas_h3
Not applicable
0 Views
9 Replies
Message 1 of 10

How to Start fixed simulation time after line is full

thomas_h3
Not applicable

[ FlexSim 17.1.6 ]

Hi,

I am building a large model where it takes several days to fill the line. I want to know output of the line for 1 month of production. But as it takes several days to get the first flowitem through the line this results in an unrealistic result.

Is there a way to get the defined run time of 1 month to start after the first flow item enters the last processor?

Thanks!

0 Likes
Accepted solutions (1)
1 View
9 Replies
Replies (9)
Message 2 of 10

axel_kohonen
Not applicable

Hi @Thomas H3

You should be able to use "Warmup time" (see image) to define the time when to start. Also see this post

If the starting time changes between model runs you should be able to do it by setting a starting time for a statistics recorder or whatever you are using to record data from the model.

warmuptime.png

Message 3 of 10

mischa_spelt
Advisor
Advisor
Accepted solution

When the line is full, you can set

Model.stopTime = Model.time + days(30);
0 Likes
Message 4 of 10

thomas_h3
Not applicable

You write when the line is full. How do i know when exactly this is? and where do I set this? What trigger do i use?

0 Likes
Message 5 of 10

thomas_h3
Not applicable

Hi @Axel Kohonen

my version does not have the option as shown on the image.

I like the second idea, but I am not sure how to get that done. Is this something i could set at the onentry trigger of the last processor or is this done within the experimenter? I have only found that I can add a fixed number to the experimenter.

0 Likes
Message 6 of 10

axel_kohonen
Not applicable

Hi @Thomas H3

That might be the case. It is available in FlexSim 17.2.5 which you should be able to upgrade to.

You would need to figure out the best place when to start logging data, but checking it in the onEntry trigger of the last processor would probably work fine.

You can use the solution by @Mischa Spelt below if you do not care about having the extra data recorded from the start of the model run.Alternatively you can try to call the resetstats command when you want to start logging. I have not tried it, but it should reset all stats so that you ignore whatever happened before the time the stats were reset.

0 Likes
Message 7 of 10

mischa_spelt
Advisor
Advisor

Hi Thomas. In general I don't know what the "line" is and what "full" means in your context. It could be when the content of a certain queue exceeds 1, or when a photo eye on a conveyor is blocked, or when the total WIP over a set of objects reaches x.

Since you wrote "when the first flow item enters the last processor" I would put an On Entry trigger on the last processor.

0 Likes
Message 8 of 10

thomas_h3
Not applicable

Hi Mischa,

Yes you are correct. So i intend to write the code on entry of the final sink node.

When i copy your code into my model it complains that it cannot find the label time. Was your solution actual code or just description of the solution.

I am having issues coding it.

As I only want it to trigger on the first flowitem to enter the sinknode, i wrote. Something seems not to work.

if (current.find(">stats/stats_input").value == 1) {
model.stop = model.current + days(30);
resetstats();
}
0 Likes
Message 9 of 10

axel_kohonen
Not applicable

Hi @Thomas H3

FlexSim is case-sensitive so you need to write exactly as Mischa wrote. That is

Model.stopTime = Model.time + days(30)

and not model with a small m.

Message 10 of 10

thomas_h3
Not applicable

Hi @Axel Kohonen and @Mischa Spelt,

I did not have a syntax error, but your solution did not work in my model. not sure why.

I solved my problem with your help. Thanks!

Additionally I needed to ensure the code was only triggered on the first item entering the last processor. I added a Counter label that triggers an if-clause that resets the statistics of the model only on the first item entering the processor.

Also i added a globalvariable that is linked to an editable textbox in my dashboard so I easily can change my modelling horizon.

Thanks for your help!

In the end my code looks as follows;

/**Set stoptime after line is full*/
Object item = param(1);
Object current = ownerobject(c);
int port = param(2);
{ // ************* PickOption Start ************* //
treenode thenode =  current.labels["Counter"];
double value =  1;
inc(thenode,value);
} // ******* PickOption End ******* //
{ // ************* PickOption Start ************* //
if (current.Counter == 1) {
stoptime(model().find("Tools/ModelUnits/ModelDateTime/current").value + model().find("Tools/GlobalVariables/modelling_time"));
resetstats();
}
} // ******* PickOption End ******* //