question

Lukas Buchta avatar image
0 Likes"
Lukas Buchta asked Lukas Buchta commented

Modbus control register - read

We have new assembly line and I would like to read PLC with modbus TCP. video of the line and PC

modbus_test.fsm

In the model, when register 2001 hits value 1, then conveyor1 set speed 1 (state conveying). When PLC hits 0, then conveyor should stop.

It doesn't work. Please, do you know, where is the mistake?

I checked connection PLC - computer with modbus scanner and I receive data from PLC.

modbus-example.png

But is there a way, how I can check, that FlexSim receive data from register?


FlexSim 22.1.2
plc emulationplcmodbus communicationconnectivity
modbus-example.png (50.2 KiB)
modbus-test.fsm (174.6 KiB)
· 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 ·
Hello @Lukas Buchta, Were you able to recwive the help you needed with this question from Luciano? If so can I close out this question?
0 Likes 0 ·
Pongsakorn S avatar image Pongsakorn S commented ·

Hello. @Lukas Buchta I have seen you can solve a problem about Modbus control register from your question that you can read data between PLC and FlexSim.

So. I would like to know how you can solve this problem.

Can you show me the example Ladder diagram in GX-Work 3 and your solution to to send and recieve data with FlexSim Emulation. How I can use and confrig some tool for communication

Now I have Mitsubshi iq-F FX5u-32 MR/ES and FlexSim version 2021.0.8 - 2023.0.1.

Thank You very much for help.

0 Likes 0 ·

1 Answer

Joshua S avatar image
0 Likes"
Joshua S answered Lukas Buchta commented

You are setting all the conveyor speeds to 1, so that should be a quick fix.
An easy way to debug a model like this is add a code snippet to the Default value Action, and add the print statement shown in the image. Then you can open up an Output Console and see if FlexSim is reading from the PLC, and what values it's reading while it's running.

1655739745730.png


1655739745730.png (39.9 KiB)
· 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.

Lukas Buchta avatar image Lukas Buchta commented ·

@Joshua S thank you, so i just print old/new value and i can see:


capture.png

My computer can read PLC data via MODBUS

capture1.png


Flexsim can't read PLC data. Do you have any idea why?

Do I write wrongly the register number? Or what do i do wrong?

these are the values. I expected only 1 and 0 as i can read in modbus reader. Do you know what does it mean?

capture2.png

Thank you

0 Likes 0 ·
capture.png (135.7 KiB)
capture2.png (2.5 KiB)
Joshua S avatar image Joshua S ♦ Lukas Buchta commented ·

I'm wondering if FlexSim is reading multiple coils at once. Can you send me a screenshot of what the coil values are when FlexSim reads a value of 1, 32, or 48? Also can you send me what type of PLC you are using and the settings it is set to use?

0 Likes 0 ·
Lukas Buchta avatar image Lukas Buchta Joshua S ♦ commented ·

@Joshua S thank you for your help. The PLC on register 2201 send only 0 and 1.


modbuserror.png


the PLC is Mitsubishi Electric MELSEC iQ-R

those values 48 and 32 are random numbers i do not know from where...

I should receive only 0/1 as i receive in modbus scanner.

0 Likes 0 ·
modbuserror.png (12.8 KiB)
Show more comments