Connecting flexsim to external application via UDP

Connecting flexsim to external application via UDP

aditya_s3
Not applicable
16 Views
4 Replies
Message 1 of 5

Connecting flexsim to external application via UDP

aditya_s3
Not applicable

[ FlexSim 21.1.2 ]

Is there any way to connect FlexSim with an external application using UDP web sockets? I am currently working on building a digital twin for a warehouse where they use UDP to communicate with a few of the components and I am looking for emulating the behavior of UDP. Or Is there any way to emulate the UDP protocol in FlexSim?

0 Likes
Accepted solutions (1)
17 Views
4 Replies
Replies (4)
Message 2 of 5

joerg_vogel_HsH
Mentor
Mentor

As far as I know you communicate through sockets. I am not aware of how to establish a broadcast and send a datagram without receiving an acknowledgement packet within a Windows socket process.

0 Likes
Message 3 of 5

joerg_vogel_HsH
Mentor
Mentor

As documented there is not an init socketx implemented so far in socket communication. Maybe you can execute a program within Windows to send an udp datagram, similar to a power shell script.

Message 4 of 5

Ben_WilsonADSK
Community Manager
Community Manager
Accepted solution

FlexSim's native modeling language, FlexScript, does not natively support websockets. Without that support, anything you try will be a bit complicated.

Here are some alternative communication modes that may or may not work with your system:

========== SOCKETS ==========

FlexScript includes out-of-the-box support of Windows sockets. See the Command Reference > Communication commands section and search for the "client", "server" and "socket" commands. There are also related questions on this community that can help you with implementation.

========== WEBSOCKETS (using Chromium) ==========

FlexSim's integrated Chromium browser supports websockets.

You can use the commands callwebscriptmethod() and the JavaScript fireFlexsimEvent() function (on the Chromium side) to interact between your model logic and Chromium. See the version 21.0.0 Release Notes and History (flexsim.com) for information regarding fireFlexSimEvent's asynchronous nature.

This comment has an example model and some further explanation of callwebscriptmethod() and fireFlexsimEvent(), though it was created with an older version of FlexSim before fireFlexSimEvent() was asynchronous, so some updates may be required for this example to work in a modern version of FlexSim.

========== OPC UA ==========

FlexSim's OPC UA integration could communicate with a node-RED server you would set up. node-RED could then communicate with other services via websockets.

========== HTTP ==========

You could explore the HTTP api and whether your system can respond to HTTP requests. In addition to sending requests and receiving responses, if your simulation model needs to receive HTTP requests and send responses, you could learn about the FlexSim Webserver.

Message 5 of 5

eric_m3
Not applicable

Hi @Aditya S3, was Ben Wilson's or Jörg Vogel's answer helpful? If so, please click the red "Accept" button at the bottom of one of their answers. 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