SCL command to Set output then make it off after some time

SIMATIC S7-200/300/400, Step7, PCS7, CFC, SFC, PDM, PLCSIM,
SCL, Graph, SPS-VISU S5/S7, IBHsoftec, LOGO ...
Post Reply
ggg315
Posts: 26
Joined: Thu May 28, 2015 6:29 am

SCL command to Set output then make it off after some time

Post by ggg315 » Wed Oct 23, 2019 11:40 am

How to make it happen In SCL


Code: Select all

IF (#CmdStart = 1) AND (#CmdStop = 0) AND (#Fault = 0) AND (#LockAct = 0)
       THEN
          #Start := 1;
          #Stop := 0;

How can I make this output be active for SOME TIME and then Vanish

if i can adjust this time it will be even better that i can do be defining a static value and using that in code

So it is to mimic the function of a pushbutton, this output will activate a relay and the relay contacts will close and open after some time same like a pushbutton

So I Need output and that should stop after x time

I dont want to use timer . this will be inside a 100ms OB

MEFinc
Posts: 51
Joined: Thu Dec 08, 2011 11:23 am

Re: SCL command to Set output then make it off after some time

Post by MEFinc » Thu Oct 24, 2019 6:35 am

Why you don't want to use timers? It's the easiest way to solve your task.

Dfcz
Posts: 875
Joined: Tue Dec 26, 2006 5:21 am
Location: Russia

Re: SCL command to Set output then make it off after some time

Post by Dfcz » Thu Oct 24, 2019 11:10 am

Use the "set" and "reset".
The start command is set according to the conditions and the start command is reset according to the conditions that the start command is already seted.
Therefore, the start command will be seted 100 MS.

ggg315
Posts: 26
Joined: Thu May 28, 2015 6:29 am

Re: SCL command to Set output then make it off after some time

Post by ggg315 » Thu Oct 24, 2019 11:51 am

MEFinc wrote:
Thu Oct 24, 2019 6:35 am
Why you don't want to use timers? It's the easiest way to solve your task.
Because I think Timer can act in unpredictable manner.
https://www.dmcinfo.com/latest-thinking ... 200-timers

Guille
Posts: 32
Joined: Fri Oct 03, 2008 2:17 am
Location: America

Re: SCL command to Set output then make it off after some time

Post by Guille » Thu Oct 24, 2019 1:21 pm

You can use the variable "OB1_PREV_CYCLE" and accumulate it on some static variable inside the FC and compare the accum. value with the time you want to reach (time in mili seconds)
You will need to add a function parameter on your FC where you can pass the OB1_PREV_CYCLE variable in the FC call

here you have a rudimentary example where you can see the accumulated time value (on Current_value)

https://support.industry.siemens.com/tf ... ageSize=10

you must analyze the overflow case to avoid problems

regards

Post Reply