Esercitazione in aula informatica - Automazione@ingre
Transcript
Esercitazione in aula informatica - Automazione@ingre
Automation Robotics and System CONTROL Università degli Studi di Modena e Reggio Emilia Università degli Studi di Ferrara PLC CodeSys First example Francesca Fanfoni [email protected] CoDeSys (Controller Development System) • 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 • 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 un nome o una interfaccia personalizzata dal costruttore del PLC. [email protected] CoDeSys (Controller Development System) 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. • CoDeSys consente di creare pannelli di visualizzazione grafica “dimostrativi” [email protected] Indice Installation Starting CoDeSys The First Project Variables Program Languages Overview [email protected] 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: -“CoDeSys Gateway Server” - “CoDeSys SP RTE” - “CoDeSys Web Server” [email protected] Starting CoDeSys Launch from the Start menu. CoDeSys interface has: 1. Menu bar and toolbar 2. Project Explorer 3. Workspace 4. Output window: to display compiler and debugger messages 5. Status bar: to display the online connection between the programming device and the target system [email protected] CoDeSys Technical data: • Real time kernel guarantees deterministic behaviour with jitter values in the µs region 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 •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) [email protected] 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. 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 [email protected] The First Project Create a schema solution The red/green phases of both traffic signals alternate and we have to handle the request of pedestrian crossing to stop the traffic. START Car access GREEN LIGHT We have to think and design a solution draw a simple diagram that is directly connected to the PLC program. Wait pedestrian request to stop the traffic. traffic Pedestrian request Stop cars In the schema have to define: - States - Variables [email protected] RED LIGHT After the pedestrian cross the road reset the state. NOT Pedestrian request The First Project Create a new project and a new program A project contains all of the objects in a PLC program. Object: POUs (Program Organization Units), data types, visualizations, resources, and libraries. Each project needs a program called PLC_PRG. • • Select File > New Project > Stardard Project Target configuration: NONE or CoDeSys SP Win V3 • Define new POU using Ladder Diagram (LD) • In Project Explorer select Resources and Global variables to open the editor for declaring data. [email protected] The First Project Ladder diagram (LD) 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. 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. [email protected] The First Project Ladder diagram (LD) • LOGIC AND serial connection of two or more contacts OR parallel connection of two or more contacts Negations Jumps to skip over networks in the program, using a symbolic name of a jump label [email protected] The First Project Compiling a project and trasferring the project • Ladder diagram program is dived in Network • Each network can be linked to a part of the solution schema START Car access GREEN LIGHT Wait pedestrian request to stop the traffic. Pedestrian request NOT Pedestrian request Stop cars RED LIGHT After the pedestrian cross the road reset the state. [email protected] The First Project Visualizing the solution to test the program sequence 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 • Now doubleclicking the circle and set Variable>Change Color> “variable of light” Color>Inside> choose black Alarm 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. [email protected] The First Project Visualizing the solution to test the program sequence 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 • Now doubleclicking the circle and set Variable>Change Color> “variable of light” Color>Inside> choose black Alarm 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 can declare your image. [email protected] The First Project PLC SIMULATOR Step: Online> Simulation Compile application Online>Log In Download Toolbar Start •. Testing the application consists of debugging the operative modes [email protected] The First Project PLC SIMULATOR - Reset 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, 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. [email protected] 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. 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. [email protected] PLC Automazione Industriale Francesca Fanfoni [email protected]
Documenti analoghi
PLC 310 - CoDeSys: ambiente di sviluppo HW- indipendente
• Scegliere il linguaggio più adatto per ogni applicazione
• Utilizzare al meglio le tecniche di programmazione
Contenuti
Introduzione agli standard IEC 1131-3
• struttura dei programmi
• regole di...
Esercitazione in aula informatica - Automazione@ingre
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.
Informazioni di diagnostica nel protocollo CODESYS
In particolare sono stati preparati degli strumenti che possono facilitare l’esecuzione dell’operazione anche agli
eventuali utenti finali di un qualsiasi sistema già installato.