question

christophe C2 avatar image
0 Likes"
christophe C2 asked Phil BoBo commented

Make code C++ to speed up a model

I have some issue with the speed of my model.

As you can see in the attached model, I used few different items type and various triggers logic into my queues.

I red different articles about the model speed, and I think is due in my case of the large number of events caused by my triggers and big quantity of items.

I want to follow the procedure explained in this article on the old forum

I’m not a programmer and I’m not used to this type of process with code.

I try to change few queues on “make C++ code” and then compile my model, but it doesn’t work.

Do you think this approach can speed up my model? How can I manage to make C++ code all my triggers?

slow-model-exemple-flexsim.fsm

Choose One
triggersc++model speed
5 |100000

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

1 Answer

Matt Long avatar image
5 Likes"
Matt Long answered Phil BoBo commented

Using C++ isn't going to improve your model's speed. As you already pointed out, your model is running slow due to the large number of items and events in your model. Running your model for just 75 seconds (simulation time) and you have 21629 flowitems and have executed 1,048,576 events.

I'm running your model in FlexSim 2017, where the FlexSim compiler has been updated to compile FlexScript into machine code (this makes FlexScript just as fast as C++) and it's still really slow. The only reason to use C++ would be if you wanted to utilize external C++ libraries that are not available in FlexSim.

In order to improve the speed of your model you need to rework the way you're model runs. I can't speak for this model as I'm not sure what it's supposed to be doing, but let me give you a warehousing example.

Let's say I want to simulate a warehouse where I have pickers that fulfill customer orders. Let's say the facility has 50,000 different SKUs (products) and each of those SKUs has an in stock quantity ranging from 10 - 100. This would require around 2,754,222 flowitems in my model to to represent each item. Instead of creating all of these flowitems at the beginning of my model, I create them on demand as I fulfill my order. If an order has 10 items in, I start with the first item, create a flowitem at the right place in the model and have my operator walk to it. Once picked, I move to the next item, create another flowitem and then move to it, etc. Using this method, my model now only has a few flowitems on racks at a time, and the total number of flowitems is equal to the number of orders currently being worked on (whether in picking or packing).

Perhaps there is a way to limit the number of items you have moving through your model. Or perhaps you can batch items such that each flowitem represents multiple items.

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

Phil BoBo avatar image Phil BoBo ♦♦ commented ·

@christophe C2

In your model, you have several queues called "stock #" that contain a large number of flowitems. You are moving these flowitems using two objects called TaskExecuter144 and TaskExecuter145. These items are being moved in large batches, but you are doing it one at a time with a single task sequence for each item and a Break To option for Same Load Station.

The generation, assignment, sorting, and execution of these thousands of task sequences is what is slowing down your model.

You could improve your model's performance by using a Combiner to combine all these items together and make a single task sequence to carry the whole load at once. Then use a Separator to separate the individual items when they need to processed individually.

You could also improve this by using custom code or Process Flow (instead of a combiner and separator) to generate a single task sequence to carry all of the items instead of individual task sequences for each item.

2 Likes 2 ·