• No results found

Industrial Automation course

N/A
N/A
Protected

Academic year: 2021

Share "Industrial Automation course"

Copied!
22
0
0

Loading.... (view fulltext now)

Full text

(1)

Industrial Automation course

Lesson 8

PLC – Structured text

Exercises

(2)

Exercise 1

Let’s consider a rocks transport system based on a cart. The operator defines the beginning of the cycle using the START button. The cart goes through the entire rail from left to right and it stops waiting to be filled. The rocks, after being accumulated in a tank, are moved mechanically into the cart, which must automatically move along the rail from right to left.

(3)

Exercise 1

As INPUTS we have six sensors:

Start Start button ET Empty Tank

LS Left Switch TDS Tank Down Switch

RS Right Switch TUS Tank Up Switch

LS LM RS RM Start TUS TDS ET DWT UPT Rocks As OUTPUTSwe have:

(4)

Exercise 1

The implementation choices, in structured text, can be very different, it means that the implementation is more free in respect of the ladder and the SFC.

Since it is a higher level language, it gives the possibility of organize, in function of the programmer needs, the software.

(5)

Exercise 1

«Ladder-based» solution PROGRAM _INIT LM := 0; RM := 0; DWT := 0; UPT := 0; END_PROGRAM PROGRAM _CYCLIC

IF StartAND LSAND NOT ETTHEN

RM := 1;

END_IF; IF RSTHEN

RM := 0;

END_IF;

IF RSAND NOT LSAND TUSAND NOT TDSAND NOT ETTHEN

DWT := 1;

END_IF;

IF RSAND NOTLSAND TDSAND NOTTUSTHEN

DWT := 0;

END_IF;

IF RSAND NOT LSANDTDSAND NOT TUSAND ETTHEN

UPT := 1;

END_IF;

IF RSAND NOT LSAND TUS AND NOT TDSTHEN

UPT := 0;

END_IF;

IF RSAND NOT LSAND TUSAND NOT TDSAND ETTHEN

LM := 1;

END_IF;

IF LSAND NOT RSTHEN

LM := 0;

END_IF; END_PROGRAM

(6)

Exercise 1

«SFC-based» solution PROGRAM _INIT LM := 0; RM := 0; DWT := 0; UPT := 0; END_PROGRAM PROGRAM _CYCLIC CASE State OF 0: LM := 0; RM := 0; DWT := 0; UPT := 0;

IF StartAND NOT ET THEN

State := 1; END_IF; 1: RM := 1; IF RSTHEN RM := 0; State := 2; END_IF; 2: DWT := 1; IF TDSTHEN DWT := 0; State := 3; END_IF; 3: IF ETTHEN UPT := 1; State := 4; END_IF; 4: IF TUS THEN UPT := 0; State := 5; END_IF; 5: LM := 1; IF LSTHEN LM := 0; State := 0; END_IF; END_CASE END_PROGRAM

(7)

Exercise 1

Which solution is better?

It depends from the type of machine that you want to

control: as it will be shown, in the washing plant the «ladder-based» solution is the most easy and intuitive.

In the case, instead, of the machining station control, the best solution is that based on the finite-state machine.

(8)

Exercise 1.1

Let’s add to the previous exercise, a maintenance stop every 100 cycles.

It is necessary to add:

MS (Maintenance Stop) as output MR (Maintenance Reset) as input

N.B.: It will be necessary to create also a counter variable! We analyze only the machine state solution

(9)

Esercizio 1.1

PROGRAM _INIT LM := 0; RM := 0; DWT := 0; UPT := 0; n := 0; END_PROGRAM PROGRAM _CYCLIC CASE StateOF 0: LM := 0; RM := 0; DWT := 0; UPT := 0;

IF StartAND NOT ETTHEN

