× Components and Libraries for HMI/SCADA applications, discussions, problems and suggestions

Question PascalScada Modbus RTU with Moxa problem

  • Marcin
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago - 6 years 9 months ago #6461 by Marcin
Replied by Marcin on topic PascalScada Modbus RTU with Moxa problem
@avra,

I'll attach file in zip.
System: WIN8.1 64 bit
simulator from: www.plcsimulator.org/

First is Modpoll connected do the Moxa DE-211 (RS-232, COM2) . Moxa is connectet to USB-RS-232 optoizolated and is connected to the simulator (RS-232, COM1).
Com2: baud 9600, data bits:8, parity: none, stopbits:1 ---- Modpoll
Com1: baud 9600, data bits:8, parity: none, stopbits:1 --- Simulator

Moxa setup:

File Attachment:

File Name: moxasetup.zip
File Size:462 KB

modpool screen and simulator:

File Attachment:

File Name: modpoll_and_sim.zip
File Size:289 KB

You can see that is recievied 21DEC [15Hex].

second is HTerm connected do the Moxa DE-211 (RS-232, COM2) . Moxa is connectet to USB-RS-232 optoizolated and is connected to the simulator (RS-232, COM1).
nothing change to moxa sets.
HTerm and simulator :

File Attachment:

File Name: HTerm_and_sim.zip
File Size:229 KB


Now PascalScada connected do the Moxa DE-211 (RS-232, COM2) . Moxa is connectet to USB-RS-232 optoizolated and is connected to the simulator (RS-232, COM1).
Pascalscada and simulator:

File Attachment:

File Name: PascalScad..._sim.zip
File Size:260 KB


@papelhigienico in attachment PascalScada_and_sim.zip there is the TTIPropertyGrid You told me to put on project.

@avra, Can You see for now these tests ? The rest I will test later.

EDIT:

@avra,, I can't use simulator (like www.modbustools.com/modbus_slave.asp) because my time of useing has expired. I use www.modbusdriver.com/diagslave.html
PascalScada connected do the Moxa DE-211 (RS-232, COM2) . Moxa is connectet to USB-RS-232 optoizolated and is connected to the simulator2 (RS-232, COM1).
Pascalscada and simulator2:

File Attachment:

File Name: PascalScad...sim2.zip
File Size:298 KB


HTerm connected do the Moxa DE-211 (RS-232, COM2) . Moxa is connectet to USB-RS-232 optoizolated and is connected to the simulator (RS-232, COM1).
HTerm and simulator2 :

File Attachment:

File Name: HTerm_and_sim2.zip
File Size:217 KB
Last edit: 6 years 9 months ago by Marcin.

Please Log in or Create an account to join the conversation.

  • Marcin
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago - 6 years 9 months ago #6470 by Marcin
Replied by Marcin on topic PascalScada Modbus RTU with Moxa problem
Today I put test with Scada and PLC XBC-DR20SU LS.
Moxa sets without any changes.

First is PascalScada and PLC connected with USB<->RS-232 (FTDI optoisolated)

File Attachment:

File Name: scada_plc_ftdi232.zip
File Size:514 KB



Second is Pascalscada with PLC and MOXA

File Attachment:

File Name: scada_plc_moxa.zip
File Size:257 KB


The ioDriverError on LastSyncWrite shows when I put some Value on HMIEdi1 and send value (enter button on PC)

More test will be soon.

EDIT:

I forgot about the cable info. I use about 1 meter 4x0,5mm2.
PC <->PLC
RX - TX
TX - RX
GND - GND

@avra and @papelhigienico please check it and tell me what more test is needed.
@avra You want me to change the cable, but please tell me what kind of cable should I use?
maybe shielded, I don't know :unsure: .
This test I made at home, so there is without any noises.
If need, I can use another type of Moxa.
Last edit: 6 years 9 months ago by Marcin.

Please Log in or Create an account to join the conversation.

  • Marcin
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago - 6 years 9 months ago #6471 by Marcin
Replied by Marcin on topic PascalScada Modbus RTU with Moxa problem
Test with two terminals:

File Attachment:

File Name: echo_test.zip
File Size:281 KB


Test with Virtual comm RS-232 pair
Pascalscada and simulator:

File Attachment:

File Name: scada_and_sim.zip
File Size:242 KB


