question

Aditya S3 avatar image
0 Likes"
Aditya S3 asked Ryan Clark edited

Is there a way to listen to flexsim model changes in real time?

I know one can use FlexScript to query the model at a particular instance but I am not sure if it is possible to listen to changes in the model as they appear. Flexscript works like any query language, whenever we hit the query with query builders, it returns back the response from it. So if one has to listen to changes with Flexscript in realtime, one has to query the model every few milliseconds depending on the model speed. Is there another way around where we can build something which will broadcast the changes happening in the Flexsim model to the outside of FlexSim? Please help.

@joshuas @arun.k @joerg.v @phil.b @jacob.g @matt.l @jordan.j @david.c @steven.h @benjaminwilson @jeff.n

flexscriptflexsim 21.1.0flexsim realtime
· 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.

Hi @Aditya S3, was jason.lightfoot's answer helpful? If so, please click the red "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Jason Lightfoot avatar image
1 Like"
Jason Lightfoot answered Ryan Clark edited

That sounds more like an application for using the emulation module with OPC-UA to export key variables to which other processes can subscribe.

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

From FlexSim documentation I could figure out that OPA-UA is the protocol for connecting hardware (PLCs) to the emulation model in Flexsim. I am more interested in connecting the Flexsim model to another software component outside FlexSim in real-time.

0 Likes 0 ·

You could try FlexSim's socket commands (find recent comments here), the HTTP API, or or use the embedded Chromium browser along with websockets, ajax calls, etc., along with functions that interact between Chromium and your model. (With Chromium, be aware that with changes as of FlexSim 21.0.0, due to Chromium's multi-process architecture, the FlexScript command callwebscriptmethod() and JavaScript function fireFlexsimEvent() are now asynchronous and do not return values directly. See the linked release notes for more info and an example.

If those don't suit your needs, there is also a Module SDK that will allow you to link external code to allow connectivity to whatever you may need.

1 Like 1 ·

You can run an OPC server on a PC or raspberry pi without a PLC. Additionally Node-Red has OPC modules and support for MQTT.

1 Like 1 ·
立洲 avatar image 立洲 Jason Lightfoot ♦ ·

@傑森萊特富特請教請問如何製作真正的機械臂使用MQTT向節點red發送消息


0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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