question

David Chan avatar image
0 Likes"
David Chan asked David Chan commented

modbus disconnection in 22.1.3

@Phil BoBo

A few versions we had such an issue and it was solved in

https://answers.flexsim.com/questions/74081/modbus-disconnetion.html

But the same issue happens in 22.1, I am not sure if the modbus connection was broken again. Will you please check?

Regards

David

FlexSim 22.1.3
modbus communication
· 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.

David Chan avatar image
0 Likes"
David Chan answered David Chan commented

@Jason Lightfoot @Luciano Cavallero @Phil BoBo

Sorry for not replying.

The phenomenon is that whenever i reset the model, I need to reset my PLC. That's all I could see.

PLC Type: Mitsubishi Electric FX-5U-32MR/ES

Modbus connection: Using RJ45 cables between PLC and PC. I have used Modbus IPV4 in the setting.

I will try to get a record of the video.

Thanks

David


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

Phil BoBo avatar image
0 Likes"
Phil BoBo answered Luciano Cavallero commented

In 20.0.6, the Emulation modbus connection was changed significantly to fix issues with clients connecting to, writing to, and polling from FlexSim.

Also, the modbus register # field was updated to display the actual stored register number rather than a 1-based number to accurately reflect which registers are being used.

Matt Long's commit message has more detail than the release notes. Here's how he described these changes:

In order to get everything working right, I redid the way it creates and terminates the server thread.

The server thread stays running after reset and stop unless the connection becomes inactive or they change settings on the connection, in which case it restarts the thread.

Keeping the thread running allows the user to connect clients to FlexSim and keep them connected.

Clients are NOT able to write to FlexSim while the model is stopped.

Additionally, we properly handle closing sockets when the clients are disconnected and close the server socket with the server terminates. We also ensure that the mapping and

We also now force a close connection when the FlexSim model is closed or Flexsim is closed.

Reenabled the code that passes data from the server thread back to the FlexSim thread.

Based on that message, it was purposefully changed so that the connection stays open when the model is reset. Closing the connection on reset was a band-aid to temporarily fix the issue with not being able to run twice in a row until the actual problem could be solved.

Are you having an actual problem with running twice in a row again or are you just having an issue that the connection is staying open? Because the connection is supposed to be staying open.

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