Esercitazione1 [modalit compatibilit ] - infoPLC nè l’ambiente real-time CoDeSys SP RTE, nè un...

19
Università degli Studi di Modena e Reggio Emilia A utomation R obotics and S ystem CONTROL Università degli Studi di Ferrara PLC First example Francesca Fanfoni [email protected] CodeSys

Transcript of Esercitazione1 [modalit compatibilit ] - infoPLC nè l’ambiente real-time CoDeSys SP RTE, nè un...

Università degli Studidi Modena e Reggio Emilia

AutomationRobotics andSystemCONTROL Università degli Studi

di Ferrara

PLC

First example

Francesca Fanfoni

[email protected]

PLCCodeSys

CoDeSys (Controller Development Sys tem)

• Sviluppato dalla ditta 3S Software (www.3s-software.com)

• su Personal Computer permette di progettare controllori per macchine automatiche

• il compilatore a norma IEC 61131-3 genera un programma eseguibile per l’ambiente di esecuzione real-time CoDeSys SP RTE

[email protected]

RTE• l’eseguibile viene installato appositamente sul PC target.

• su sistemi di controllo industriali (es. PLC):

Il programma CoDeSys viene fornito a chi acquista il PLC con unnome o una interfaccia personalizzata dal costruttore del PLC.

CoDeSys (Controller Development Sys tem)

Modalità di funzionamento “simulazione”

• permette di eseguire il programma sviluppato senza avere a disposizione nè l’ambiente real-time CoDeSys SP RTE, nè un vero e proprio PLC.

[email protected]

proprio PLC.

• CoDeSys consente di creare pannelli di visualizzazione grafica“dimostrativi”

Indice

Installation

Starting CoDeSysThe First Project

Variables

[email protected]

Program Languages Overview

Variables

Installation

�Running “Setup CodeSys V3 SP1”http://www.3s-software.com/

� Installation custom-Select “CoDeSys V 3.2” e “3S Licensing Manager” (necessari)-Don’t select:

[email protected]

-Don’t select:-“CoDeSys Gateway Server”- “CoDeSys SP RTE”- “CoDeSys Web Server”

Starting CoDeSys

Launch from the Start menu.

CoDeSys interface has:

1. Menu bar and toolbar

2. Project Explorer

[email protected]

2. Project Explorer

3. Workspace

4. Output window: to display compiler and debugger messages5. Status bar: to display the online connection between the programming

device and the target system

CoDeSys

Technical data:

• Real time kernel guarantees deterministic behaviour with jitter values in the µsregion without additional hardware components or operating system extensions

•Interface to I/Os: discrete I/O cards or standard field bus cards

•Configuration of most field buses directly in CoDeSys; no external tool required

[email protected]

•Many supported field bus cards, such as Hilscher (CIF), Siemens Profibus, Beckhoff Profibus, Applicom, HMS Profibus, Automata CAN/SERCOS, PEAK CAN. Open API driver interfaces with Software Developer Kit (SDK) for customized I/O cards

•Configurable start up behaviour

•Remanent data (hard disk, flash card, battery buffered SRAM card)

The First Project

Task 1 : Handle a dummy traffic signal unit.

The red/green phases of both traffic signals alternate and we have to

handle the request of pedestrian crossing to stop the traffic.

Task 2 : We will insert a yellow transitional phase.

[email protected]

Step by step procedure

1. Create a schema solution, a new project and a new program

2. Compile a project

3. Run the simulator and transfer the project to the target

4. Configure the visualization

5. Testing the program sequence

The First Project

Create a schema solution

Car access

GREEN LIGHT

Wait pedestrian request to

stop the traffic

START

The red/green phases of both traffic signals alternate and we have to handle the request of pedestrian crossing to stop the traffic.

We have to think and design a solution draw a

[email protected]

stop the traffic.

Stop cars

RED LIGHT

After the pedestrian cross the

road reset the state.

Pedestrian request NOT Pedestrian request

We have to think and design a solution draw a simple diagram that is directly connected to the PLC program.

In the schema have to define:- States- Variables

A project contains all of the objects in a PLC program.Object: POUs (Program Organization Units), datatypes, visualizations, resources, and libraries.

Each project needs a program called PLC_PRG.

• Select File > New Project > Stardard Project

• Target configuration: NONE or

The First Project

Create a new project and a new program

[email protected]

• Target configuration: NONE or CoDeSys SP Win V3

• Define new POU using Ladder Diagram (LD)

• In Project Explorer select Resourcesand Global variables to open the editor for declaring data.

Ladder diagram (LD) è un linguaggio di programmazione grafico che segue i principi di un circuito elettrico.

