This STL code on Festo is acting VERY odd

jimbojohn

Member
Join Date
Mar 2015
Location
Adelaide
Posts
7
Hi everyone;),

I was writing some STL code and then I got stuck and even though I have read Festo’s FCC60 manual and I cannot logically account for what the PLC is doing and why it is doing it.
So as you can see, I am using a stepwise STL. Based on my understanding of the STL format, the PLC should stay on a current step if the conditions of that step have not been satisfied and therefore it will not be fully executed. Moreover, my teacher told me that as long as the condition section of a step remains true, the executive part of that step will keep executing. For example on “Step 2”, as long as “level2” remains “ON” the timer “T1” should keep restarting with its preset value of “10s”.
I would really appreciate it if you guys could confirm this.


But the real issue is quite strange. So what happens is that the STL reaches “Step 3” and does not go into “Step 3”. Meanwhile, Timer 1 “T1” keeps finishing 10 seconds over and over again. So when 10 seconds finish another 10 seconds start.
I thought this is because of keeping “level2” “ON”, so I turned it “OFF”, but the programed went back to “Step 1” and stopped in the beginning of “Step 2”, which makes sense. Wait for it, it gets funnier. I ran the program once more and got stuck in the same place again. However, this time I turned “level3” “ON” and all of the sudden the program finished “Step 3”, BUT now it got stuck at the beginning of “Step 4”. I cannot see why all of this is happening. Why I got stuck before “Step 3” before? Technically, “level3” should have nothing to do with execution of “Step 3”, so why does it get stuck at the beginning of “Step 3”. Is the PLC actually seeing ahead two steps and then deciding to move on or not? And finally, when the program eventually finishes “Step 3” after turning “level3” “ON”, why does it get stuck in the beginning of “Step 4” and does not go through it?:unsure:
Here is the code:

STL.jpg
STL.jpg
 
a transition (go to a next step is only done when the step is active AND the the IF is TRUE.
however a timer is somewhat strange you can not test a timer in step 3 as this step is not active yet, and when you put it to ON step 2 is inactive thus the transition is not done.
make a variable of the output of the timer, this is global so can be tested.
 
Thanks for your reply!!;)
a transition (go to a next step is only done when the step is active AND the the IF is TRUE.
So, just to make sure I understand this correctly, when "Step 2" is active and "level2" switch is "ON" and as long as it remains "ON", the PLC can not move to "Step 3". Right?:unsure:

however a timer is somewhat strange you can not test a timer in step 3 as this step is not active yet, and when you put it to ON step 2 is inactive thus the transition is not done.
make a variable of the output of the timer, this is global so can be tested.
Using the "Online Display" function of Festo I can see that the 10s is loaded into Timer1 and I can see that it counts down from 10 and when it gets to zero, instead of going to "Step 3"(which it should as the first line of "Step 3" is meant to take place when timer reaches zero, i.e. "OFF"), it resets back to 10s again and starts counting down again. I will give the global variable a go, but the fact that the timer keeps resetting and "Step 3" never happens, strongly indicates that the timer bit "T1" never goes "OFF".
 
Hi everyone;),

I was writing some STL code and then I got stuck and even though I have read Festo’s FCC60 manual and I cannot logically account for what the PLC is doing and why it is doing it.
So as you can see, I am using a stepwise STL. Based on my understanding of the STL format, the PLC should stay on a current step if the conditions of that step have not been satisfied and therefore it will not be fully executed. Moreover, my teacher told me that as long as the condition section of a step remains true, the executive part of that step will keep executing. For example on “Step 2”, as long as “level2” remains “ON” the timer “T1” should keep restarting with its preset value of “10s”.
I would really appreciate it if you guys could confirm this.
No, step will change when conditions are true. That means also that nothing gets done after "then" until conditions are true. Timer T1 will start only when conditions for it are true. -> transition occurs when timer is started.

FST timers are "true" when they are running.


But the real issue is quite strange. So what happens is that the STL reaches “Step 3” and does not go into “Step 3”. Meanwhile, Timer 1 “T1” keeps finishing 10 seconds over and over again. So when 10 seconds finish another 10 seconds start.
I thought this is because of keeping “level2” “ON”, so I turned it “OFF”, but the programed went back to “Step 1” and stopped in the beginning of “Step 2”, which makes sense. Wait for it, it gets funnier. I ran the program once more and got stuck in the same place again. However, this time I turned “level3” “ON” and all of the sudden the program finished “Step 3”, BUT now it got stuck at the beginning of “Step 4”. I cannot see why all of this is happening. Why I got stuck before “Step 3” before? Technically, “level3” should have nothing to do with execution of “Step 3”, so why does it get stuck at the beginning of “Step 3”. Is the PLC actually seeing ahead two steps and then deciding to move on or not? And finally, when the program eventually finishes “Step 3” after turning “level3” “ON”, why does it get stuck in the beginning of “Step 4” and does not go through it?:unsure:
Here is the code:

STL.jpg
STL.jpg
 
Last edited:
No, step will change when conditions are true. That means also that nothing gets done after "then" until conditions are true. Timer T1 will start only when conditions for it are true. -> transition occurs when timer is started.

FST timers are "true" when they are running.

Thanks for your reply;). That is know clear to me. However, I have come to think that even though the program is executed sequentially, it is perhaps not checked or compiled sequentially. In other words, if the program really was sequential, whatever is taking place in "Step 4" must not concern the program which is stuck at the beginning of "Step 3", unless, it can actually see "Step 4" before even starting "Step 3".
As I mentioned before, whenever I turned "level3" "ON" at "Step 4", the third step would happily be executed and it would not get stuck there. Another thing which prevented the program from getting stuck at the beginning of "Step 3" was introducing a "RESET T1" at the end of "Step 3". This would stop timer one from keep repeating itself as I had mentioned in my first post.
Nonetheless, putting a "RESET" at the third step must not be needed, logically.
I also have another theory, but it involves the program seeing ahead of what it is sequentially executing. I believe that because I am "SETTING valve_b" at "Step 3" and "RESETTING valve_b" at the "STEP 4", while "level3" is still "OFF", the program looks at this as a contradiction and does not even start "Step 3".
Although this sounds illogical to me, this is the only thing that comes to my mind. What I expected it to do was to go through "Step 3" and "SET valve_b" and then go through "Step 4" as "level3" is "OFF" and then "RESET valve_b".
NOTE that "level3" has been "Negated".

Many thanks in advance
 

Similar Topics

Hey everyone, In the middle of deciphering STL code in S7 plc and I'm confused. I interpret the following code to be load the register "#Step"...
Replies
11
Views
2,069
Hi, Anyone know why this network is not longer shown in LAD format but only in STL ? O "RB 20878".EinfV O "RB 20878".EinfR...
Replies
11
Views
2,534
Hi people, could any one tell me if i have converted this STL code correctly A M 30.7 O M 31.0 A M 105.7...
Replies
3
Views
1,470
What does the following code meas ? = Q i 0.10 thanks
Replies
3
Views
2,031
IS it possible to write this on a better way: L #db_Num2 L 121 ==I JNB _02 CALL "CONT_C" , "DB_reg_igla1"...
Replies
3
Views
2,628
Back
Top Bottom