question

Arath Prieto avatar image
1 Like"
Arath Prieto asked Logan Gold commented

How to connect 2 flexsim models in real time?

Hello everyone!!!

I am trying to connect one model to another in FlexSim separately. I don't know if there is any software, extension, plugin or something to synchronize both models. I would like to know if it is possible to do it in a separate simulation with another one without affecting the runtime and both simulations running at the same time.

Thank you.

FlexSim 23.1.2
connectionsruntimeconnectionsynchronizationseparately
· 4
5 |100000

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

Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·
What is the purpose of this? What communication other than synchronisation would you be passing between the two models?
0 Likes 0 ·
Arath Prieto avatar image Arath Prieto Jason Lightfoot ♦♦ commented ·

I have 2 complex models that I need to integrate.


They must run together doing their own tasks but in certain moments I need to transfer container with pieces from one to another, download them and return the container to the first. This task takes some time (simulation time, eg. 1 hour). Both models are performing other tasks in parallel, I can't stop the first and wait for the other to return containers.


Both models have different complexity and can run at different speed its own Flexsim instance. Suppose Model 1 runs at a maximum of 500X and Model 2 is running at 100X.

If I have to wait 1 hour (simulation time) in the second model to return the containers, how can I synchronize both models ?


Is there a way to both Flexsim’s can connect internally to synchronize between instances so both runs at same speed executing their own logic ?

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Arath Prieto commented ·
FlexSim has the communication hooks for you to be able to communicate between the two models and develop something that would attempt to keep them aligned but even if you get that to work, you'll be constraining the fast running model to the speed of the slower one and so wouldn't gain very much performance. If you're doing replications you're better having one model and increasing the number of parallel replications by changing hardware (more memory/more cores).

If you are able to predict key events that cross between the models then you could fast run to those but often times these events emerge in the model and you discover that one has already gone past that event time. This topic has been the subject of many papers over the years about Time Warp Simulation for multicore models, which last I heard involves rolling back to a restored state before continuing - something that FlexSim doesn't currently support.

1 Like 1 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·

Hi @Arath Prieto,

We haven't heard back from you. Were you able to solve your problem? If so, please add and accept an answer to let others know the solution. Or please respond to the previous comment so that we can continue to help you.

If we don't hear back in the next 3 business days, we'll assume you were able to solve your problem and we'll close this case in our tracker. You can always comment back at any time to reopen your question, or you can contact your local FlexSim distributor for phone or email help.

0 Likes 0 ·

1 Answer

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Logan Gold commented
FlexSim has the communication hooks for you to be able to communicate between the two models and develop something that would attempt to keep them aligned but even if you get that to work, you'll be constraining the fast running model to the speed of the slower one and so wouldn't gain very much performance. If you're doing replications you're better having one model and increasing the number of parallel replications by changing hardware (more memory/more cores).

If you are able to predict key events that cross between the models then you could fast run to those but often times these events emerge in the model and you discover that one has already gone past that event time. This topic has been the subject of many papers over the years about Time Warp Simulation for multicore models, which last I heard involves rolling back to a restored state before continuing - something that FlexSim doesn't currently support.

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

Sachin T avatar image Sachin T commented ·

hey Jason, can you please elaborate more on the communication hooks you are talking about or may be send an example model where you have communication sent between 2 different models ruinning on same computer. I have a similar requirement..where i have one model and a package is packed as end process in the simulation 1. I want to send the package data along with the timestamp it exited the pack station to other model for "Simulation 2" for further processing.

0 Likes 0 ·
Logan Gold avatar image Logan Gold ♦♦ Sachin T commented ·

Hey @Sachin T, here is an older post that goes over different ways to communicate between FlexSim and other processes. I believe you can communicate between two instances of FlexSim (on the same computer or otherwise) using these methods. Also, I think one of the links in the post is broken, but it would have been pointed to something similar to the Categorial Index of the FlexScript commands in the documentation, specifically the commands in the Communication section.

I know for sure that you can communicate between models using sockets. The post mentions sockets from a post in the old forum, but I tried to make a more robust example more recently that I haven't posted about anywhere yet. I'll include it here (sockets_example_2023.zip) if you want to see another way to do it

0 Likes 0 ·