question

Robert F2 avatar image
0 Likes"
Robert F2 asked Robert F2 commented

FlexSim freezes when I try to run my model

cusersmybn75zdesktoprobert-flatteryflexsimd571clut.fsm

I am working on a somewhat complex model. When I try to run the simulation, my computer freezes up and FlexSim is not responding. When this happens, FlexSim is using a huge chunk of my computer memory. I have tried splitting up this model into separate models and that did not help at all. Is there a way I can compress my model in some way to fix this issue?

Thanks

FlexSim 19.1.2
model wont start runningfreezes
5 |100000

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

tannerp avatar image
1 Like"
tannerp answered Robert F2 commented

Hi @Robert F2,

I'm not positive this is the primary reason for the crashing, but I examined your Source objects and many of them are creating 100000 items at time = 0. So if you think about the requests that the computer is trying to handle at time = 0, it's trying to create millions of items, assign millions of names, and create millions of labels, and draw millions of 3D objects before the model even gets to time = 0.01. I'm thinking that's why the model won't run... I suggest that instead of creating all 100000 objects in any given source, you assign something else to handle the quantity in stock. For example, a Global Table cell the quantity value of 100000 and have the Source create a new item every time the Queue is depleted, then decrement the Global Table cell by 1.

Example explained:

1) Source creates object and sends object to queue, Global Table value (100000) is decremented by 1 to become 99999

2) Queue releases object and trigger is fired telling Source to create a new object

3) Source looks at Global Table value and sees that there is >0 quantity available (99999)

4) Source creates new object and decrements Global Table value to become 99998

5) When Global Table value is = 0, Source no longer creates a new Flow Item until model reset or other trigger resets Global Table value

After I changed all the Source arrival quantities to lower values (10 instead of 100000), the model runs fine.

Let me know if you'd like help implementing my suggestion, but otherwise, the principle here is to limit the number of Flow Items being created in the system at one time. This is especially true for custom 3D objects.

Here's the model with lower quantity values for Flow Item creation.

limited-number-at-sources.fsm


· 1
5 |100000

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

Robert F2 avatar image Robert F2 commented ·

Thanks Tanner, that seems to be what was causing the issue.

0 Likes 0 ·
Regan Blackett avatar image
2 Likes"
Regan Blackett answered Regan Blackett edited

Looking at the events scheduled at the start of the model I think you are just creating too many Flowitems.Several Sources are creating 1000 or even 10000 as soon as the model begins.That’s a lot of creation events. I would try reducing the number of events at the start of the model, because once you get past all that flowitem creation, the model starts to run normally.

Without knowing your model and what's important and what's not, in order to mimic what's happening now I would do something like this Process Flow:

This would create one token that has a label on it equal to the total number of flowitems you want to make. Everytime you create a flowitem, decrememnt the count by 1 and ask if the queue is full and if there are more flowitems to make. If the queue is full wait for it to decrease it's content. And then the token loops around and goes again. See attached model: processflow-on-demand-flowitems.fsm

There are errors related to flowitem labels and accessing them in your Mode 1 process flow as well.

OnReset you’ve got errors in your Decide activity because it looks like you are trying to use the Event Triggered source to capture the value of your “count” label from a flowitem leaving Press 1, but that’s not how those fields work.The Label/Assignment matching fields allow you to create labels on tokens that have values provided by the event you are listening to. Listening to OnExit of a Combiner provides two pieces of data; it can tell you what port a flowitem exited through, or it can tell you the flowitem that exited.You can then use that event-based data to create labels that store that data, and only that data.

The value of the “count” label you assigned to that token is a reference to the flowitem itself not the count label that is on the flowitem. The correct thing to do would be have the label on your token named something like MyItem.Then your Decide activity can use the expression token.MyItem.count to access the value stored on the actual flowitem. So your condition should be token.MyItem.count == 10.

On Exit from the Press1 object you are incrementing "count" but this is giving you a FlexScript exception. Before the increment step, do a set label for "count" and give the value as zero and the exception goes away. For some reason it wanted you to have the label exist first before incrementing it.


5 |100000

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