hughjack
(OpenPLC is great and I use it for 2 PLC courses I reach.)
 
I have a problem with the ladder logic execution. It does not seem to be executing left-to-right, top-to-bottom. It seems to be executing the logic based on the sequence of the ladder logic coil creation. In the example below STA EOR STB should be on. As shown, none of the inputs have been forced on.
Screenshot 2024-11-05 at 1.17.23 PM.png
When A is forced on it executes rung 2 first, then rung 1 after. As a result STB never turns on. The Coil-Reset STA in line 2 runs first, and it was created first during editing.
Screenshot 2024-11-05 at 1.17.34 PM.png
I can fix the problem by deleting the outputs of the first 2 rungs, STB-S and STA-R, and then recreate the coils in the correct sequence.
Reply 0 0
thiagoralves
This is interesting. If you export the program for OpenPLC Runtime (orange down arrow on toolbar), are they different depending on the order you create the elements? The exported program is a structured text equivalent of your ladder diagram
Reply 0 0
Grz
|-------| |-‐----| |--------(S)‐-----|
        STA     A   |   STB     |
                          |----(R)------|
                                STA
 
|-------| |-‐----| |--------(S)‐-----|
       STB     B     |   STA   |
                            |----(R)----|
                                 STB
 
Hello Hugjack,
You can try this....
Best regard
Pierre
Reply 0 0
fg71
Here is example of 4 step sequencing ladder diagram, I have include TON with PT of 1 sec to demonstrate it.
I also use reset coils in a separate rung
 
  1. activate_state and start_btn = True (simulator)
 
[203128%2F9058505%2Fmceclip0]
Reply 0 0
thiagoralves
The problem is that if the editor is taking in consideration the order of creation instead of the position of elements, that’s indeed a bug. That’s why I wanted to see the compiled code
Reply 0 0
hughjack
|-------| |-‐----| |--------(S)‐-----|
        STA     A   |   STB     |
                          |----(R)------|
                                STA
 
|-------| |-‐----| |--------(S)‐-----|
       STB     B     |   STA   |
                            |----(R)----|
                                 STB
 
Hello Hugjack,
You can try this....
Best regard
Pierre
 
I started with that, and that is when I found the problem. I broke it into separate lines to reduce possible problems.
Reply 0 0
thiagoralves
I can confirm this. Created a program similar to the first post, but wrote second rung first and then finished the first rung:
Screenshot 2024-11-06 at 10.57.35 AM.png
 
The compiled code for this ladder becomes:
PROGRAM Blink
  VAR
    STB : BOOL;
    STA : BOOL := 1;
    A : BOOL;
  END_VAR

  IF A AND STA THEN
    STA := FALSE; (*reset*)
  END_IF;
  IF A AND STA THEN
    STB := TRUE; (*set*)
  END_IF;
END_PROGRAM
As you can see, the compiler is placing the condition for the second rung before the condition for the first rung.
Reply 0 0
thiagoralves
After taking a quick look at the XML code for both projects (rung created before and after), it seems that the compiler is not taking in consideration the position of the elements, but rather their place on the XML file itself:
Screenshot 2024-11-06 at 11.05.58 AM.png
 
I can also confirm that this bug does not exist on the next major version of the OpenPLC Editor that is in the works to be released by the end of the year.
Reply 1 0
hughjack
 
Thanks, I appreciate the quick resolution.
Reply 0 0
Grz
Après avoir jeté un rapide coup d'œil au code XML des deux projets (rung créé avant et après), il semble que le compilateur ne prenne pas en compte la position des éléments, mais plutôt leur place dans le fichier XML lui-même :
Capture d'écran 06/11/2024 à 11/05/58.png
 
Je peux également confirmer que ce problème a été corrigé sur la prochaine version majeure de l'éditeur OpenPLC qui est en préparation et qui sera publiée d'ici la fin de l'année.
Hello Thiago and with sfc or ld ... what happen please ....
 V
  |
|0|
  |
  - STA.A
  |
|1| --- STB
  |
  - STB.B
  |
|2| ---STA
  |
  - STA.A
  |
 V
 
LD STA
AND A
S STB
LD STB
AND B
S STA
Reply 0 0
thiagoralves
I haven't tested this particular problem on SFC on the current editor. Given the state nature of SFC I think you will be fine. For the new Editor that is coming, I already confirmed that the bug is not present there (it uses a different XML parser than current editor). The new editor unfortunately won't support SFC on this first release. It will take some time for SFC to be added to it.
Reply 1 0
Grz
Je n'ai pas testé ce problème particulier sur SFC sur l'éditeur actuel. Compte tenu de la nature étatique du SFC, je pense que tout ira bien. Pour le nouvel éditeur à venir, j'ai déjà confirmé que le bug n'y est pas présent (il utilise un analyseur XML différent de celui de l'éditeur actuel). Le nouvel éditeur ne prendra malheureusement pas en charge SFC sur cette première version. Il faudra un certain temps pour y ajouter SFC.
Thanks Thiago....
Reply 0 0
Write a reply...
Reply