State := 1; END_IF; IF FD THEN RM := 0; State := 2; END_IF; 2: DWT := 1; IF TDSTHEN DWT := 0; State := 3; END_IF; 3: IF ET THEN UPT := 1; State := 4; END_IF; 4: IF TUSTHEN UPT := 0; 5: LM := 1; IFLS THEN LM := 0; n := n + 1; IFn>=100 THEN MS := 1; State := 6; ELSE State := 0; END_IF; END_IF; 6: IF MR THEN MS := 0; n := 0; State := 0; END_IF;

(10)

Exercise 2

Let’s consider an automatic car wash plant.

The customer approaches to the belt when the traffic light is green. The wash phases are: soaping, brushing, rinsing and drying.

All the phases are preceded by a photocell that detects the car arrival in that section of the plant.

Every 1000 washes the plant must be blocked and wait for the maintenance, made by an operator.

(11)

Inputs Outputs

InP Input photocell RTL Red traffic light (0=GREEN, 1=RED)

BP Brushing photocell SM Soaping motor

RP Rinsing photocell BM Brushing motor

DP Drying photocell RM Rinsing motor

OutP Output photocell DM Drying motor

Exercise 2

InP BP RP DP OutP SM BM RM DM RTL MAIR MAI

(12)

Exercise 2

The plant can be considered as a set of single smaller plants:

• Soaping

• Brushing

• Rinsing

• Drying

Each of these «plants» must be turned on when the input photocell detects the passage of a car, while it must be switched off when the car is completely exited from the section (when the next photocell is deactivated).

(13)

Exercise 2

As already described in lesson 4, the solution to this exercise is based on a «distributed» management of each part of the plant.

We already seen in lesson 7 how it is possible, in a fast way, to create Function Blocks in ST.

Because of the presence of 3 sections that have the same behavior, we start, first of all from the creation of a Function Block that control a part of the plant.

(14)

Exercise 2

FUNCTION_BLOCK PlantSection

IF NOT Activation THEN IF EDGEPOS(InP) THEN

Activation := 1;

END_IF; ELSE

IF EDGENEG(OutP) THEN

Activation := 0;

END_IF; END_IF;

END_FUNCTION_BLOCK

Each section is activated when a positive edge of the input

photocell is detected, while it is deactivated when a negative edge of the output photocell is reached.

Inputs: InP, OutP Outputs: Activation

(15)

Exercise 2

FUNCTION_BLOCK FirstSection

IF n<1000THEN IF NOT RTL THEN

IF EDGEPOS(InP) THEN

RTL := 1; Activation := 1;

END_IF; ELSE

IF EDGENEG(OutP) THEN

RTL := 0; Activation := 0; n := n + 1; END_IF; END_IF; ELSE RTL := 1; Activation := 0; Mai := 1; IF MaiResetTHEN n := 0; RTL := 0; Mai := 0; END_IF; END_IF; END_FUNCTION_BLOCK

The first section (Soaping) has to manage also the traffic light and the programmed maintenance. For this reason it is

necessary to use a different Function Block.

Inputs:

InP, OutP, MaiReset Outputs:

(16)

Exercise 2

PROGRAM _INIT END_PROGRAM PROGRAM _CYCLIC

Soaping(InP := InP, OutP := BP, MaiReset := MAIR); MAI := Soaping.Mai; RTL := Soaping.RTL; SM := Soaping.Activation; Brushing(InP := BP, OutP := RP); BM := Brushing.Activation; Rinsing(InP := RP, OutP := DP); RM := Rinsing.Activation;

Drying(InP := DP, OutP := OutP); DM := Drying.Activation;

END_PROGRAM

The program file is very simple: subsequent call to the plant section are executed, passing the input parameters.

N.B.: Why we didn’t use a single entity of the Plant Section

(17)

Exercise 3

Let’s consider an automatic drilling and riveting system for sheet metal.

When the two pieces arrive, a robot execute the handling of the components (subsequently one to each other) and it

positions them on the mounting jig. When the handling is finished the machining can be executed using the automatic driller (the duration of this operation is 5 sec) and the riveter (10 sec).

At the end of the operations the robots moves the piece in a pallet.

(18)

Exercise 3

P

