jagspaul
I run Open PLC on raspberry Pi.
It is running fine. Now I need to debug my PLC ladder logic.

Please help me to How to debug online ladder logic and forcing variable and I/O from open PLC editor?

regards
/jags
Quote 0 0
thiagoralves
It's not possible to do it with the current version of OpenPLC. I'm planning to add this in the future. However, it is possible to check the state of variables using Modbus. Check http://www.openplcproject.com/scada for more information
Quote 0 0
jagspaul
Using Modbus is fine for checking variable state. But forcing variable is not possible.

Could you give any expected date of release of new version of OpenPLC which will support  debuging with online ladder logic and forcing variable and I/O from open PLC editor.

regards
/jags
Quote 0 0
thiagoralves
You can't force inputs, but you can force coils (outputs). Therefore you can use contacts associated with coils as inputs in your program to be able to force it in Modbus.

Currently I don't have any specific plans to implement online debugging. There are some other stuff that I want to make first. So, it may take a while until there is a version with online debugging in it
Quote 1 0
dozm
It's not possible to do it with the current version of OpenPLC. I'm planning to add this in the future. However, it is possible to check the state of variables using Modbus. Check http://www.openplcproject.com/scada for more information


Hello,
could you recommend a good free program to do that?
Quote 0 0
thiagoralves
Radzio Modbus =>  http://en.radzio.dxp.pl/modbus-master-simulator/
Quote 0 0
macshout
As of the current time (2019-05-03) the OpenPLC editor intro page indicates that contacts can be forced in the simulator, but I have not been able to do that with OpenPLC Editor 1.0 on Linux U16.04. https://www.openplcproject.com/reference-your-first-project : You can force a contact or coil to be activated or deactivated by right-clicking on it and selecting either Force True or Force False.

My next idea was to set an Initial Value for a variable, so using the Hello World example I set the initial Value of BOOL my_button to True, "True", true, "true", 1, but in all cases the ST generation is invalid. Is there documentation on how to set Initial Values?

/home/rappleto/Documents/wcary3tx/stuff/ElectronicsAndSoftware/PLC/Hello World/build/plc.st:96-5..97-27: error: unexpected token after 'VAR' in variable(s) declaration.
In section: PROGRAM Hello_World
0096: VAR
0097: my_button : BOOL lamp : BOOL;

If I manually correct it in plc.st then I can compile it successfully with iec2c, but that is hardly convenient nor easy to run in the simulator.

The (minimally) modified Hello World plc.xml is attached for reference.

Thanks!
Quote 0 0
thiagoralves
You cannot initialize located variables in the input range. It doesn’t make sense to initialize them since they will be getting their value from the physical input. The best way is to actually use the built-in simulator to test the program. What is the problem you are facing? Did you follow the instructions on the website precisely? Try carefully following the steps again.
Quote 0 0
jagspaul
No, you are wrong. It really make sense to force input logically while debugging a field process as because sometime it is not possible to force input physically.
However all modern PLC support  force input logically while debugging.

In this regards you are requested please come out of your thinking and try to implement what i asked, it will be really helpful to many PLC users.

Thanks & regards
jags 
Quote 0 0
thiagoralves
Forcing inputs is different than initializing variables. This is what you tried to do when you put “true” on initial value. As I said, this doesn’t make sense for input located variables.

However, what you “asked” for, which is debugging and forcing variables in run time is already implemented on the simulator. You just need to follow the instructions on the tutorial and learn how to use the software properly. 
Quote 0 0
macshout
Okay, after too many hours on this, I think I know what you are saying. It seems that if a location is specified for a contact: %IX0.0 or whatever,  then you cannot set an Initial Value as it will fail to even compile, but if you do not specify a location you can force an initial value.

Either way though the value can be forced in the simulator if you click on the glasses to get the contact state displayed in the Debugger pane, then you can right-click on that contact's value in the debugger pane to change its value.

According to the directions the wires are supposed to indicate whether they are live by turning green. This is not evident in Linux, and Pyro was unable to attach to the simulator when I tried this on Windows.

Attached is a snap of it running on Linux.

Cheers,
m

Quote 0 0
thiagoralves
Man, it can't be that hard. The instructions are pretty easy to follow. You are clicking on the glasses for the individual variables to attach them on the panel. This is NOT what the instructions say to open the simulator. To see the green wires on the simulator you need to click on the glasses for the instance, as shown on the instructions:
Screen Shot 2019-05-06 at 9.46.15 AM.png 
When you click on that button a new window will open showing the simulator with the green wires, etc. Then you can right click on a contact or coil to force it true or false.

It should work the same way on Windows as well. What is the error you are getting on Windows?
Quote 0 0
macshout
I do apologise. It is a lot of information to try to assimilate all at once. Yes, the glasses on the instance now works like a champ in Linux. Easy when you know how.

When I first unzipped the Windows version I thought Program Files (x86) would be a reasonable place for program files, but there are permissions issues there, and it wouldn't run as administrator so I moved the whole directory structure to somewhere under \users, and that seemed to work better. I was at least able to run 'python -m Pyro.configuration' and get sane output. 

Here is the output from the Windows attempt:

Start build in C:\Users\rappleto\Documents\OpenPLC\testWindows\build
Generating SoftPLC IEC-61131 ST/IL/SFC code...
Compiling IEC Program into C code...
Extracting Located Variables...
C code generated successfully.
PLC :
   [CC]  plc_main.c -> plc_main.o
   [CC]  plc_debugger.c -> plc_debugger.o
py_ext :
   [CC]  py_ext.c -> py_ext.o
PLC :
   [CC]  Config0.c -> Config0.o
   [CC]  Res0.c -> Res0.o
Linking :
   [CC]  plc_main.o plc_debugger.o py_ext.o Config0.o Res0.o -> testWindows.dll
Successfully built.
PYRO connecting to URI : PYROLOC://127.0.0.1:61730
Exception while connecting to 'LOCAL://': connection failed
Connection failed to LOCAL://!

I ended up with several instances of the black contact simulator icon (Beremiz Service) showing up in the taskbar, so tried the usual Windows reboot fix, but to no avail. It's an old Lenovo laptop with AMD running Windows 7 so I'm not too surprised.

Thanks for your remarkable patience.
Quote 0 0
thiagoralves
This is weird... Are you starting the program from the shortcut? Or are you starting it manually from the command prompt? The editor should spawn beremiz service automatically when you start the simulator. It looks like it is not being able to spawn it or maybe there is a firewall rule blocking it to communicate with the beremiz service. Try disabling your windows firewall just for a minute while you have the editor running and check if that works
Quote 0 0