state machines with codesys: clever usage of language … · 2014. 7. 6. · close gate . wait for...

38
CODESYS ® a trademark of 3S-Smart Software Solutions GmbH State machines with CODESYS: Clever usage of language properties CODESYS Users' Conference 2014, Manfred Werner

Upload: others

Post on 13-Feb-2021

6 views

Category:

Documents


0 download

TRANSCRIPT

  • CODESYS® a trademark of 3S-Smart Software Solutions GmbH

    State machines with CODESYS: Clever usage of language properties CODESYS Users' Conference 2014, Manfred Werner

  • 2 © 3S-Smart Software Solutions GmbH

    State machines with CODESYS

    Agenda

    1

    2

    3

    4

    5

    6

    7

    Task assignment and definitions

    A PLC classic: Function Block Diagram

    A CODESYS standard: Structured Text

    Rather unusual: CFC

    A specialist: Sequential Function Chart

    New in the family: UML State Chart

    Conclusion

  • 3

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    A process shall be automated.

    Different programming languages shall be used.

    The question arises which example to take?

    Task assignment and definitions

    Pho

    to: ©

    Alfr

    ed K

    ärch

    er G

    mbH

    & C

    o. K

    G

    A car washing plant

  • 4

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    A first approach

    Task assignment and definitions

  • 5

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    In order to ensure an actual comparison, the same process will be automated using different programming languages.

    Task assignment and definitions

    Close gate Wait for 3 seconds Open gate

    To keep the process as simple as possible, objects have already been created which "only" have to be commanded. These objects take care of themselves to decide whether and how the command can be carried out.

    The basic knowledge for all programming language will be acquired through the programming of a rolling gate.

  • 6

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    Task assignment and definitions

    State

    Transition condition

    Transition

    OPEN

    Action

    CLOSED X

    Close!

    Open!

    Sensor open

    Sensor closed

  • 7 © 3S-Smart Software Solutions GmbH

    State machines with CODESYS

    Agenda

    1

    2

    3

    4

    5

    6

    7

    Task assignment and definitions

    A PLC classic: Function Block Diagram

    A CODESYS standard: Structured Text

    Rather unusual: CFC

    A specialist: Sequential Function Chart

    New in the family: UML State Chart

    Conclusion

  • 8

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    State

    Transition condition

    State Transition condition

    None of the classics Function Block Diagram (FBD), Ladder Logic (LD) or Instruction List (IL) knows states.

    However, states can be presented through variables. Typically,

    − the IEC operators R or S − instances of the function block

    RS or SR from the standard library

    − a conditionally assigned state variable are used.

    A PLC classic: Function Block Diagram

  • 9

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    A PLC classic: Function Block Diagram

    Current state

    Future state

  • 10

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    Using a method creates an overview!

    A PLC classic: Function Block Diagram

    Current state

    Future state

  • 11

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    Actions are handled separated from the process. Mostly, physical outputs are assigned

    cyclically. SafetyCondition

    − What should always be complied with − What should never occur

    A PLC classic: Function Block Diagram

  • 12

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    A PLC classic: Function Block Diagram

    Sequence programming in Function Block Diagram is possible. can be read if certain structures are respected. Alternative branches are possible for running the program. Programmers have much freedom. The value of the state variable can easily be saved.

  • 13 © 3S-Smart Software Solutions GmbH

    State machines with CODESYS

    Agenda

    1

    2

    3

    4

    5

    6

    7

    Task assignment and definitions

    A PLC classic: Function Block Diagram

    A CODESYS standard: Structured Text

    Rather unusual: CFC

    A specialist: Sequential Function Chart

    New in the family: UML State Chart

    Conclusion

  • 14

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    In ST, a CASE structure is used practically always.

    A CODESYS standard: Structured Text

    State

    Transition condition

    Action

    Transition

    Current state Future state

  • 15

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    Only the current state is executed.

    A CODESYS standard: Structured Text

  • 16

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    A CODESYS standard: Structured Text

    Sequence programming in Structured Text Is possible. Alternative branches are possible for running the program. Programmers have much freedom. The value of the state variable can easily be saved. Only the code which is actually relevant is calculated.

  • 17

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    1

    2

    3

    4

    5

    6

    7

    Task assignment and definitions

    A PLC classic: Function Block Diagram

    A CODESYS standard: Structured Text

    Rather unusual: CFC

    A specialist: Sequential Function Chart

    New in the family: UML State Chart

    Conclusion

  • 18

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    Option 1 Same procedure as in Function Block Diagram

    Option 2 The states are specialized FBs.

    − Execute: Execute action. − Done: Action finished

    Rather unusual: CFC

  • 19

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    Programming by connecting

    Rather unusual: CFC

  • 20

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    Online: a dream!

    Rather unusual: CFC

  • 21

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    Rather unusual: CFC

    Sequence programming in Continuous Function Block Diagram is possible. Programming by simple wiring. Alternative branches are difficult to display. States are easy and clearly recognizable in the monitoring. Specialized FBs are necessary.

  • 22 © 3S-Smart Software Solutions GmbH

    State machines with CODESYS

    Agenda

    1

    2

    3

    4

    5

    6

    7

    Task assignment and definitions

    A PLC classic: Function Block Diagram

    A CODESYS standard: Structured Text

    Rather unusual: CFC

    A specialist: Sequential Function Chart

    New in the family: UML State Chart

    Conclusion

  • 23

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    SFC is defined in the IEC61131-3.

    In addition to the action associations defined in the IEC, CODESYS offers an easier option to execute actions.

    A specialist: Sequential Function Chart

    State

    Transition condition

    Action association

    Transition

    Action

  • 24

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    Unique online display Active action / step Fulfilled transition

    A specialist: Sequential Function Chart

  • 25

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    A specialist has special features.

    A specialist: Sequential Function Chart

  • 26

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    A specialist has special features.

    The state can be queried with:

    A specialist: Sequential Function Chart

  • 27

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    A specialist: Sequential Function Chart

    Sequence programming in Sequential Function Chart Is possible. Graphical display of the sequence. Alternative or parallel branches are feasible without tricks. States are clearly recognizable in the monitoring. Flags for diagnostics and influencing are available. Only active actions are calculated.

  • 28 © 3S-Smart Software Solutions GmbH

    State machines with CODESYS

    Agenda

    1

    2

    3

    4

    5

    6

    7

    Task assignment and definitions

    A PLC classic: Function Block Diagram

    A CODESYS standard: Structured Text

    Rather unusual: CFC

    A specialist: Sequential Function Chart

    New in the family: UML State Chart

    Conclusion

  • 29

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    New in the family: UML State Chart

    State Chart is an additional programming language included in the CODESYS UML Package.

    It is available in the CODESYS Store.

    It requires a dongle.

  • 30

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    New in the family: UML State Chart

    State

    Transition condition

    Transition

    Action

  • 31

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    New in the family: UML State Chart

    Unique online display Active state

  • 32

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    New in the family: UML State Chart

    Special feature: Composite State

  • 33

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    New in the family: UML State Chart

    Implicit flags to influence states

  • 34

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    New in the family: UML State Chart

    A special asset of the State Chart: Multiple transitions between states

  • 35

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    New in the family: UML State Chart

    Sequence programming in the State Chart is possible. Graphical display of the sequence. States are clearly recognizable in the monitoring. Implicit variables for diagnostics and influencing are available. Only active actions are calculated.

  • 36 © 3S-Smart Software Solutions GmbH

    State machines with CODESYS

    Agenda

    1

    2

    3

    4

    5

    6

    7

    Task assignment and definitions

    A PLC classic: Function Block Diagram

    A CODESYS standard: Structured Text

    Rather unusual: CFC

    A specialist: Sequential Function Chart

    New in the family: UML State Chart

    Conclusion

  • 37

    State machines with CODESYS

    © 3S-Smart Software Solutions GmbH

    Have it your own way!

    Decision criteria: How shall the program be used? Who shall program? Who shall put it into operation / carry out the diagnosis? Which language fits the task best? Which kind of presentation fits best for project documentation?

    Conclusion

  • 38 © 3S-Smart Software Solutions GmbH

    Inspiring Automation Solutions

    Thank you for your attention.

    State machines with CODESYS:�Clever usage of language propertiesFoliennummer 2Task assignment and definitionsTask assignment and definitionsTask assignment and definitionsTask assignment and definitionsFoliennummer 7A PLC classic: Function Block DiagramA PLC classic: Function Block DiagramA PLC classic: Function Block DiagramA PLC classic: Function Block DiagramA PLC classic: Function Block DiagramFoliennummer 13A CODESYS standard: Structured Text A CODESYS standard: Structured Text A CODESYS standard: Structured Text Foliennummer 17Rather unusual: CFCRather unusual: CFCRather unusual: CFCRather unusual: CFCFoliennummer 22A specialist: Sequential Function ChartA specialist: Sequential Function ChartA specialist: Sequential Function ChartA specialist: Sequential Function ChartA specialist: Sequential Function ChartFoliennummer 28New in the family: UML State ChartNew in the family: UML State ChartNew in the family: UML State ChartNew in the family: UML State ChartNew in the family: UML State ChartNew in the family: UML State ChartNew in the family: UML State ChartFoliennummer 36ConclusionFoliennummer 38