industrial automation course -...

41
Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 1 Industrial Automation course Lesson 5 PLC - SFC

Upload: lamthu

Post on 26-Jul-2018

237 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 1

Industrial Automation course

Lesson 5

PLC - SFC

Page 2: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 2

History

Before the 60s the SEQUENTIAL CONTROL was seen as EXTENSION OF THE CONTINUOUS CONTROL or in the best cases THE DIGITAL.

Since the '60s the theory on finite state automata is developed, whose formal models allow a deep MATHEMATICAL ANALYSIS, but hardly useful for DESIGN of the algorithms.

In the 70's the design of automation systems is quite elementary, is based on CIRCUITAL REPRESENTATIONS or TEXTUAL DESCRIPTIONS.

Page 3: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 3

History

In the 1975, in France, a commission for the FORMALIZATION of a DESCRIPTIVE PROJECTUAL instrument oriented to the SEQUENTIAL CONTROL is instituted. GRAFCET is born.

In the 80s GRAFCET is defined as SEQUENTIAL FUNCTIONAL CHART in the IEC (International Electrotechnical Commission) 848.

Page 4: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 4

Base elements

State (phase)

Definition

The STATE is a defined OPERATIVE CONDITION of a part of the complex system.

Graphical representation

NState number … or better a univocal Name

N

Initial state with the double border

Page 5: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 5

Base elements

State (phase)

Remarks

The STATE is an INVARIANT condition of the system under exam, it can change or being modified only as a result of an EVENT.

During the dynamic evolution of the complex system, each STATE of each part of the system can be only in two possible conditions: ACTIVE or INACTIVE.

Page 6: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 6

Base elements

State (phase)

Syntax

The PLC defines, for each state, two variables:

•MARKER, the Boolean variable that contain the condition of the state (it sais if it is active or not)

• TIMER, the internal variable that represents the elapsed time since the activation (if the state is active)

Usually

•MARKER variable: StateName.X

• TIMER variable: StateName.T

Page 7: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 7

Base elements

Action

Definition

All the OPERATIONS executed from the system under exam, when it is in a defined OPERATIVE CONDITION (STATE), are called ACTIONS.

Graphical representation

N Action 1

Page 8: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 8

Base elements

Action

Remarks

Each STATE of the system in made of a defined set of ACTIONS.

From the CONTROL SYSTEM field of view, considering that it is used for the execution of the LOGIC-SEQUENTIAL SOFTWARE, an ACTION corresponds to one or more PROCEDURES, that are a SET of INSTRUCTIONS, executed in series, until the STATE is ACTIVE (until an EVENT changes the STATE).

Page 9: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 9

Base elements

Action

Syntax

The PLC defines, for each action, three variables:

•𝐴𝑚, the univocal id of the action

•𝑄𝑚, that defines the action type (qualificator)

•𝑉𝑚, a Boolean variable that represents the state of the action

N.B.: In a lot of programming environments, the actions (and also the transitions) can be defined with one of the IEC 61131 programming languages

Page 10: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 10

Base elements

Action

Syntax

Qualificator types

•N: Normal non stored

If the action 𝐴𝑛 is of type N it will be executed each PLC cycle if the state connected to it is active

•P: Pulse

If the action 𝐴𝑛 is of type P it will be executed only the first PLC cycle in which the state connected to it is active

N.B.: Sometimes it is possible to find the qualificator I (Impulise)

Page 11: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 11

Base elements

Azione

Syntax

Qualificator types

• S: Set

If the action 𝐴𝑛 is of type S it will be executed each PLC cycleuntil the same 𝐴𝑛 action (in a subsequent state) will have the R qualificator

•R: Reset

If the action 𝐴𝑛 is of type R (as already described) stops the execution of a previous action enabled with a S qualificator

Page 12: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 12

Base elements

Azione

Syntax

Qualificator types

• L: Limited Time

If the action 𝐴𝑛 is of type L it will be each PLC cycle for t#Ts seconds, starting from the state activation

N.B.: if the state is disabled, the action is terminated

•D: Time Delayed

If the action 𝐴𝑛 is of type D it will be executed each PLC cycle after t#Ts seconds from the state activation

Page 13: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 13

Base elements

Azione

Syntax

Qualificator types

• SD: Stored / time Delayed