CB CA MA MB T

R

BDS FDS FRS BRS PB PA RST RC DFM RFM DON RON Inputs

PA Presence sensor conveyor A FDS Front driller switch

PB Presence sensor conveyor B BRS Back riveter switch

RST Robot state (0=IDLE, 1=EXECUTING) FRS Front riveter switch BDS Back driller switch

DBM

(19)

Exercise 3

Outputs

RC Robot command (0=STOP, 1=from CA to MA, 2=from CB to MB, 3=from M to P)

DON Driller ON

RFM Riveter front motor

DFM Driller front motor RBM Riveter back motor

DBM Driller back motor RON Riveter ON

P

CB CA MA MB T

R

BDS FDS FRS BRS PB PA RST RC DFM RFM DON RON DBM RBM

(20)

Exercise 3

Consider the steps necessary to achieve the final product:

1)Wait the activation of CA and CB

2)Send the command 1 to the robot and wait the end of the execution 3)Send the command 2 to the robot and wait the end of the execution 4)Move the driller until reach its front switch

5)Activate the driller for 5 seconds

6)Move back the driller until it reaches the back switch 7)Move the riveter until reach its front switch

8)Activate the driller for 10 seconds

9)Move back the driller until it reaches the back switch

10)Send the command 3 to the robot and wait the end of the execution 11)Send the command 0 to the robot

(21)

Exercise 3

PROGRAM _INIT State := 0; END_PROGRAM PROGRAM _CYCLIC CASE StateOF 0:(* Stop *) IF PAAND PBTHEN RC := 1; State := 1; RST := 1; END_IF; 1: (* Moving A *) IF NOT RSTTHEN RC := 2; State := 2; RST := 1; END_IF; 2:(* Moving B *) IF NOT RSTTHEN State := 3; END_IF; IF FDSTHEN DFM := 0; State := 4; END_IF; 4:(* Driller machining *) DON := 1; t := t + dt; IF t>=T#5s THEN t := T#0s; DON := 0; State := 5; END_IF; 5: (* Driller backward *) DBM := 1; IF BDSTHEN DBM := 0; State := 6; END_IF; 6:(* Riveter forward *) RFM := 1; IF FRSTHEN RFM := 0; 7:(* Riveter machining *) RON := 1; t := t + dt; IF t>=T#10s THEN t := T#0s; RON := 0; State := 8; END_IF; 8:(* Riveter backward *) RBM := 1; IF BRSTHEN RBM := 0; RC := 3; State := 9; RST := 1; END_IF; 9:(* Moving product *) IF NOT RSTTHEN State := 0; END_IF; END_CASE; END_PROGRAM

(22)

Remarks

Structured text remarks

It’s the highest level programming language of the IEC 61131 norm.

It shows a set of problems (also present in the other languages) related to the software engineering.

In the industrial context, it is not used a lot: it is entering now thanks to some tools that allow the automatic generation of the code.

References

Related documents

• Follow up with your employer each reporting period to ensure your hours are reported on a regular basis?. • Discuss your progress with

 HCC is developing in 85% in cirrhosis hepatis Chronic liver damage Hepatocita regeneration Cirrhosis Genetic changes

The prototype consists of a temperature control system consisting of two temperature sensors thermocouple type K with the module Max6675 that are sensing the

4.1 The Select Committee is asked to consider the proposed development of the Customer Service Function, the recommended service delivery option and the investment required8. It

The PROMs questionnaire used in the national programme, contains several elements; the EQ-5D measure, which forms the basis for all individual procedure

• Based on intention to treat, VRET achieves more rapid responses, and higher response rates, than imaginal exposure for PTSD. • Combination VRET with pharmacotherapy has

The corona radiata consists of one or more layers of follicular cells that surround the zona pellucida, the polar body, and the secondary oocyte.. The corona radiata is dispersed

The key segments in the mattress industry in India are; Natural latex foam, Memory foam, PU foam, Inner spring and Rubberized coir.. Natural Latex mattresses are