HTerm and simulator:

Attachment hterm_and_sim.zip not found

Last edit: 6 years 9 months ago by Marcin.

Please Log in or Create an account to join the conversation.

  • avra
  • Visitor
  • Visitor
6 years 9 months ago - 6 years 9 months ago #6492 by avra
Replied by avra on topic PascalScada Modbus RTU with Moxa problem

First is Modpoll connected do the Moxa DE-211 (RS-232, COM2) . Moxa is connectet to USB-RS-232 optoizolated and is connected to the simulator (RS-232, COM1).
Com2: baud 9600, data bits:8, parity: none, stopbits:1 ---- Modpoll
Com1: baud 9600, data bits:8, parity: none, stopbits:1 --- Simulator

It looks like you have virtual COM1 made by USB-RS232 convertor and virtual COM2 made by MOXA driver (it does show as serial com port but it is virtual driver tunneling MOXA communication through ethernet cable). This does not affect your problem.

The ioDriverError on LastSyncWrite shows when I put some Value on HMIEdi1 and send value (enter button on PC)

That doesn't show in MODBUS.TXT log from scada_plc_moxa.zip. Can you send log showing this error, together that small test PascalSCADA project causing it?

Well it seams you do not need another cable. Pascal SCADA properly sets PLC register 1 (modbus protocol level addr 0) to 870 getting good reply, and sends command to get content of that register, receiving 870 which is good. I can not find any error documented in logs from your 3 previous messages. It seams that PascalSCADA reads and writes well to/from PLC. Once again, you have to show me the error. You say when it happens but it doesn't show in your logs. This behavior is also in conflict with your first message, when you were complaining for a very different problem, when timeouts shown from log were pointing in a different direction. That made confusion and that's why I wanted to check few other things. Now it seams that PascalSCADA has a bug, but you need to document your findings very clear and without confusion. What exactly happens and at what moment when you want to manually send value to PLC? If you didn't already then provide logs where that problem is visible and small test project showing it. Is that the only bug you have found, or you have more to report? Repeat the procedure for each bug found. That will highly increase your chance for author fixing the bug. Also, project is open source so everyone can peek into it and try to fix if needed.
Last edit: 6 years 9 months ago by avra.

Please Log in or Create an account to join the conversation.

  • Marcin
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago - 6 years 9 months ago #6493 by Marcin
Replied by Marcin on topic PascalScada Modbus RTU with Moxa problem

avra wrote:

The ioDriverError on LastSyncWrite shows when I put some Value on HMIEdi1 and send value (enter button on PC)

That doesn't show in MODBUS.TXT log from scada_plc_moxa.zip. Can you send log showing this error, together that small test PascalSCADA project causing it?

When this error happend, MODBUS.TXT does't report it on log. This is the problem, because i can't see errors on the logs.

What exactly happens and at what moment when you want to manually send value to PLC?


Program in the HMIEdit shows always 0.
When i put some value in HMIEdit and send it, PLC get correctly value from HMIEdit, but HMIEdit in program shows 0. On HMIEdit should be the value entered earlier, but it's change to 0 - in PLC stay value recievied earlier.
In logs, you can see that everythings is ok, but i can't recieve any value from PLC through the MOXA virtual port.
I think that maybe something is with the MemReadFunction not right, but i can be wrong.
Through the virtual USB-RS232 everything is OK.