If the action 𝐴𝑛 is of type SD it is equal to a S action, with a delay of t#Ts seconds

• SL: Stored / time Limited

If the action 𝐴𝑛 is of type SL it is equal to a S action, disabled after t#Ts seconds (independently from the active state)

Page 14: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 14

Base elements

Transition

Definition(s)

The PASSAGE from a PREVIOUS STATE to a SUBSEQUENT one, because of an event, is called TRANSITION.

The LOGICAL check, that determines the happening of an EVENT is called CONDITION.

Remarks

Each CONDITION is associated to a TRANSITION.

Each CONDITION is defined as a LOGICAL FUNCTION, through a BOOLEAN EXPRESSION that can be TRUE or FALSE.

Page 15: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 15

Base elements

Transition

Graphical representation

N

N+1

Transition

Condition

Action 1

Action 2

Page 16: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 16

Evolution rules

Very important

Rule 1

A transition is defined as ENABLED if ALL the phases above of it are active.

A transition is defined as SUPERABLE if it is enabled and the condition related to it has the value «true».

Page 17: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 17

Evolution rules

Rule 2

When a transition is superable it is overcome: all the phases above the transition are disabled, while those below it are enabled

It is very easy: when the condition becomes true all the below phases are enabled and the above are disabled

N.B.: the correct syntax is always state - transition - state -transition - …

Page 18: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 18

Evolution rules

Example

2

3

False

11 2

True

3

Page 19: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 19

Base structures

Defined the previously defined rules, the base structures that can be created are the following:

If – then – else

1

2 3

4

A B

DC Convergence

Choice

Page 20: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 20

Base structures

Remarks

The A and B conditions must be

mutually exclusive.

If they were not it would risk having the

phase 4 activated «two times».

N.B.: As it will be showed in the last part of the course, this is a difference between the SFC and the Petri nets.

1

2 3

4

A B

DC

Page 21: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 21

Base structures

Parallel

1

2 3

4

A

BSynchronization

Parallelism

Page 22: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 22

Base structures

Remarks

The phases 2 and 3 are activated

simultaneously.

In the case of presence, in one of the

branches, of more than one phase, the

Check of the condition B is executed when the

Last phase of each branch is activated.

1

2 3

4

A

B

Page 23: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 23

SFC in a real case

In a lot of development environments (also in the case of the B&R Automation Studio) the SFC is integrated with the other IEC 61131 languages.

It means tat, in each phase (called «state»), it is possible to associate the execution of a portion of code written in one of the 1131 languages.

For this reason, not all the action types described before are used inside the tool.

Page 24: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 24

Example

Base example

What happens if A and B are both true?

The PLC continues to commutate cyclically between the state 1 and the 2

A

state2B

state1

Page 25: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 25

Example

Action and if – then – else example

Develop a software that allow, using the activation of an actuator for 1 second, to discard products with a weight lower to a defined threshold

Inputs

PC: Photocell

Weight: weight of the product

Outputs

Actuator: activation of the actuator

Page 26: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 26

Example

N.B.: With Automation Studio, if we want to use the IEC norm, in order to create actions, it is necessary to click on the button «Use IEC Steps» as depicted in the picture.

Page 27: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 27

Example

Action and if – then – else example

PC

Product Arrived

Weight<Threshold

Waiting

Discard

Discard.T>=t#1s

Weight>=Threshold

S Actuator

R Actuator

Page 28: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 28

Example

Temporally limited states example

Develop a software that activates the electro-valve U if the overfull sensor OFS remains active for more than 10 s and keeps it activated for 30 s

Inputs

OFS: Overfull sensor

Outputs

U: Electro-valve activation

Page 29: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 29

Example

Temporally limited states example

OFS

Sensor Active

SensorActive.t>=t#10s

Sensor Check

ValveActive

ValveActive.T>t#30s

NOT(OFS)

N U

Page 30: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 30

Example

Other languages actions example

Develop a software that advise for the passage of the tenth customer, using a photocell on the entrance of the shop

Inputs

PC: photocell

Outputs

Tenth: reach of the tenth customer

N.B.: usually, during the exercises, where it is required to implement a SFC software, if not specified, this type of solution is denied

Page 31: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 31

Example

Other languages actions example

PC

Customer Arrived

N>=10

Customer Wait

TenthReached

N<10

FALSE

