Sample Solution Exercise PLC Programmingplc

download Sample Solution Exercise PLC Programmingplc

of 13

Transcript of Sample Solution Exercise PLC Programmingplc

  • 7/29/2019 Sample Solution Exercise PLC Programmingplc

    1/13

    Automation Systems

    Discrete Event Control Systems and

    Networked Automation Systems

    sample solution to2nd exersise

  • 7/29/2019 Sample Solution Exercise PLC Programmingplc

    2/13

    AS

    2WS 10/11 Georg Frey

    Description about the Plant

    Industrial gate

  • 7/29/2019 Sample Solution Exercise PLC Programmingplc

    3/13

    AS

    3WS 10/11 Georg Frey

    Informal Specification

    The industrial gate is driven by 2 contactors, the gate is driven upwardby SchLM1 and is driven downward by SchRM1.

    To determine the position, two sensors are available. Oben_S30detects the upper limit position and Unten_S10 senses the lower limitposition.

    There are 2 Buttons available for Human-Machine-Interaction. Bypressing the TasterAUF button, the gate is driven upward (open). Bypressing the TasterAB button, the gate is driven downward (close). Oneshould be aware, the gate should react on the level changing of the

    button, i.e. the button need not to be pressed during the opening orclosing of the gate. The gate is not designed to be half-opened.

    To avoid damage to human or material, a light barrier (OptSensor) isprovided. If the light barrier senses an object, the gate should be driven

    upward until it reaches the upper limit position. The gate stops immediately and remains its actual position by pressing

    the Not-Aus button (Not_Aus). It can not operate until a Reset is takenplace.

  • 7/29/2019 Sample Solution Exercise PLC Programmingplc

    4/13

    AS

    4WS 10/11 Georg Frey

    Extended informal specification

    Additionally to the simple specification, the gate can be controlled by a

    remote controller.

    The remote controller has only one button, it should be considered as abiased switch.

    The gate should react as following by pressing the button on theremote controller: It the gate is moving and is not completely opened or closed, then it should move to

    the opposite direction.

    If the gate is complete closed, it should be opened.

    If the gate is complete opened, it should be closed. If the light barrier senses an object, the remote controller has no more function on

    the gate.

  • 7/29/2019 Sample Solution Exercise PLC Programmingplc

    5/13

    AS

    5WS 10/11 Georg Frey

    Applied Signals

    Table of input signals

    Table of output signals

    Signal-Name Meaning of logic 0 Meaning of logic 1

    TasterAUF Button is not pressed Button is pressed

    TasterAB Button is not pressed Button is pressed

    Not_Aus Button is pressed Button is not pressedFernSt Button is not pressed Button is pressed

    Unten_S10 Gate is complete closed Gate is not complete closed

    Oben_S30 Gate is complete open Gate is not complete open

    OptSensor Light beam is obstructed Light beam is not obstructed

    Signal-Name Meaning of logic 0 Meaning of logic 1SchLM1 Motor does not rotates counter-

    clockwiseMotor rotates counter-clockwise

    (gate moves upward)

    SchRM1 Motor does not rotates clockwise Motor rotates clockwise (gate movesdownward)

  • 7/29/2019 Sample Solution Exercise PLC Programmingplc

    6/13

    AS

    6WS 10/11 Georg Frey

    Task

    1. Please design a control for the simple specification (without remote

    controller)

    2. Convert your control algorithm to IL

    3. Think about test cases to validate your control algorithm. (white boxtest)

    4. Take the remote controller into consideration, add its function to yoursolution.

    5. Convert your control algorithm to IL6. Think about test cases to validate your control algorithm. (white box

    test)

  • 7/29/2019 Sample Solution Exercise PLC Programmingplc

    7/13

    AS

    7WS 10/11 Georg Frey

    Task 1 (Informal Controller Design)

    Calculation of Auxiliary Variables:

    If !Not_Aus Then EmergencyStopActivated=1

    If TasterAUF Then Direction=1

    If TasterAB Then Direction=0

    Calculation of Outputs

    If ((Direction | !OptSensor) & Oben_S30 & !EmergencyStopActivated)Then SchLM1=1

    Else SchLM1=0

    If (!Direction & OptSensor & Unten_S10 & !EmergencyStopActivated)Then SchRM1=1

    Else SchRM1=0

  • 7/29/2019 Sample Solution Exercise PLC Programmingplc

    8/13

    AS

    8WS 10/11 Georg Frey

    Task 2 (Implementation of Informal Design)

    (* Check if Emergency-Stop is pressed *)

    LDN Not_AusS EmergencyStopActivated

    (* Check user wants gate to be opened *)LD TasterAUFS Direction

    (* check if user wants gate to be closed *)LD TasterABR Direction

    (* set motor for opening gate if condition is fullfilled *)LD TRUE

    AND ( DirectionORN OptSensor)AND Oben_S30ANDN EmergencyStopActivatedST SchLM1

    (* set motor for closing gate if condition is fullfilled *)LDN DirectionAND OptSensorAND Unten_S10ANDN EmergencyStopActivated

    ST SchRM1

  • 7/29/2019 Sample Solution Exercise PLC Programmingplc

    9/13

    AS

    9WS 10/11 Georg Frey

    Task 4 (Informal Controller Design with Remote Control)

    Calculation of Auxiliary Variables:

    If !Not_Aus Then EmergencyStopActivated=1

    If TasterAUF Then Direction=1

    If TasterAB Then Direction=0

    If FernSt & !FernStOld & Direction Then Direction = 0Else If FernSt & !FernStOld & !Direction Then Direction = 1

    FernStOld=FernSt

    Calculation of Outputs

    If ((Direction | !OptSensor) & Oben_S30 & !EmergencyStopActivated) ThenSchLM1=1

    Else SchLM1=0

    If (!Direction & OptSensor & Unten_S10 & !EmergencyStopActivated) ThenSchRM1=1

    Else SchRM1=0

  • 7/29/2019 Sample Solution Exercise PLC Programmingplc

    10/13

    AS

    10WS 10/11 Georg Frey

    Task 5 (Implementation of Informal Design with Remote Control)

    (* Check if Emergency-Stop is pressed *)LDN Not_AusS EmergencyStopActivated

    (* Check user wants gate to be opened *)LD TasterAUFS Direction

    (* check if user wants gate to be closed *)LD TasterABR Direction

    (* check if remote control butto was pressed *)LD FernSt

    ANDN FernStOldAND DirectionR DirectionJMPC Continue

    LD FernSt

    ANDN FernStOldANDN DirectionS Direction

    Continue: (* store value for auxiliary variable to checkif remote control button is pressed and released *)LD FernSt

    ST FernStOld

    (* set motor for opening gate ifcondition is fullfilled *)

    LD TRUE

    AND (Direction

    ORN OptSensor

    )

    AND Oben_S30

    ANDN EmergencyStopActivated

    ST SchLM1

    (* set motor for closing gate ifcondition is fullfilled *)

    LDN DirectionAND OptSensor

    AND Unten_S10

    ANDN EmergencyStopActivated

    ST SchRM1

  • 7/29/2019 Sample Solution Exercise PLC Programmingplc

    11/13

    AS

    11WS 10/11 Georg Frey

    Formal Design of Gate Control

    GateOpened

    SchLM1=0

    SchRM1=0

    GateClosed

    SchLM1=0

    SchRM1=0

    OpenGate

    SchLM1=1

    SchRM1=0

    CloseGate

    SchLM1=0

    SchRM1=1

    OptSensor&(TasterAB | FernSt)

    & Not_Aus

    (!Unten_S10 & !FernSt&!TasterAUF)& Not_Aus

    (TasterAUF | FernSt) & Not_Aus

    (!Oben_S30 & !FernSt&!TasterAB)

    & Not_Aus

    EmergencyStop

    SchLM1=0

    SchRM1=0

    (!OptSensor | TasterAUF | FernSt) & Not_Aus

    OptSensor & (TasterAB | FernSt) & Not_Aus

    !Not_Aus

    !Not_Aus

    !Not_Aus

    !Not_Aus

  • 7/29/2019 Sample Solution Exercise PLC Programmingplc

    12/13

    AS

    12WS 10/11 Georg Frey

    Formal Implementation of Gate Control

    (* Detect rising edge on remote control *)

    LD TRUE

    R RisingEdge

    LD FernSt

    ANDN FernStOld

    S RisingEdge

    LD FernSt

    ST FernStOld

    (* Transition GateOpened -> CloseGate *)

    LD GateOpened

    AND (TasterAB

    OR RisingEdge

    )

    AND OptSensorAND Not_Aus

    R GateOpened

    S CloseGate

    JMPC Continue

    (* Transition CloseGate -> GateClosed *)

    LD CloseGateAND TasterAUF

    ANDN Unten_S10

    ANDN RisingEdge

    )

    AND Not_Aus

    R CloseGate

    S GateClosed

    JMPC Continue

    (* Transition GateClosed -> OpenGate *)

    LD GateClosed

    AND (TasterAUF

    OR RisingEdge

    )

    AND Not_Aus

    R GateClosed

    S OpenGate

    JMPC Continue

    (* Transition OpenGate -> GateOpened *)

    LD OpenGate

    ANDN Oben_S30

    ANDN RisingEdge

    ANDN TasterAB

    AND Not_Aus

    R OpenGateS GateOpened

    JMPC Continue

    (* Transition CloseGate -> OpenGate *)

    LD CloseGate

    AND (TRUE

    ANDN OptSensorOR TasterAUF

    OR RisingEdge

    )

    AND Not_Aus

    R CloseGate

    S OpenGate

    JMPC Continue

  • 7/29/2019 Sample Solution Exercise PLC Programmingplc

    13/13

    AS

    13WS 10/11 Georg Frey

    Formal Implementation of Gate Control

    (* Transition OpenGate -> CloseGate *)

    LD OpenGate

    AND (TRUE

    AND OptSensor

    AND (TasterAB

    OR RisingEdge

    )

    )

    AND Not_Aus

    R OpenGate

    S CloseGate

    JMPC Continue

    (* Transitions to Emergency Stop *)

    LD GateOpen

    ANDN Not_Aus

    R GateOpenedS EmergencyStop

    JMPC Continue

    LD CloseGate

    ANDN Not_Aus

    R CloseGate

    S EmergencyStopJMPC Continue

    LD GateClosed

    ANDN Not_Aus

    R GateClosed

    S EmergencyStop

    JMPC Continue

    LD OpenGate

    ANDN Not_Aus

    R OpenGate

    S EmergencyStop

    JMPC Continue

    (* Gate Opened *)

    Continue: LD GateOpened

    R SchLM1

    R SchRM1

    (* Close Gate*)

    LD CloseGate

    R SchLM1

    S SchRM1

    (* Gate Closed *)LD GateClosed

    R SchLM1

    R SchRM1

    (* Open Gate *)

    LD OpenGate

    S SchLM1R SchRM1

    (* Emergency Stop *)

    LD EmergencyStop

    R SchLM1

    R SchRM1