bkowal

Hello and welcome everyone!

I’d like to know what are the possibilities of using OpenPLC platform with no hardware IO, just with simulated ones. I need that because I have to perform a simulation of a complex system (HVAC installation – to be exact) with usage of SoftPLC.

I’ve already tried to use the Monitoring tool at localhost:8080 but forcing values with that it doesn’t work.
I’ve also tried to force input values with usage of HMI interface, designed in mySCADA software. Connection between this software and OpenPLC is established but again – i cannot force inputs.

I will be grateful for any advice.

Quote 0 0
thiagoralves
Have you tried the built in simulator on OpenPLC Editor? Check https://www.openplcproject.com/reference-your-first-project towards the end of it. 
Quote 0 0
bkowal

Yes, I have. This tool works great but it's not sufficient for my task. I need to create a complex program, with many variables. Moreover, the program should communicate with lesser ones, which should work on their own and also provide data for, let's say, "Main Program". 

Do you have any suggestions keeping in mind foregoing assumptions?

Quote 0 0
thiagoralves
You can temporarily locate the inputs you want to force in %QX and %QW locations. Those locations are writable via Modbus. Check http://www.openplcproject.com/scada

Once you finish your tests, you can move back all the inputs to %IX and %IW and it should work the same on the real hardware 
Quote 0 0
bkowal

Indeed, your's solution works perfectly. Doing the way you said, I can force inputs and monitor outputs via mySCADA software. THANK YOU!

My next concern is how to read/ write data from one OpenPLC runtime to another. I set a Modbus TCP connection between 2 OpenPLC runtimes, which are run on 2 virtual machines - it's working fine, because according to the logs they can see each other. But now I don't know how to read data from Slave device in Master device. Could you please help me?

 

Quote 0 0
thiagoralves
On the master device you go to the slave devices tab and add a generic modbus tcp device. Fill out all the fields appropriately according to the slave device you want to read. Then, save the device and you will see the addresses on the table, i.e. all coils of the slave device will appear as %QX100 onward on the master device. Input registers will show as %IW100, etc...
Quote 0 0
bkowal

It's been a while, but I've finally tried to make a connectrion and encountered a problem. I'm trying to establish Modbud TCP connection first on the example of simple Master and Slave programs. That's what I've done:

1) On 1st out of 2 virtual machines I wrote a simple "slave-program" (attachment: slaveProgram.png)

slaveProgram.png 

2) On the another VM I wrote "master-program" (attachment: masterProgram.png), which should receive data from the slave register %QX0.0 and transcribe it to the master register %QX100.0

masterProgram.png 

3) I added a generic Modbus TCP device on the master device (attachment: configuration.png)

configuration.png 

Although the devices can see each each (as confirmed by the logs - attachment: logs.png), the slave variables don't affect on the master variable exIN (attachement: HMI.png). If the communication was correct, the exIN variable on the visualisation via ScadaBR should be equal to "1" and therefore also exOUT should be equal to "1".

logs.png HMI.png 

I have no idea what I'm doing wrong. Could you please help me?

 

 

Quote 0 0
thiagoralves
Ah, no, your concept is a little wrong with that one. You see, with the master-slave configuration, you cannot “read” QX locations on the master. By definition, you only read IX (and IW of course) and write to QX and QW. So if you want to read an input from the slave device, you must place it on the IX location, there is no other way.

The problem is, you cannot force (or write to) an input without a driver. I see that you’re trying to run everything on Linux, so there is just the blank driver, right... You can try to just 
locate your out variable at %IX0.0 and see what happens. Just also keep in mind that your in variable at %QX0.1 is being controlled by the master as well, because your modbus configuration is reading/writing to the first 8 locations

If that doesn’t work you’ll have to write a quick driver on the slave just to be able to force inputs.
Quote 0 0