question

Thomas H3 avatar image
0 Likes"
Thomas H3 asked Thomas H3 commented

How to Start fixed simulation time after line is full

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!

FlexSim 17.1.6
display run timerun time adjustment
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Mischa Spelt avatar image
0 Likes"
Mischa Spelt answered Thomas H3 commented

When the line is full, you can set

Model.stopTime = Model.time + days(30);
· 5
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Thomas H3 avatar image Thomas H3 commented ·

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 ******* //
1 Like 1 ·
Thomas H3 avatar image Thomas H3 commented ·

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 0 ·
Mischa Spelt avatar image Mischa Spelt Thomas H3 commented ·

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 0 ·
Thomas H3 avatar image Thomas H3 Mischa Spelt commented ·

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 0 ·
Show more comments
Axel Kohonen avatar image
1 Like"
Axel Kohonen answered Axel Kohonen commented

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


warmuptime.png (19.9 KiB)
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Thomas H3 avatar image Thomas H3 commented ·

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 0 ·
Axel Kohonen avatar image Axel Kohonen Thomas H3 commented ·

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 0 ·