Tietokoneiden näyttöjä, joissa näkyy kuvaa automaatiolaboratorion laitteistosta. Monitoreiden takana näkyy sama laitteisto kuin kuvissa.

timohei.net / My Courses / My Courses / Production Automation Project / Siemens S7 How-to / Sequence Programming /
SCL-toteutus

Here is an example of a sequence application that

  1. Opens valve V-102 and waits for its open limit
  2. Starts a 6 second delay and waits for the delay termination
  3. Closes the valve and waits for its closed limit
  4. Starts a 10 second delay and waits for the delay termination. Then the sequence jumps to step 1.

The sequence is started by setting an Int type variable Step to zero and then setting a Bool type variable SeqRun to one.

The example is shown as a screen shot from TIA Portal and in text format to be copied into your project.

The sequence shown here is implemented in a Cyclic interrupt block (OB31) which is executed every 100 ms. The sequence could also be implemented in an OB1 block but Cyclic interrupt implementation puts considerably less load on the CPU. A sequence application is typically used in a process where outputs change only now and then and execution speed is not critical. If execution speed is critical it is advisable to implement the application in some other way than using sequence application.

(* Sequence Application in SCL *)

IF "SeqRun" THEN
    CASE "Step" OF
	
        0: (* If sequence is started but still in step 0
                initialize to step 1 *)
            "Step" := 1;
            "Timer1In" := FALSE; (* Reset timer inputs *)
            "Timer2In" := FALSE;
			
        1: (* Step 1 ACTIONS - Open V-102
                               Set LIC-100 to automatic
                               Reset S2TimerIn *)
            "V-102" := TRUE;
            "LIC-100.ma" := FALSE;
            IF "V-102.o" THEN (* Step 1 CONDITIONS -
                                 Only check that V-102
                                 has opened *)
                "Step" := "Step" + 1; (* Go to next step *)
            END_IF;
			
        2: (* Step 2 ACTIONS - Start 6 second timer *)
            "IEC_Timer_0_DB".TON(IN := "Timer1In",
                                 PT := T#6s,
                                 Q => "Timer1Out");
            "Timer1In" := TRUE; (* Activate timer *)
            IF "Timer1Out" THEN (* Step 2 CONDITIONS -
                                    Timer ready *)
                "Step" := "Step" + 1;
            END_IF;
			
        3:  (* Step 3 ACTIONS - Close V-102
                                Reset S2Timer *)
            "V-102" := FALSE;
            "Timer1In" := FALSE;
            IF "V-102.c" THEN (* Step 3 CONDITIONS -
                                    V-102 closed *)
                "Step" := "Step" + 1; (* Go to next step *)
            END_IF;
			
        4: (* Step 2 ACTIONS - Start 6 second timer *)
            "IEC_Timer_1_DB".TON(IN := "Timer2In",
                                 PT := T#10s,
                                 Q => "Timer2Out");
            "Timer2In" := TRUE; (* Activate timer *)
            IF "Timer2Out" THEN (* Step 2 CONDITIONS -
                                    Timer ready *)
                "Step" := 1; (* Jump to step 1 *)
            END_IF;
			
    END_CASE;
END_IF;
Updated 23.11.2018

<<  Previous Page
(9) Conditions
Sivu 10/10First Page >>
(1) Sequence Programming
© Timo Heikkinen | timo piste heikkinen at oamk piste fi