Il linguaggio a contatti è adatto alla progettazione di circuiti logici.

Il linguaggio a contatti è composto da una sequenza di reti.

Una rete è limitata a sinistra e a destra da una linea elettrica verticale sinistra e da una linea elettrica verticale destra.

Elementi usati sono: contatti, bobine, moduli opzionali (POU) e linee di connessione.

The First Project

Ladder diagram (LD)

[email protected]

Elementi usati sono: contatti, bobine, moduli opzionali (POU) e linee di connessione.

Ciascuna rete, sul lato sinistro, è composta da una serie di contatti che, da sinistra verso destra, trasmettono lo stato "ON" oppure "OFF"; questi stati corrispondono ai valori booleani TRUE e FALSE. Ad ogni contatto appartiene una variabile booleana. Se questa variabile è TRUE, lo stato viene trasmesso da sinistra verso destra tramite la linea di connessione; in caso contrario la connessione di destra riceve il valore OFF.

• LOGIC

AND serial connection of two or more contacts

OR parallel connection of two or more contacts

The First Project

Ladder diagram (LD)

[email protected]

Negations

Jumps to skip over networks in the program, using a symbolic name of a jump label

Car access

GREEN LIGHT

Wait pedestrian request to

START

• Ladder diagram program is dived in Network

• Each network can be linked to a part of the solution schema

The First Project

Compiling a project and trasferring the project

[email protected]

Wait pedestrian request to

stop the traffic.

Stop cars

RED LIGHT

After the pedestrian cross the

road reset the state.

Pedestrian request NOT Pedestrian request

CoDeSys HMI can be installed with the standard CoDeSys setup We want plot a dummy traffic light unit which will illustrate the switching process.

• Select Visualization > Add Object and set “Lights” as name of the new visualization.

• Select Insert > Eclipse and try to draw a circle

The First Project Visualizing the solution to test the program sequence

[email protected]

• Now doubleclicking the circle and set Variable>Change Color> “variable of light”Color>Inside> choose blackAlarm color>Inside> choose red

And set others two light in the same way.

• Insert a bitmap or set a button to define the request of pedestrian crossing.

CoDeSys HMI can be installed with the standard CoDeSys setup We want plot a dummy traffic light unit which will illustrate the switching process.

• Select Visualization > Add Object and set “Lights” as name of the new visualization.

• Select Insert > Eclipse and try to draw a circle

The First Project Visualizing the solution to test the program sequence

[email protected]

• Now doubleclicking the circle and set Variable>Change Color> “variable of light”Color>Inside> choose blackAlarm color>Inside> choose red

And set others two light in the same way.

• Insert a button to define the request of pedestrian crossing. • Define a Image repository under POU section: declare new object and new

image repository. Then on the right side it will open a image list where you candeclare your image.

Step:� Online> Simulation

� Compile application

� Online>Log In

� Download

The First Project PLC SIMULATOR

[email protected]

� Download

� Toolbar Start

•. Testing the application consists of debugging the operative modes

� RESET A CALDO

Questo comando (categoria In linea) è disponibile in modalità in linea. Esso reimposta tutte le variabili – ad eccezione di quelle rimanenti (retain, persistenti) – ai valori di inizializzazione.

� RESET A FREDDO

Questo comando (categoria In linea) è disponibile in modalità in linea. Questa procedura corrisponde al comando 'Reset' (Reset a caldo) con la differenza che, in questo caso specifico,

The First Project PLC SIMULATOR - Reset

[email protected]

corrisponde al comando 'Reset' (Reset a caldo) con la differenza che, in questo caso specifico, vengono resettate ovvero riportate ai loro valori di inizializzazione, oltre alle variabili "normali", anche quelle di retain (!). Questa condizione è analoga a quella che si produce all'avvio di un programma applicativo, che sia già stato caricato sul controllo ("Avvio a freddo").

� RESET ORIGINE

Questo comando (categoria In linea) è disponibile in modalità in linea. Esso reimposta i valori di tutte le variabili rimanenti ai valori di inizializzazione ed elimina il programma di applicazione dal

controllo .

The First Project

Task 1 : Handle a dummy traffic signal unit.

The red/green phases of both traffic signals alternate and we have to

handle the request of pedestrian crossing to stop the traffic.

Task 2 : Insert a yellow transitional phase.

[email protected]

Task 2 : Insert a yellow transitional phase.

Task 3 : Control two traffic signals at an intersection. The red/green phases

of both traffic signals alternate and, in order to avoid accidents, we

will insert yellow or yellow/red transitional phases.

PLCAutomazione Industriale

Francesca [email protected]