question

Adna Lima avatar image
0 Likes"
Adna Lima asked Adna Lima commented

Problems to receive data from PLC using Modbus

Hi, I'm having a problem to receive data using Modbus protocol

Variables of type "Coil" are assuming integer values >1 in Flexsim, which impacts the identification of information arrival in some variables.


We noticed that in the first moments of simulation the information is received correctly and after a certain interval the values start to change randomly. I saw something similar in this question: https://answers.flexsim.com/questions/122489/modbus-control-register-read.html


I'm using a Modbus TCP Connection with a Delta AS228P PLC. Flexsim version is 22.2.3. And to check the receipt of data from the PLC I used the "Wireshark" program, at first the PLC sends the data correctly, but Flexsim is not receiving it in the proper format.

In this model I tested the same variable with the 4 types possibles


By reading a boolean variable referring to a light sensor I obtained this data. The first column refers to the received data and the second to the Model.time.

variable-500-sensor-out.png


Would it be a bug? Or would there be some other configuration needed?


Teste_Endereço_Modbus.fsm

FlexSim 22.2.3
plc emulationmodbus communication
· 13
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 ·

Hi @Adna Lima,

Were you able to solve your problem? If so, please add and accept an answer to let others know the solution. Or please respond 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 ·
Luciano Cavallero avatar image Luciano Cavallero Jeanette F ♦♦ commented ·

Hi Adna,

Meanwhile I tried your model with a Flexsim 22.2.3 and Flexsim 2023 with a Modbus Client (not your PLC model) and I able to receive data.

if you haven't already fixed the problem could you use this modbus scanner (https://store.chipkin.com/products/tools/cas-modbus-scanner) to see Flexsim-PLC communication and share the results?



1 Like 1 ·
Adna Lima avatar image Adna Lima Luciano Cavallero commented ·

Hi Luciano!


We ran several tests and initially all presented the reading of variables correctly, however, after a few minutes, Flexsim began to present this oscillation when receiving the values of variables of the COIL type. Such a problem is not evidenced and reported as an error in the interface by the Flexsim program, also making it difficult to analyze the root cause of the problem during the tests. To identify this error, after several tests, it was necessary to open the Emulation tree showing the value of the variables and follow one by one of these variables involved in the test.


We used a scanner program called "wireshark" and the test showed that the PLC is sending correctly since Wireshark was able to read the variables and their changes correctly during the test execution. Raising the possibility of error in other topics, such as the error may be in Flexsim at the time of receiving information.


1675349643062.png


During the test with the PLC via Wi-Fi, a timeout was detected when receiving data "Request timeout" (Figure below), thus, it was necessary to adopt a Change Interval > 1 in Flexsim for data detection, so there were no problems in the variable readings.


1675349668462.png


During the testing process, it was noticed that replacing the wireless communication network (WIFI) with wired communication (Ethernet) minimizes the occurrence of errors. Therefore, the use of a wired network for interconnection between the FlexSim simulator and the PLC was recommended.


But I didn't try the 2023 version yet.

0 Likes 0 ·
1675349643062.png (313.9 KiB)
1675349668462.png (518.3 KiB)
Show more comments
Show more comments
Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Adna Lima,

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 ·

0 Answers