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.

Joshua S avatar image Joshua S commented ·

@David Chan What is the exact issue you are having? I was able to connect FlexSim to a modbus simulator and they were able to send and receive data to each other after multiple resets of FlexSim.

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·

Hi @David Chan, was Phil or Luciano's answer helpful? Did your issue get resolved?

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

Jeanette F avatar image Jeanette F ♦♦ commented ·
@David Chan, Were you able to record and replicate the issue?
0 Likes 0 ·
David Chan avatar image David Chan Jeanette F ♦♦ commented ·
@Jeanette F I am unable to setup the system at the moment. May be you can close the case first till I am able to do so. I will contact Phil directly,


David

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

David Chan avatar image David Chan commented ·
@Phil BoBo Whenever I reset the model, I need to reset the PLC in order to have the connection between FlexSim and PLC. To me it is the same as in previous time. So it seems the server thread did not stay connected after reset.


Regards

David

0 Likes 0 ·
Luciano Cavallero avatar image Luciano Cavallero David Chan commented ·
Hi David,

Which is you current configuration?
That is:

- how modbus connection is configured?
- which PLC are you using?


BR

Luciano



0 Likes 0 ·