Page 32: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 32

Example

Other languages actions example

N>=10

FALSE

EPC := FALSE;N := N + 1;

We can add actions on the Entrance (E), Cyclically (C) and on the eXit (X), in this case we use the structured text

PC

Customer Arrived

Customer Wait

TenthReached

N<10

Page 33: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 33

Example

Other languages actions example

N>=10

FALSE

ETenth := TRUE;

PC

Customer Arrived

Customer Wait

TenthReached

N<10

Page 34: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 34

From SFC to Ladder

It is possible to translate a software implemented in SFC, in a Ladder software, using simple rules, independent from the program itself.

In the course we will focus on the algorithm without stability search.

N.B.: These are standard rules, applicable to every SFC program!

Page 35: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 35

From SFC to Ladder

Consider this SFC evolution algorithm

Input reading

Phases initialization

Impulsive actions execution

Inputs reading

Definition of the superable transitions

Definition of the new condition

Outputs update

This algorithm is called withoutstability search.

In the case of non-stable phase (phase with, on the activation, the exiting transition set to true), this scheme «makes a mistake»:

• If the action is continuous must not be activated

• If it is impulsive, it must be

Page 36: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 36

From SFC to Ladder

Just for information, this is the algorithm with stability search

Inputs reading

Phases initialization

Impulsive actions execution

Inputs reading

Definition of the superable transitions

Definition of the new condition

Conditions isn’t changed

Impulsive actions execution

Outputs update N.B.: we will use the other one

Page 37: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 37

From SFC to Ladder

The Ladder must be defined with four sections:

• Initialization

Executed only during the first step of the software

•Actions execution

Enabling of the actions connected to the active phase

•Transitions evaluation

Enabling of all the active transitions

•Conditions update

Check of the passage between the active phases and the following

Page 38: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 38

From SFC to Ladder

Initialization

JMP

𝐶𝑦𝑐𝑙𝑖𝑐

𝐶𝑦𝑐𝑙𝑖𝑐

LBL

.

.

.

𝐹𝑃

L

.

.

.

𝑇𝑟𝑢𝑒

U

𝑇𝑟𝑢𝑒

N.B.: in AS, this part can be directly implemented in the _INIT!

Page 39: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 39

From SFC to Ladder

Actions execution

• For each continuous action a rung is used, connected in OR, with all the other that activate the same action

• For the stored activities it is possible to use SET – RESET coils

• For the impulsive actions it is possible to create the network for the generation of the impulse

𝐴𝑐𝑡𝑖𝑜𝑛𝐴𝑃ℎ𝑎𝑠𝑒𝐴

𝑃ℎ𝑎𝑠𝑒𝐵 𝐴𝑐𝑡𝑖𝑜𝑛𝐵

𝐴𝑐𝑡𝑖𝑜𝑛𝐶

Page 40: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 40

From SFC to Ladder

Conditions evaluation

• For each phase, the outgoing conditions that enable the transition are verified

• In the case of parallel transitions it is necessary to use the AND structure with the Boolean signals of the phases

𝑇𝑟𝑎𝑛𝑠𝐴𝑃ℎ𝑎𝑠𝑒𝐴 𝐶𝑜𝑛𝑑𝐴

𝑇𝑟𝑎𝑛𝑠𝐵𝑃ℎ𝑎𝑠𝑒𝐶𝑃ℎ𝑎𝑠𝑒𝐵 𝐶𝑜𝑛𝑑𝐷

𝑇𝑟𝑎𝑛𝑠𝐵

Page 41: Industrial Automation course - UniBGmove.unibg.it/cologni/pages/didattica/archivio/udem2015/lectures/... · Industrial Automation course Lesson 5 PLC ... In the 70's the design of

Politecnico di Milano – Universidad de Monterrey, July 2015, A. L. Cologni 41

From SFC to Ladder

Condition update

When a transition is active, all the above phases are disabled, while the below are enabled

𝑃ℎ𝑎𝑠𝑒𝐴𝑇𝑟𝑎𝑛𝑠𝐴

𝑇𝑟𝑎𝑛𝑠𝐵 𝑃ℎ𝑎𝑠𝑒𝐶

𝑃ℎ𝑎𝑠𝑒𝐷

𝑃ℎ𝑎𝑠𝑒𝐵

U

L

U

L