I tried to attach the program but I can't. It's too heavy I think :(

EDIT:

ok, i attach it here

File Attachment:

File Name: modbus_moxa.zip
File Size:557 KB



Once again, you have to show me the error. You say when it happens but it doesn't show in your logs.

Exactly, error shows on TIpropertygrid, but not on the logs. Logs doesn't generate this error - scada_plc_moxa.zip .

first message, when you were complaining for a very different problem, when timeouts shown from log were pointing in a different direction. That made confusion and that's why I wanted to check few other things.

This problem is resolved, I have to rise up the WriteReadDelay from 20 to 200.

Repeat the procedure for each bug found.

There is only one bug i found - I can't receiving the data from PLC through MOXA virtual com, and only trough MOXA. The rest of virtual or real com I can receive the data.
Attachments:
Last edit: 6 years 9 months ago by Marcin.

Please Log in or Create an account to join the conversation.

  • Fabio Luis Girardi
  • Fabio Luis Girardi's Avatar
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago - 6 years 9 months ago #6495 by Fabio Luis Girardi
Replied by Fabio Luis Girardi on topic PascalScada Modbus RTU with Moxa problem
Do you have increased the Timeout property on SerialPortDriver?

Another strange behavior is the ioNone on write. I'm studing the code, and, if I'm not wrong, I found a bug,
Last edit: 6 years 9 months ago by Fabio Luis Girardi.

Please Log in or Create an account to join the conversation.

  • Marcin
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago - 6 years 9 months ago #6496 by Marcin
Replied by Marcin on topic PascalScada Modbus RTU with Moxa problem
Yes on SerialPortDriver.

EDIT:

I set 100
Last edit: 6 years 9 months ago by Marcin.

Please Log in or Create an account to join the conversation.

  • Fabio Luis Girardi
  • Fabio Luis Girardi's Avatar
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago #6497 by Fabio Luis Girardi
Replied by Fabio Luis Girardi on topic PascalScada Modbus RTU with Moxa problem
I have a suspect: Your serial port does caching of write requests, so WriteFile completes without wait the operation ends. Associated with this bug, everything goes wrong.

Can you use the development version of PascalSCADA? Or in the best case, can you edit the file serialport?
The following user(s) said Thank You: avra, Marcin

Please Log in or Create an account to join the conversation.

  • Marcin
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago #6498 by Marcin
Replied by Marcin on topic PascalScada Modbus RTU with Moxa problem
Yes, I can edit file serialport. What i have to do with it?

Please Log in or Create an account to join the conversation.

  • Fabio Luis Girardi
  • Fabio Luis Girardi's Avatar
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago #6499 by Fabio Luis Girardi
Replied by Fabio Luis Girardi on topic PascalScada Modbus RTU with Moxa problem
Go to line 497 and 498, they should be like this:
  end;
{$IFEND}

replace these lines by:
  end else begin
    Packet^.WriteIOResult := iorOK;
  end;
{$IFEND}

Recompile everything and test.
The following user(s) said Thank You: Marcin

Please Log in or Create an account to join the conversation.

  • Marcin
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago #6500 by Marcin
Replied by Marcin on topic PascalScada Modbus RTU with Moxa problem
:laugh: :woohoo:
You are reallllly Gooood :silly:

Working now!!!!!!!!!!!!!!
logs:

File Attachment:

File Name: modbus_2014-12-08.txt
File Size:7 KB


Many Thanks!!!
The following user(s) said Thank You: universe

Please Log in or Create an account to join the conversation.

  • Fabio Luis Girardi
  • Fabio Luis Girardi's Avatar
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago #6501 by Fabio Luis Girardi
Replied by Fabio Luis Girardi on topic PascalScada Modbus RTU with Moxa problem
I'll commit the fix. Thanks!!
The following user(s) said Thank You: avra, universe, Marcin

Please Log in or Create an account to join the conversation.

  • Fabio Luis Girardi
  • Fabio Luis Girardi's Avatar
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago #6502 by Fabio Luis Girardi
Replied by Fabio Luis Girardi on topic PascalScada Modbus RTU with Moxa problem
@sternas update your copy of PascalSCADA for CodeTyphon. We found a bug! :D

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
6 years 9 months ago #6503 by Sternas Stefanos
Replied by Sternas Stefanos on topic PascalScada Modbus RTU with Moxa problem
Ok guys
I love this step.... :)

PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

  • Fabio Luis Girardi
  • Fabio Luis Girardi's Avatar
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago #6504 by Fabio Luis Girardi
Replied by Fabio Luis Girardi on topic PascalScada Modbus RTU with Moxa problem
@swicio1 how are your tests today?

Please Log in or Create an account to join the conversation.

  • Marcin
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago #6505 by Marcin
Replied by Marcin on topic PascalScada Modbus RTU with Moxa problem
Hej papelhigienico.
For now it's working very good, also with the usb-rs232. Even if I back to the default property WriteReadDelay and Timeout on SerialPort it's working good.
I wish that, I had not written about this problem earlier. I was waiting for an update in the hope that in the newer Version will work properly.
Thanks again, good job!
Regards

Please Log in or Create an account to join the conversation.

Moderators: Curt