Software per Sistema automatico per la separazione delle materie plastiche

29
ITI G.M. Angioy Sassari Manuale software.odt Pagina 1 di 29 Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010 M Ma a n n u u a a l l e e d d u u s s o o e e m m a a n n u u t t e e n n z z i i o o n n e e d d e e l l s s o o f f t t w wa a r r e e d d i i g g e e s s t t i i o o n n e e S S i i s s t t e e m m a a a a u u t t o o m m a a t t i i c c o o p p e e r r l l a a s s e e p p a a r r a a z z i i o o n n e e d d e e l l l l e e m m a a t t e e r r i i e e p p l l a a s s t t i i c c h h e e Versione 1.0 del 18 Agosto 2010 Jacopo Sini

Transcript of Software per Sistema automatico per la separazione delle materie plastiche

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 1 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

MMMaaannnuuuaaallleee ddd’’’uuusssooo eee mmmaaannnuuuttteeennnzzziiiooonnneee dddeeelll sssoooffftttwwwaaarrreee dddiii gggeeessstttiiiooonnneee

SSSiiisssttteeemmmaaa aaauuutttooommmaaatttiiicccooo pppeeerrr lllaaa ssseeepppaaarrraaazzziiiooonnneee dddeeelllllleee mmmaaattteeerrriiieee ppplllaaassstttiiiccchhheee Versione 1.0 del 18 Agosto 2010

Jacopo Sini

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 2 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

SSSOOOMMMMMMAAARRRIIIOOO

Manuale d’uso e manutenzione del software di gestione .................................................................................. 1

Sistema automatico per la separazione delle materie plastiche ........................................................................ 1

Sommario ............................................................................................................................................................ 2

Scopo ................................................................................................................................................................... 3

Prerequisiti Hardware/Software ...................................................................................................................... 3

Descrizione firmware per arduino 2009 (microcontroller ATMega328) .................................................. 4

Codice sorgente firmware ............................................................................................................................. 4

Descrizione software interfaccia per arduino2009 ........................................................................................ 6

Classe OnOffDevices ................................................................................................................................... 6

Classe communication .................................................................................................................................. 9

Classe FormConduzione ............................................................................................................................ 12

Classe diagnostica ........................................................................................................................................ 25

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 3 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

SSSCCCOOOPPPOOO

In questa guida sono riportate le indicazioni per il corretto uso del sistema di telecomando del Sistema automatico per la separazione delle materie plastiche (di seguito SASMP).

PPPRRREEERRREEEQQQUUUIIISSSIIITTTIII HHHAAARRRDDDWWWAAARRREEE///SSSOOOFFFTTTWWWAAARRREEE

Hardware:

Porta USB 1.1

almeno 128 MB RAM

CPU almeno 600 MHz PC con installato:

Microsoft Windows XP (SP2) o versione successiva

Visual C# 2010 EE installato (o, nel caso non si vogliano apportare modifiche al software, almeno il .NET Framework 4.0)

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 4 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

DDDEEESSSCCCRRRIIIZZZIIIOOONNNEEE FFFIIIRRRMMMWWWAAARRREEE PPPEEERRR AAARRRDDDUUUIIINNNOOO 222000000999 (((MMMIIICCCRRROOOCCCOOONNNTTTRRROOOLLLLLLEEERRR AAATTTMMMEEEGGGAAA333222888)))

Il software è composto da un unico file presente nella cartella SW\Firmware conduzione e denominato firmwareSASMP.pde Tale software dovrebbe essere già preinstallato nella scheda Arduino situata all’interno della scatola marchiata Telecomando del sistema.

CODICE SORGENTE FIRMWARE //int block = 0;

void setup() {

// initialize the LED pin as an output:

pinMode(13, OUTPUT);

pinMode(12, OUTPUT);

pinMode(11, OUTPUT);

pinMode(10, OUTPUT);

pinMode(9, OUTPUT);

pinMode(8, OUTPUT);

pinMode(7, OUTPUT);

pinMode(6, OUTPUT);

//Set OFF the plant aux

digitalWrite(13,LOW);

digitalWrite(12, LOW);

digitalWrite(11, LOW);

digitalWrite(10, LOW);

digitalWrite(9,LOW);

digitalWrite(8, LOW);

digitalWrite(7, LOW);

digitalWrite(6, LOW);

//Start the serial connection

Serial.begin(115200);

}

void loop() {

if(Serial.available() > 0)

{

block = 0;

char val = Serial.read();

if (val=='A'){

digitalWrite(13, HIGH);

Serial.write("Confirmed\n");

}

if (val=='a'){

digitalWrite(13, LOW);

Serial.write("Confirmed\n");

}

if (val=='B'){

digitalWrite(12, HIGH);

Serial.write("Confirmed\n");

}

if (val=='b'){

digitalWrite(12, LOW);

Serial.write("Confirmed\n");

}

if (val=='C'){

digitalWrite(11, HIGH);

Serial.write("Confirmed\n");

}

if (val=='c'){

digitalWrite(11, LOW);

Serial.write("Confirmed\n");

}

if (val=='D'){

digitalWrite(10, HIGH);

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 5 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

Serial.write("Confirmed\n");

}

if (val=='d'){

digitalWrite(10, LOW);

Serial.write("Confirmed\n");

}

if (val=='E'){

digitalWrite(9, HIGH);

Serial.write("Confirmed\n");

}

if (val=='e'){

digitalWrite(9, LOW);

Serial.write("Confirmed\n");

}

if (val=='F'){

digitalWrite(8, HIGH);

Serial.write("Confirmed\n");

}

if (val=='f'){

digitalWrite(8, LOW);

Serial.write("Confirmed\n");

}

if (val=='G'){

digitalWrite(7, HIGH);

Serial.write("Confirmed\n");

}

if (val=='g'){

digitalWrite(7, LOW);

Serial.write("Confirmed\n");

}

if (val=='H'){

digitalWrite(6, HIGH);

Serial.write("Confirmed\n");

}

if (val=='h'){

digitalWrite(6, LOW);

Serial.write("Confirmed\n");

}

if ((val=='K')||(val=='k')){

Serial.write("OK\n");

}

}

/*else

{

block++;

}

if (block==32000)

{

digitalWrite(13,LOW);

digitalWrite(12, LOW);

digitalWrite(11, LOW);

digitalWrite(10, LOW);

digitalWrite(9,LOW);

digitalWrite(8, LOW);

digitalWrite(7, LOW);

digitalWrite(6, LOW);

block=0;

}*/

}

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 6 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

DDDEEESSSCCCRRRIIIZZZIIIOOONNNEEE SSSOOOFFFTTTWWWAAARRREEE IIINNNTTTEEERRRFFFAAACCCCCCIIIAAA PPPEEERRR AAARRRDDDUUUIIINNNOOO222000000999

Tale software, realizzato in C# (.Net Framework 4.0) ha lo scopo di offrire l’interfaccia uomo/macchina per il SASMP. Il programma è composto da quattro classi delle quali si mostra il codice sorgente (nel listato è segnalato da una casella rossa il punto nel quale è necessario impostare il nome della porta seriale associata all’Arduino duemilanove pilota del sistema).

CLASSE ONOFFDEVICES

La classe si occupa di idealizzare un dispositivo on-off incapsulando tutto il codice necessario ai fini del telecomando e dell’esposizione dello stato corrente del dispositivo che l’istanza intende rappresentare. Espone un costruttore con sette argomenti tutti obbligatori, due proprietà e due metodi:

Costrutture: per poter istanziare una classe OnOffDevices è necessario passargli nell’ordine i seguenti parametri:

o Communication COM: è l’istanza della classe che viene usata per comunicare con l’arduino corrispondente alla porta COM sulla quale quest’ultima è stata istanziata; nel nostro caso quindi quella facente riferimento all’Arduino al quale si trova fisicamente connesso l’attuatore del nostro dispositivo On-Off;

o char ComponenteIstruction: è il codice (composto di un unico carattere ASCII) corrispondente al pin al quale si trova fisicamente connesso il nostro dispositivo fisico. La corrispondenza fra numero di pin e carattere alfanumerico è il seguente:

# pin Arduino Codice software

13 ‘A’*

12 ‘B’*

11 ‘C’*

10 ‘D’*

9 ‘E’*

8 ‘F’*

7 ‘G’*

6 ‘H’*

*Tale parametro può essere indifferentemente passato sia in minuscolo che in maiuscolo

o PictureBox BottoneComando: indica su quale picturebox della form di conduzione è

necessario mostrare lo stato del dispositivo On-Off;

o ImageList ListaImmagini: indica l’elenco immagini nel quale sono presenti le immagini di stato del dispositivo relativo all’istanza che stiamo creando;

o string ImmagineON: indica il nome dell’immagine all’interno della suddetta ImageList

da mostrare sulla PictureBox BottoneComando quando lo stato del dispositivo è impostato su ON;

o string ImmagineOFF: indica il nome dell’immagine all’interno della suddetta ImageList

da mostrare sulla PictureBox BottoneComando quando lo stato del dispositivo è impostato su OFF;

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 7 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

o string ImmagineERRORE: indica il nome dell’immagine all’interno della suddetta

ImageList da mostrare sulla PictureBox BottoneComando quando il dispositivo è indisponibile o bloccato(cioè quando la proprietà Locked, che verrà successivamente analizzata è impostata su true);

Proprietà Locked:ottiene o imposta il blocco del dispositivo. Se impostata su true blocca il dispositivo nello stato corrente cioè l’istanza ignora, senza sollevare eccezioni l’invocazione dei metodi SetHigh() o SetLow() o la modifica della proprietà OFF;

Proprietà OFF: ottiene o imposta lo stato del dispositivo. Impostare la proprietà a true equivale ad invocare il metodo SetLow() mentre impostarla su false equivale a invocare il metodo SetHigh();

metodo SetLow(): imposta la tensione al pin corrispondente al dispositivo sull’arduino al livello basso (0 V);

metodo SetHigh(): imposta la tensione al pin corrispondente al dispositivo sull’arduino al livello alto (5V);

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Windows.Forms;

namespace ConduzioneSASMP

{

class OnOffDevices

{

Communication _arduino;

string _symbol;

string OnImage;

string OffImage;

string ErrorImage;

PictureBox Immagine;

ImageList Immagini;

bool locked = false;

bool off = true;

public bool Off

{

get

{

return off;

}

set

{

if (value) SetLow();

else SetHigh();

}

}

public bool Locked

{

set

{

locked = value;

if (locked)

{

Immagine.Image = Immagini.Images[ErrorImage];

}

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 8 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

else

{

if (off) Immagine.Image = Immagini.Images[OffImage];

else Immagine.Image = Immagini.Images[OnImage];

}

}

get

{

return locked;

}

}

public OnOffDevices(Communication COM, char ComponenteIstruction, PictureBox BottoneComando,

ImageList ListaImmagini,string ImmagineON, string ImmagineOFF, string ImmagineERRORE)

{

_arduino = COM;

_symbol = ComponenteIstruction.ToString();

OnImage = ImmagineON;

OffImage = ImmagineOFF;

ErrorImage = ImmagineERRORE;

Immagine = BottoneComando;

Immagini = ListaImmagini;

Immagine.Image = Immagini.Images[OffImage];

}

public void SetHigh()

{

if (!(locked))

{

string s = _symbol.ToUpper();

char istruction = s[0];

_arduino.SerialWrite(istruction);

Immagine.Image = Immagini.Images[OnImage];

off = false;

}

}

public void SetLow()

{

if (!(locked))

{

string s = _symbol.ToLower();

char istruction = s[0];

_arduino.SerialWrite(istruction);

Immagine.Image = Immagini.Images[OffImage];

off = true;

}

}

}

}

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 9 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

CLASSE COMMUNICATION

La classe si occupa della gestione della porta seriale per i fini necessari alle comunicazioni tra l’Arduino ed il PC.

Espone un costruttore con un argomento obbligatorio, una proprietà e tre metodi:

Costrutture: per poter istanziare una classe Communication è necessario passargli un unico parametro di tipo string con il nome della porta seriale logica utilizzata dall’arduino che si intende pilotare. È possibile conoscere tale nome tramite la finestra Gestione Dispositivi delle proprietà del sistema nel Pannello di Controllo.

Metodo bool SerialWrite(char Message): scrive sulla porta parallela passata come argomento al costruttore della classe il carattere passatogli come argomento. Nel caso tale scrittura vada a buon fine restituisce il valore booleano true, in caso contrario false.

Metodo string SerialRead(): legge la stringa presente sul buffer della porta parallela. In caso non sia presente alcun carattere da leggere restituisce la stringa vuota “” mentre nel caso non sia possibile la lettura restituisce la stringa “Error”.

Metodo bool verify(): verifica la corretta comunicazione con l’Arduino. In caso la comunicazione vada a buon fine restituisce true, in caso contrario restituisce false. A differenza dell’uso della proprietà check (di cui al punto successivo) però, attiva il led di corretta comunicazione presente sull’arduino (cioè il led contrassegnato dalla lettera L connesso al pin 13).

Proprietà bool check: verifica la corretta comunicazione con l’Arduino. In caso la comunicazione vada a buon fine restituisce true, in caso contrario restituisce false.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.IO.Ports;

using System.Threading;

namespace ConduzioneSASMP

{

public class Communication

{

SerialPort serialPort1 = new SerialPort();

public Communication(string portname)

{

//configuring the serial port to comunicate with Arduino Duemilanove

serialPort1.PortName = portname;

serialPort1.BaudRate = 115200;

serialPort1.DataBits = 8;

serialPort1.Parity = Parity.None;

//serialPort1.StopBits = StopBits.None;

serialPort1.Open();

}

bool CheckCOMConnection()

{

string data;

//opening the serial port

try

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 10 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

{

//write data to serial port

serialPort1.Write("k");

//Check the interface status

data = serialPort1.ReadLine();

if (data == "OK")

{

//close the port

return true;

}

else

{

//close the port

return false;

}

}

catch

{

return false;

}

}

public bool check

{

get

{

return CheckCOMConnection();

}

}

public bool SerialWrite(char Message)

{

try

{

if (!serialPort1.IsOpen)

{

serialPort1.Open();

}

serialPort1.Write(Message.ToString());

return true;

}

catch

{

return false;

}

}

public string SerialRead()

{

try

{

if (!serialPort1.IsOpen)

{

serialPort1.Open();

}

return serialPort1.ReadLine();

}

catch

{

return "Error";

}

}

public bool verify()

{

try

{

if (!(serialPort1.IsOpen))

{

serialPort1.Open();

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 11 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

}

serialPort1.Write("k");

serialPort1.Write("A");

return true;

}

catch

{

return false;/

}

}

}

}

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 12 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

CLASSE FORMCONDUZIONE

Figura 1 Aspetto grafico della classe ConduzioneSASMP

TELECOMANDO DI UN DISPOSITIVO Per telecomandare un dispositivo è sufficiente cliccare sull’immagine corrispondente con il tasto destro del mouse e scegliere dal menù contestuale lo stato in cui si desidera commutare il dispositivo. Nel caso tale stato possa essere raggiunto istantaneamente lo stato selezionato verrà immediatamente mostrato sullo schermo e sarà subito possibile impartire nuovi comandi al dispositivo mentre nel caso il raggiungimento di tale stato richieda del tempo o l’esecuzione di una sequenza verrà mostrato sul lato sinistro dell’icona relativa al dispositivo un timer con il tempo residuo in secondi (carattere nero) o il numero di passi necessari (carattere rosso) al raggiungimento dello stato richiesto. Per tutta la durata necessaria alla commutazione non sarà possibile telecomandare il dispositivo e verrà mostrato come bloccato. Nel caso si sia invece iniziata una sequenza e sia possibile annullarla, verrà mostrata in fondo al menù contestuale una nuova voce denominata ANNULLA SEQUENZA. Nel caso venga selezionata il dispositivo rimarrà comunque bloccato sino al completo ripristino dello stato precedente la selezione. I dispositivi telecomandabili ma bloccati o in avaria vengono mostrati in giallo mentre i dispositivi non telecomandabili vengono mostrati in bianco. Codice del designer namespace ConduzioneSASMP

{

partial class FormConduzione

{

/// <summary>

/// Variabile di progettazione necessaria.

/// </summary>

private System.ComponentModel.IContainer components = null;

/// <summary>

/// Liberare le risorse in uso.

/// </summary>

/// <param name="disposing">ha valore true se le risorse gestite devono essere eliminate,

false in caso contrario.</param>

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 13 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

protected override void Dispose(bool disposing)

{

if (disposing && (components != null))

{

components.Dispose();

}

base.Dispose(disposing);

}

#region Codice generato da Progettazione Windows Form

/// <summary>

/// Metodo necessario per il supporto della finestra di progettazione. Non modificare

/// il contenuto del metodo con l'editor di codice.

/// </summary>

private void InitializeComponent()

{

this.components = new System.ComponentModel.Container();

System.ComponentModel.ComponentResourceManager resources = new

System.ComponentModel.ComponentResourceManager(typeof(FormConduzione));

this.loopTimer = new System.Windows.Forms.Timer(this.components);

this.valve3way = new System.Windows.Forms.ImageList(this.components);

this.pump = new System.Windows.Forms.ImageList(this.components);

this.pump3Img = new System.Windows.Forms.PictureBox();

this.pumpMnu3 = new System.Windows.Forms.ContextMenuStrip(this.components);

this.pump3Marcia = new System.Windows.Forms.ToolStripMenuItem();

this.pump3Arresto = new System.Windows.Forms.ToolStripMenuItem();

this.pump4Img = new System.Windows.Forms.PictureBox();

this.pumpMnu4 = new System.Windows.Forms.ContextMenuStrip(this.components);

this.pump4Marcia = new System.Windows.Forms.ToolStripMenuItem();

this.pump4Arresto = new System.Windows.Forms.ToolStripMenuItem();

this.pump5Img = new System.Windows.Forms.PictureBox();

this.pumpMnu5 = new System.Windows.Forms.ContextMenuStrip(this.components);

this.pump5Marcia = new System.Windows.Forms.ToolStripMenuItem();

this.pump5Arresto = new System.Windows.Forms.ToolStripMenuItem();

this.pump2Img = new System.Windows.Forms.PictureBox();

this.pumpMnu2 = new System.Windows.Forms.ContextMenuStrip(this.components);

this.pump2Marcia = new System.Windows.Forms.ToolStripMenuItem();

this.pump2Arresto = new System.Windows.Forms.ToolStripMenuItem();

this.pump1Img = new System.Windows.Forms.PictureBox();

this.pumpMnu1 = new System.Windows.Forms.ContextMenuStrip(this.components);

this.pump1Marcia = new System.Windows.Forms.ToolStripMenuItem();

this.pump1Arresto = new System.Windows.Forms.ToolStripMenuItem();

this.valve1Img = new System.Windows.Forms.PictureBox();

this.valve1mnu = new System.Windows.Forms.ContextMenuStrip(this.components);

this.acquaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

this.acquaSaleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

this.label1 = new System.Windows.Forms.Label();

this.mainContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);

this.TopMostSelect = new System.Windows.Forms.ToolStripMenuItem();

this.esciToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

this.valve1DelayTimer = new System.Windows.Forms.Label();

this.Valve1Timer = new System.Windows.Forms.Timer(this.components);

this.panel1 = new System.Windows.Forms.Panel();

this.groupBox1 = new System.Windows.Forms.GroupBox();

this.execButton = new System.Windows.Forms.Button();

this.button2 = new System.Windows.Forms.Button();

this.button1 = new System.Windows.Forms.Button();

this.textBox1 = new System.Windows.Forms.TextBox();

this.label3 = new System.Windows.Forms.Label();

this.EnableButton = new System.Windows.Forms.CheckBox();

this.timeLabel = new System.Windows.Forms.Label();

this.dateLabel = new System.Windows.Forms.Label();

this.DateTimeTimer = new System.Windows.Forms.Timer(this.components);

((System.ComponentModel.ISupportInitialize)(this.pump3Img)).BeginInit();

this.pumpMnu3.SuspendLayout();

((System.ComponentModel.ISupportInitialize)(this.pump4Img)).BeginInit();

this.pumpMnu4.SuspendLayout();

((System.ComponentModel.ISupportInitialize)(this.pump5Img)).BeginInit();

this.pumpMnu5.SuspendLayout();

((System.ComponentModel.ISupportInitialize)(this.pump2Img)).BeginInit();

this.pumpMnu2.SuspendLayout();

((System.ComponentModel.ISupportInitialize)(this.pump1Img)).BeginInit();

this.pumpMnu1.SuspendLayout();

((System.ComponentModel.ISupportInitialize)(this.valve1Img)).BeginInit();

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 14 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

this.valve1mnu.SuspendLayout();

this.mainContextMenu.SuspendLayout();

this.panel1.SuspendLayout();

this.groupBox1.SuspendLayout();

this.SuspendLayout();

//

// loopTimer

//

this.loopTimer.Interval = 1000;

this.loopTimer.Tick += new System.EventHandler(this.timer1_Tick);

//

// valve3way

//

this.valve3way.ImageStream =

((System.Windows.Forms.ImageListStreamer)(resources.GetObject("valve3way.ImageStream")));

this.valve3way.TransparentColor = System.Drawing.Color.White;

this.valve3way.Images.SetKeyName(0, "left");

this.valve3way.Images.SetKeyName(1, "right");

this.valve3way.Images.SetKeyName(2, "error");

//

// pump

//

this.pump.ImageStream =

((System.Windows.Forms.ImageListStreamer)(resources.GetObject("pump.ImageStream")));

this.pump.TransparentColor = System.Drawing.Color.White;

this.pump.Images.SetKeyName(0, "off");

this.pump.Images.SetKeyName(1, "on");

this.pump.Images.SetKeyName(2, "error");

//

// pump3Img

//

this.pump3Img.Anchor = System.Windows.Forms.AnchorStyles.None;

this.pump3Img.ContextMenuStrip = this.pumpMnu3;

this.pump3Img.Location = new System.Drawing.Point(346, 420);

this.pump3Img.Name = "pump3Img";

this.pump3Img.Size = new System.Drawing.Size(49, 69);

this.pump3Img.TabIndex = 0;

this.pump3Img.TabStop = false;

this.pump3Img.MouseLeave += new System.EventHandler(this.MouseLeavePicture);

this.pump3Img.MouseMove += new

System.Windows.Forms.MouseEventHandler(this.MouseMovePicture);

//

// pumpMnu3

//

this.pumpMnu3.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {

this.pump3Marcia,

this.pump3Arresto});

this.pumpMnu3.Name = "valve1mnu";

this.pumpMnu3.Size = new System.Drawing.Size(125, 48);

//

// pump3Marcia

//

this.pump3Marcia.Image = global::ConduzioneSASMP.Properties.Resources.ONpump;

this.pump3Marcia.Name = "pump3Marcia";

this.pump3Marcia.Size = new System.Drawing.Size(124, 22);

this.pump3Marcia.Text = "MARCIA";

this.pump3Marcia.Click += new System.EventHandler(this.pump3Marcia_Click);

//

// pump3Arresto

//

this.pump3Arresto.Image = global::ConduzioneSASMP.Properties.Resources.OFFpump;

this.pump3Arresto.Name = "pump3Arresto";

this.pump3Arresto.Size = new System.Drawing.Size(124, 22);

this.pump3Arresto.Text = "ARRESTO";

this.pump3Arresto.Click += new System.EventHandler(this.pump3Arresto_Click);

//

// pump4Img

//

this.pump4Img.Anchor = System.Windows.Forms.AnchorStyles.None;

this.pump4Img.ContextMenuStrip = this.pumpMnu4;

this.pump4Img.Location = new System.Drawing.Point(556, 517);

this.pump4Img.Name = "pump4Img";

this.pump4Img.Size = new System.Drawing.Size(49, 69);

this.pump4Img.TabIndex = 1;

this.pump4Img.TabStop = false;

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 15 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

this.pump4Img.MouseLeave += new System.EventHandler(this.MouseLeavePicture);

this.pump4Img.MouseMove += new

System.Windows.Forms.MouseEventHandler(this.MouseMovePicture);

//

// pumpMnu4

//

this.pumpMnu4.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {

this.pump4Marcia,

this.pump4Arresto});

this.pumpMnu4.Name = "valve1mnu";

this.pumpMnu4.Size = new System.Drawing.Size(125, 48);

//

// pump4Marcia

//

this.pump4Marcia.Image = global::ConduzioneSASMP.Properties.Resources.ONpump;

this.pump4Marcia.Name = "pump4Marcia";

this.pump4Marcia.Size = new System.Drawing.Size(124, 22);

this.pump4Marcia.Text = "MARCIA";

this.pump4Marcia.Click += new System.EventHandler(this.pump4Marcia_Click);

//

// pump4Arresto

//

this.pump4Arresto.Image = global::ConduzioneSASMP.Properties.Resources.OFFpump;

this.pump4Arresto.Name = "pump4Arresto";

this.pump4Arresto.Size = new System.Drawing.Size(124, 22);

this.pump4Arresto.Text = "ARRESTO";

this.pump4Arresto.Click += new System.EventHandler(this.pump4Arresto_Click);

//

// pump5Img

//

this.pump5Img.Anchor = System.Windows.Forms.AnchorStyles.None;

this.pump5Img.ContextMenuStrip = this.pumpMnu5;

this.pump5Img.Location = new System.Drawing.Point(742, 606);

this.pump5Img.Name = "pump5Img";

this.pump5Img.Size = new System.Drawing.Size(49, 69);

this.pump5Img.TabIndex = 2;

this.pump5Img.TabStop = false;

this.pump5Img.MouseLeave += new System.EventHandler(this.MouseLeavePicture);

this.pump5Img.MouseMove += new

System.Windows.Forms.MouseEventHandler(this.MouseMovePicture);

//

// pumpMnu5

//

this.pumpMnu5.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {

this.pump5Marcia,

this.pump5Arresto});

this.pumpMnu5.Name = "valve1mnu";

this.pumpMnu5.Size = new System.Drawing.Size(153, 70);

//

// pump5Marcia

//

this.pump5Marcia.Image = global::ConduzioneSASMP.Properties.Resources.ONpump;

this.pump5Marcia.Name = "pump5Marcia";

this.pump5Marcia.Size = new System.Drawing.Size(152, 22);

this.pump5Marcia.Text = "MARCIA";

this.pump5Marcia.Click += new System.EventHandler(this.pump5Marcia_Click);

//

// pump5Arresto

//

this.pump5Arresto.Image = global::ConduzioneSASMP.Properties.Resources.OFFpump;

this.pump5Arresto.Name = "pump5Arresto";

this.pump5Arresto.Size = new System.Drawing.Size(152, 22);

this.pump5Arresto.Text = "ARRESTO";

this.pump5Arresto.Click += new System.EventHandler(this.pump5Arresto_Click);

//

// pump2Img

//

this.pump2Img.Anchor = System.Windows.Forms.AnchorStyles.None;

this.pump2Img.ContextMenuStrip = this.pumpMnu2;

this.pump2Img.Location = new System.Drawing.Point(225, 548);

this.pump2Img.Name = "pump2Img";

this.pump2Img.Size = new System.Drawing.Size(49, 69);

this.pump2Img.TabIndex = 3;

this.pump2Img.TabStop = false;

this.pump2Img.MouseEnter += new System.EventHandler(this.MouseMovePicture);

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 16 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

this.pump2Img.MouseLeave += new System.EventHandler(this.MouseLeavePicture);

//

// pumpMnu2

//

this.pumpMnu2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {

this.pump2Marcia,

this.pump2Arresto});

this.pumpMnu2.Name = "valve1mnu";

this.pumpMnu2.Size = new System.Drawing.Size(125, 48);

//

// pump2Marcia

//

this.pump2Marcia.Image = global::ConduzioneSASMP.Properties.Resources.ONpump;

this.pump2Marcia.Name = "pump2Marcia";

this.pump2Marcia.Size = new System.Drawing.Size(124, 22);

this.pump2Marcia.Text = "MARCIA";

this.pump2Marcia.Click += new System.EventHandler(this.pump2Marcia_Click);

//

// pump2Arresto

//

this.pump2Arresto.Image = global::ConduzioneSASMP.Properties.Resources.OFFpump;

this.pump2Arresto.Name = "pump2Arresto";

this.pump2Arresto.Size = new System.Drawing.Size(124, 22);

this.pump2Arresto.Text = "ARRESTO";

this.pump2Arresto.Click += new System.EventHandler(this.pump2Arresto_Click);

//

// pump1Img

//

this.pump1Img.Anchor = System.Windows.Forms.AnchorStyles.None;

this.pump1Img.ContextMenuStrip = this.pumpMnu1;

this.pump1Img.Location = new System.Drawing.Point(145, 547);

this.pump1Img.Name = "pump1Img";

this.pump1Img.Size = new System.Drawing.Size(49, 69);

this.pump1Img.TabIndex = 4;

this.pump1Img.TabStop = false;

this.pump1Img.MouseEnter += new System.EventHandler(this.MouseMovePicture);

this.pump1Img.MouseLeave += new System.EventHandler(this.MouseLeavePicture);

//

// pumpMnu1

//

this.pumpMnu1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {

this.pump1Marcia,

this.pump1Arresto});

this.pumpMnu1.Name = "valve1mnu";

this.pumpMnu1.Size = new System.Drawing.Size(125, 48);

this.pumpMnu1.Opening += new

System.ComponentModel.CancelEventHandler(this.pumpMnu1_Opening);

//

// pump1Marcia

//

this.pump1Marcia.Image = global::ConduzioneSASMP.Properties.Resources.ONpump;

this.pump1Marcia.Name = "pump1Marcia";

this.pump1Marcia.Size = new System.Drawing.Size(152, 22);

this.pump1Marcia.Text = "MARCIA";

this.pump1Marcia.Click += new System.EventHandler(this.pump1Marcia_Click);

//

// pump1Arresto

//

this.pump1Arresto.Image = global::ConduzioneSASMP.Properties.Resources.OFFpump;

this.pump1Arresto.Name = "pump1Arresto";

this.pump1Arresto.Size = new System.Drawing.Size(152, 22);

this.pump1Arresto.Text = "ARRESTO";

this.pump1Arresto.Click += new System.EventHandler(this.pump1Arresto_Click);

//

// valve1Img

//

this.valve1Img.Anchor = System.Windows.Forms.AnchorStyles.None;

this.valve1Img.ContextMenuStrip = this.valve1mnu;

this.valve1Img.Location = new System.Drawing.Point(182, 429);

this.valve1Img.Name = "valve1Img";

this.valve1Img.Size = new System.Drawing.Size(89, 67);

this.valve1Img.TabIndex = 5;

this.valve1Img.TabStop = false;

this.valve1Img.MouseLeave += new System.EventHandler(this.MouseLeavePicture);

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 17 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

this.valve1Img.MouseMove += new

System.Windows.Forms.MouseEventHandler(this.MouseMovePicture);

//

// valve1mnu

//

this.valve1mnu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {

this.acquaToolStripMenuItem,

this.acquaSaleToolStripMenuItem});

this.valve1mnu.Name = "valve1mnu";

this.valve1mnu.Size = new System.Drawing.Size(144, 48);

//

// acquaToolStripMenuItem

//

this.acquaToolStripMenuItem.Image =

global::ConduzioneSASMP.Properties.Resources.left3wayvalve;

this.acquaToolStripMenuItem.Name = "acquaToolStripMenuItem";

this.acquaToolStripMenuItem.Size = new System.Drawing.Size(143, 22);

this.acquaToolStripMenuItem.Text = "Acqua";

this.acquaToolStripMenuItem.Click += new

System.EventHandler(this.acquaToolStripMenuItem_Click);

//

// acquaSaleToolStripMenuItem

//

this.acquaSaleToolStripMenuItem.Image =

global::ConduzioneSASMP.Properties.Resources.right3wayvalve;

this.acquaSaleToolStripMenuItem.Name = "acquaSaleToolStripMenuItem";

this.acquaSaleToolStripMenuItem.Size = new System.Drawing.Size(143, 22);

this.acquaSaleToolStripMenuItem.Text = "Acqua + Sale";

this.acquaSaleToolStripMenuItem.Click += new

System.EventHandler(this.acquaSaleToolStripMenuItem_Click);

//

// label1

//

this.label1.BackColor = System.Drawing.Color.DarkBlue;

this.label1.ContextMenuStrip = this.mainContextMenu;

this.label1.Dock = System.Windows.Forms.DockStyle.Top;

this.label1.Font = new System.Drawing.Font("Arial", 14.25F,

System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

this.label1.ForeColor = System.Drawing.Color.White;

this.label1.Location = new System.Drawing.Point(0, 0);

this.label1.Name = "label1";

this.label1.Size = new System.Drawing.Size(1024, 31);

this.label1.TabIndex = 7;

this.label1.Text = "SISTEMA AUTOMATICO PER LA SEPARAZIONE DELLE MATERIE PLASTICHE";

this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;

//

// mainContextMenu

//

this.mainContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {

this.TopMostSelect,

this.esciToolStripMenuItem});

this.mainContextMenu.Name = "mainContextMenu";

this.mainContextMenu.Size = new System.Drawing.Size(196, 48);

//

// TopMostSelect

//

this.TopMostSelect.Checked = true;

this.TopMostSelect.CheckState = System.Windows.Forms.CheckState.Checked;

this.TopMostSelect.Name = "TopMostSelect";

this.TopMostSelect.Size = new System.Drawing.Size(195, 22);

this.TopMostSelect.Text = "Sempre in primo piano";

this.TopMostSelect.Click += new System.EventHandler(this.TopMostSelect_Click);

//

// esciToolStripMenuItem

//

this.esciToolStripMenuItem.Name = "esciToolStripMenuItem";

this.esciToolStripMenuItem.Size = new System.Drawing.Size(195, 22);

this.esciToolStripMenuItem.Text = "Esci";

this.esciToolStripMenuItem.Click += new

System.EventHandler(this.esciToolStripMenuItem_Click_1);

//

// valve1DelayTimer

//

this.valve1DelayTimer.Anchor = System.Windows.Forms.AnchorStyles.None;

this.valve1DelayTimer.AutoSize = true;

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 18 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

this.valve1DelayTimer.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F,

System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

this.valve1DelayTimer.Location = new System.Drawing.Point(277, 429);

this.valve1DelayTimer.Name = "valve1DelayTimer";

this.valve1DelayTimer.Size = new System.Drawing.Size(24, 16);

this.valve1DelayTimer.TabIndex = 8;

this.valve1DelayTimer.Text = "60";

this.valve1DelayTimer.Visible = false;

//

// Valve1Timer

//

this.Valve1Timer.Interval = 1000;

this.Valve1Timer.Tick += new System.EventHandler(this.Valve1Timer_Tick);

//

// panel1

//

this.panel1.BackColor = System.Drawing.SystemColors.Control;

this.panel1.Controls.Add(this.groupBox1);

this.panel1.Controls.Add(this.timeLabel);

this.panel1.Controls.Add(this.dateLabel);

this.panel1.Dock = System.Windows.Forms.DockStyle.Top;

this.panel1.Location = new System.Drawing.Point(0, 31);

this.panel1.Name = "panel1";

this.panel1.Size = new System.Drawing.Size(1024, 82);

this.panel1.TabIndex = 9;

//

// groupBox1

//

this.groupBox1.Anchor = System.Windows.Forms.AnchorStyles.Top;

this.groupBox1.Controls.Add(this.execButton);

this.groupBox1.Controls.Add(this.button2);

this.groupBox1.Controls.Add(this.button1);

this.groupBox1.Controls.Add(this.textBox1);

this.groupBox1.Controls.Add(this.label3);

this.groupBox1.Controls.Add(this.EnableButton);

this.groupBox1.Location = new System.Drawing.Point(13, 12);

this.groupBox1.Name = "groupBox1";

this.groupBox1.Size = new System.Drawing.Size(850, 56);

this.groupBox1.TabIndex = 2;

this.groupBox1.TabStop = false;

this.groupBox1.Text = "Conduzione assistita";

//

// execButton

//

this.execButton.Anchor = System.Windows.Forms.AnchorStyles.Top;

this.execButton.Enabled = false;

this.execButton.Location = new System.Drawing.Point(760, 19);

this.execButton.Name = "execButton";

this.execButton.Size = new System.Drawing.Size(75, 23);

this.execButton.TabIndex = 5;

this.execButton.Text = "ESEGUI";

this.execButton.UseVisualStyleBackColor = true;

//

// button2

//

this.button2.Anchor = System.Windows.Forms.AnchorStyles.Top;

this.button2.Enabled = false;

this.button2.Location = new System.Drawing.Point(613, 21);

this.button2.Name = "button2";

this.button2.Size = new System.Drawing.Size(75, 23);

this.button2.TabIndex = 4;

this.button2.Text = "Successivo";

this.button2.UseVisualStyleBackColor = true;

//

// button1

//

this.button1.Anchor = System.Windows.Forms.AnchorStyles.Top;

this.button1.Enabled = false;

this.button1.Location = new System.Drawing.Point(532, 21);

this.button1.Name = "button1";

this.button1.Size = new System.Drawing.Size(75, 23);

this.button1.TabIndex = 3;

this.button1.Text = "Precedente";

this.button1.UseVisualStyleBackColor = true;

//

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 19 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

// textBox1

//

this.textBox1.Location = new System.Drawing.Point(172, 23);

this.textBox1.Name = "textBox1";

this.textBox1.ReadOnly = true;

this.textBox1.Size = new System.Drawing.Size(344, 20);

this.textBox1.TabIndex = 2;

this.textBox1.Text = "UNKNOWN";

//

// label3

//

this.label3.AutoSize = true;

this.label3.Location = new System.Drawing.Point(103, 26);

this.label3.Name = "label3";

this.label3.Size = new System.Drawing.Size(69, 13);

this.label3.TabIndex = 1;

this.label3.Text = "Nome passo:";

//

// EnableButton

//

this.EnableButton.AutoSize = true;

this.EnableButton.Enabled = false;

this.EnableButton.Location = new System.Drawing.Point(14, 25);

this.EnableButton.Name = "EnableButton";

this.EnableButton.Size = new System.Drawing.Size(66, 17);

this.EnableButton.TabIndex = 0;

this.EnableButton.Text = "ABILITA";

this.EnableButton.UseVisualStyleBackColor = true;

//

// timeLabel

//

this.timeLabel.Anchor =

((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top |

System.Windows.Forms.AnchorStyles.Right)));

this.timeLabel.AutoSize = true;

this.timeLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F,

System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

this.timeLabel.ForeColor = System.Drawing.SystemColors.ControlText;

this.timeLabel.Location = new System.Drawing.Point(881, 12);

this.timeLabel.Name = "timeLabel";

this.timeLabel.Size = new System.Drawing.Size(127, 33);

this.timeLabel.TabIndex = 1;

this.timeLabel.Text = "##:##:##";

//

// dateLabel

//

this.dateLabel.Anchor =

((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top |

System.Windows.Forms.AnchorStyles.Right)));

this.dateLabel.AutoSize = true;

this.dateLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F,

System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

this.dateLabel.Location = new System.Drawing.Point(898, 48);

this.dateLabel.Name = "dateLabel";

this.dateLabel.Size = new System.Drawing.Size(89, 20);

this.dateLabel.TabIndex = 0;

this.dateLabel.Text = "##/##/####";

//

// DateTimeTimer

//

this.DateTimeTimer.Enabled = true;

this.DateTimeTimer.Interval = 1000;

this.DateTimeTimer.Tick += new System.EventHandler(this.DateTimeTimer_Tick);

//

// FormConduzione

//

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

this.BackColor = System.Drawing.Color.White;

this.BackgroundImage = global::ConduzioneSASMP.Properties.Resources.Sinottico;

this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;

this.ClientSize = new System.Drawing.Size(1024, 768);

this.ContextMenuStrip = this.mainContextMenu;

this.Controls.Add(this.panel1);

this.Controls.Add(this.valve1DelayTimer);

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 20 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

this.Controls.Add(this.label1);

this.Controls.Add(this.valve1Img);

this.Controls.Add(this.pump1Img);

this.Controls.Add(this.pump2Img);

this.Controls.Add(this.pump5Img);

this.Controls.Add(this.pump4Img);

this.Controls.Add(this.pump3Img);

this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

this.MaximizeBox = false;

this.Name = "FormConduzione";

this.Text = "Conduzione- Sistema automatico per la separazione delle materie plastiche";

this.WindowState = System.Windows.Forms.FormWindowState.Maximized;

this.Load += new System.EventHandler(this.Form1_Load);

((System.ComponentModel.ISupportInitialize)(this.pump3Img)).EndInit();

this.pumpMnu3.ResumeLayout(false);

((System.ComponentModel.ISupportInitialize)(this.pump4Img)).EndInit();

this.pumpMnu4.ResumeLayout(false);

((System.ComponentModel.ISupportInitialize)(this.pump5Img)).EndInit();

this.pumpMnu5.ResumeLayout(false);

((System.ComponentModel.ISupportInitialize)(this.pump2Img)).EndInit();

this.pumpMnu2.ResumeLayout(false);

((System.ComponentModel.ISupportInitialize)(this.pump1Img)).EndInit();

this.pumpMnu1.ResumeLayout(false);

((System.ComponentModel.ISupportInitialize)(this.valve1Img)).EndInit();

this.valve1mnu.ResumeLayout(false);

this.mainContextMenu.ResumeLayout(false);

this.panel1.ResumeLayout(false);

this.panel1.PerformLayout();

this.groupBox1.ResumeLayout(false);

this.groupBox1.PerformLayout();

this.ResumeLayout(false);

this.PerformLayout();

}

#endregion

public System.Windows.Forms.Timer loopTimer;

private System.Windows.Forms.ImageList pump;

private System.Windows.Forms.PictureBox pump3Img;

private System.Windows.Forms.PictureBox pump4Img;

private System.Windows.Forms.PictureBox pump5Img;

private System.Windows.Forms.PictureBox pump2Img;

private System.Windows.Forms.PictureBox pump1Img;

private System.Windows.Forms.PictureBox valve1Img;

private System.Windows.Forms.Label label1;

private System.Windows.Forms.ContextMenuStrip mainContextMenu;

private System.Windows.Forms.ToolStripMenuItem TopMostSelect;

private System.Windows.Forms.ToolStripMenuItem esciToolStripMenuItem;

private System.Windows.Forms.ImageList valve3way;

private System.Windows.Forms.ContextMenuStrip valve1mnu;

private System.Windows.Forms.ToolStripMenuItem acquaToolStripMenuItem;

private System.Windows.Forms.ToolStripMenuItem acquaSaleToolStripMenuItem;

private System.Windows.Forms.ContextMenuStrip pumpMnu1;

private System.Windows.Forms.ToolStripMenuItem pump1Marcia;

private System.Windows.Forms.ToolStripMenuItem pump1Arresto;

private System.Windows.Forms.ContextMenuStrip pumpMnu3;

private System.Windows.Forms.ToolStripMenuItem pump3Marcia;

private System.Windows.Forms.ToolStripMenuItem pump3Arresto;

private System.Windows.Forms.ContextMenuStrip pumpMnu4;

private System.Windows.Forms.ToolStripMenuItem pump4Marcia;

private System.Windows.Forms.ToolStripMenuItem pump4Arresto;

private System.Windows.Forms.ContextMenuStrip pumpMnu5;

private System.Windows.Forms.ToolStripMenuItem pump5Marcia;

private System.Windows.Forms.ToolStripMenuItem pump5Arresto;

private System.Windows.Forms.ContextMenuStrip pumpMnu2;

private System.Windows.Forms.ToolStripMenuItem pump2Marcia;

private System.Windows.Forms.ToolStripMenuItem pump2Arresto;

private System.Windows.Forms.Label valve1DelayTimer;

private System.Windows.Forms.Timer Valve1Timer;

private System.Windows.Forms.Panel panel1;

private System.Windows.Forms.Label timeLabel;

private System.Windows.Forms.Label dateLabel;

private System.Windows.Forms.Timer DateTimeTimer;

private System.Windows.Forms.GroupBox groupBox1;

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 21 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

private System.Windows.Forms.Button execButton;

private System.Windows.Forms.Button button2;

private System.Windows.Forms.Button button1;

private System.Windows.Forms.TextBox textBox1;

private System.Windows.Forms.Label label3;

private System.Windows.Forms.CheckBox EnableButton;

}

}

Codice event-handled using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO.Ports; using System.Threading;

namespace ConduzioneSASMP {

public partial class FormConduzione : Form {

//Buffer of instruction System.Collections.Generic.List<char> Istruzioni = new Sys-

tem.Collections.Generic.List<char>();

//Plant functionals variable int wait = 0; int valve1TimerVal = 60;

//Plant object OnOffDevices pump1; OnOffDevices pump2; OnOffDevices pump3; OnOffDevices pump4; OnOffDevices pump5; OnOffDevices valve1;

//Plant comunication variable public Communication com;

//Inizio codice eseguibile form public FormConduzione() {

InitializeComponent();

//Inizializzazione porta seriale com = new Communication("COM5"); }

private void Form1_Load(object sender, EventArgs e) { Diagnostica d = new Diagnostica(this); this.Visible = false; d.ShowDialog();

//Inizializzazione oggetti impianto pump1 = new OnOffDevices(com, 'B', pump1Img, pump, "on", "off", "error"); pump2 = new OnOffDevices(com, 'C', pump2Img, pump, "on", "off", "error"); pump3 = new OnOffDevices(com, 'E', pump3Img, pump, "on", "off", "error"); pump4 = new OnOffDevices(com, 'D', pump4Img, pump, "on", "off", "error"); pump5 = new OnOffDevices(com, 'F', pump5Img, pump, "on", "off", "error"); valve1 = new OnOffDevices(com, 'G', valve1Img, valve3way, "right", "left", "error"); /*Per l'oggetto valvola a tre vie valve1 * lo stato dato da SetLow() indica lo scarico verso il serbatoio acqua (valvola mo-

strata aperta a sinistra) * lo stato dato da SetLow() indica lo scarico verso il serbatoio acqua+sale (valvo-

la mostrata aperta a destra) * e dopo una modifica di stato devono rimanere bloccati per i successivi 60 secondi

gli oggetti

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 22 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

* - pump1 * - pump2 * - valve1 */

//Impostazione degli stati predefiniti pump1.SetLow(); pump2.SetLow();

pump2.Locked = true; pump3.SetLow();

pump4.SetLow();

pump5.SetLow();

valve1.SetLow();

}

private void timer1_Tick(object sender, EventArgs e) {

if (Istruzioni.Count > 0) {

foreach (char s in Istruzioni) {

if(!(com.SerialWrite(s))) {

wait++;

loopTimer.Enabled = false; DateTimeTimer.Enabled = false; MessageBox.Show("Errore di comunicazione con il sistema di separazione delle

materie plastiche\nIl programma di conduzione verrà chiuso", "Errore di comunicazione", MessageBo-

xButtons.OK, MessageBoxIcon.Error); Application.Exit(); }

}

}

/*else { if (!(com.verify())) { loopTimer.Enabled = false; MessageBox.Show("Errore di comunicazione con il sistema di separazione delle ma-

terie plastiche\nIl programma di conduzione verrà chiuso", "Errore di comunicazione", MessageBoxBut-

tons.OK, MessageBoxIcon.Error); Application.Exit(); } }*/ }

private void esciToolStripMenuItem_Click(object sender, EventArgs e) {

Application.Exit(); }

private void esciToolStripMenuItem_Click_1(object sender, EventArgs e) {

Application.Exit(); }

private void TopMostSelect_Click(object sender, EventArgs e) {

if (TopMostSelect.Checked) this.TopMost = !(TopMostSelect.Checked); TopMostSelect.Checked = !(TopMostSelect.Checked);

}

private void MouseLeavePicture(object sender, MouseEventArgs e) {

PictureBox s = (PictureBox)sender; s.BorderStyle = BorderStyle.None; Point p = new Point(s.Location.X + 1, s.Location.Y + 1); s.Location = p;

}

private void MouseLeavePicture(object sender, EventArgs e) {

PictureBox s = (PictureBox)sender; s.BorderStyle = BorderStyle.None; //Point p = new Point(s.Location.X + 1, s.Location.Y + 1);

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 23 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

//s.Location = p; }

private void MouseMovePicture(object sender, EventArgs e) {

PictureBox s = (PictureBox)sender; s.BorderStyle = BorderStyle.FixedSingle; //Point p = new Point(s.Location.X - 1, s.Location.Y - 1); //s.Location = p; }

//Codice per la gestione della valvola a 3 vie private void acquaToolStripMenuItem_Click(object sender, EventArgs e) {

if (valve1.Off == false) {

if (!valve1.Locked) { //resetta il timer di attesa per movimento valvola this.valve1TimerVal = 60; valve1.SetLow();

valve1.Locked = true; //Spegne e disabilita la pompa 1 pump1.SetLow(); pump1.Locked = true; //Spegne e disabilita la pompa 2 pump2.SetLow(); pump2.Locked = true;

int valve1TimerVal = 60; Valve1Timer.Enabled = true; valve1DelayTimer.Visible = true; }

}

}

private void acquaSaleToolStripMenuItem_Click(object sender, EventArgs e) {

if (valve1.Off == true) {

if (!valve1.Locked) { //resetta il timer di attesa per movimento valvola this.valve1TimerVal = 60; valve1.SetHigh();

valve1.Locked = true; //Spegne e disabilita la pompa 1 pump1.SetLow(); pump1.Locked = true; //Spegne e disabilita la pompa 2 pump2.SetLow(); pump2.Locked = true;

int valve1TimerVal = 60; Valve1Timer.Enabled = true; valve1DelayTimer.Visible = true; }

}

}

private void Valve1Timer_Tick(object sender, EventArgs e) {

valve1TimerVal--;

valve1DelayTimer.Text = valve1TimerVal.ToString();

if (valve1TimerVal == 0) {

valve1.Locked = false; valve1DelayTimer.Visible = false; //Riabilita la pompa 1 if(valve1.Off)pump1.Locked = false; //Riabilita la pompa 2 else pump2.Locked = false; }

}

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 24 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

private void pump1Marcia_Click(object sender, EventArgs e) {

pump1.SetHigh();

}

private void pump1Arresto_Click(object sender, EventArgs e) {

pump1.SetLow();

}

private void pump2Marcia_Click(object sender, EventArgs e) {

pump2.SetHigh();

}

private void pump2Arresto_Click(object sender, EventArgs e) {

pump2.SetLow();

}

private void pump3Marcia_Click(object sender, EventArgs e) {

pump3.SetHigh();

}

private void pump3Arresto_Click(object sender, EventArgs e) {

pump3.SetLow();

}

private void pump4Marcia_Click(object sender, EventArgs e) {

pump4.SetHigh();

pump5.SetHigh();

}

private void pump4Arresto_Click(object sender, EventArgs e) {

pump4.SetLow();

pump5.SetLow();

}

private void pump5Marcia_Click(object sender, EventArgs e) {

pump5.SetHigh();

pump4.SetHigh();

}

private void pump5Arresto_Click(object sender, EventArgs e) {

pump5.SetLow();

pump4.SetLow();

}

private void DateTimeTimer_Tick(object sender, EventArgs e) {

string minute; if(System.DateTime.Now.Minute>9) minute = System.DateTime.Now.Minute.ToString(); else minute = "0"+ System.DateTime.Now.Minute; string second; if (System.DateTime.Now.Second > 9) second = System.DateTime.Now.Second.ToString(); else second = "0" + System.DateTime.Now.Second; timeLabel.Text = System.DateTime.Now.Hour + ":"+ minute + ":" + second; dateLabel.Text = System.DateTime.Now.Date.ToShortDateString(); }

private void pumpMnu1_Opening(object sender, CancelEventArgs e) {

}

}

}

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 25 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

CLASSE DIAGNOSTICA

Figura 2 Aspetto grafico della classe Form Diagnostica

Codice designer namespace ConduzioneSASMP

{

partial class Diagnostica

{

/// <summary>

/// Variabile di progettazione necessaria.

/// </summary>

private System.ComponentModel.IContainer components = null;

/// <summary>

/// Liberare le risorse in uso.

/// </summary>

/// <param name="disposing">ha valore true se le risorse gestite devono essere eliminate,

false in caso contrario.</param>

protected override void Dispose(bool disposing)

{

if (disposing && (components != null))

{

components.Dispose();

}

base.Dispose(disposing);

}

#region Codice generato da Progettazione Windows Form

/// <summary>

/// Metodo necessario per il supporto della finestra di progettazione. Non modificare

/// il contenuto del metodo con l'editor di codice.

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 26 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

/// </summary>

private void InitializeComponent()

{

this.groupBox1 = new System.Windows.Forms.GroupBox();

this.checkBox3 = new System.Windows.Forms.CheckBox();

this.checkBox2 = new System.Windows.Forms.CheckBox();

this.checkBox1 = new System.Windows.Forms.CheckBox();

this.label1 = new System.Windows.Forms.Label();

this.label2 = new System.Windows.Forms.Label();

this.label3 = new System.Windows.Forms.Label();

this.button1 = new System.Windows.Forms.Button();

this.button2 = new System.Windows.Forms.Button();

this.groupBox1.SuspendLayout();

this.SuspendLayout();

//

// groupBox1

//

this.groupBox1.Controls.Add(this.checkBox3);

this.groupBox1.Controls.Add(this.checkBox2);

this.groupBox1.Controls.Add(this.checkBox1);

this.groupBox1.Location = new System.Drawing.Point(12, 172);

this.groupBox1.Name = "groupBox1";

this.groupBox1.Size = new System.Drawing.Size(760, 113);

this.groupBox1.TabIndex = 0;

this.groupBox1.TabStop = false;

this.groupBox1.Text = "Diagnostica sistema di automazione";

//

// checkBox3

//

this.checkBox3.AutoSize = true;

this.checkBox3.Enabled = false;

this.checkBox3.Location = new System.Drawing.Point(15, 76);

this.checkBox3.Name = "checkBox3";

this.checkBox3.Size = new System.Drawing.Size(118, 17);

this.checkBox3.TabIndex = 2;

this.checkBox3.Text = "Database parametri";

this.checkBox3.UseVisualStyleBackColor = true;

//

// checkBox2

//

this.checkBox2.AutoSize = true;

this.checkBox2.Enabled = false;

this.checkBox2.Location = new System.Drawing.Point(15, 53);

this.checkBox2.Name = "checkBox2";

this.checkBox2.Size = new System.Drawing.Size(99, 17);

this.checkBox2.TabIndex = 1;

this.checkBox2.Text = "Database trend";

this.checkBox2.UseVisualStyleBackColor = true;

//

// checkBox1

//

this.checkBox1.AutoSize = true;

this.checkBox1.Enabled = false;

this.checkBox1.Location = new System.Drawing.Point(15, 30);

this.checkBox1.Name = "checkBox1";

this.checkBox1.Size = new System.Drawing.Size(141, 17);

this.checkBox1.TabIndex = 0;

this.checkBox1.Text = "Collegamento a impianto";

this.checkBox1.UseVisualStyleBackColor = true;

//

// label1

//

this.label1.AutoSize = true;

this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F,

System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

this.label1.Location = new System.Drawing.Point(6, 71);

this.label1.Name = "label1";

this.label1.Size = new System.Drawing.Size(757, 31);

this.label1.TabIndex = 1;

this.label1.Text = "Sistema automatico per la separazione delle materie plastiche";

//

// label2

//

this.label2.AutoSize = true;

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 27 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 27.75F,

System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

this.label2.Location = new System.Drawing.Point(43, 9);

this.label2.Name = "label2";

this.label2.Size = new System.Drawing.Size(335, 42);

this.label2.TabIndex = 2;

this.label2.Text = "Software operatore";

//

// label3

//

this.label3.AutoSize = true;

this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F,

System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

this.label3.Location = new System.Drawing.Point(59, 115);

this.label3.Name = "label3";

this.label3.Size = new System.Drawing.Size(417, 29);

this.label3.TabIndex = 3;

this.label3.Text = "Verifica funzionalità sistema in corso...";

//

// button1

//

this.button1.Location = new System.Drawing.Point(697, 291);

this.button1.Name = "button1";

this.button1.Size = new System.Drawing.Size(75, 23);

this.button1.TabIndex = 4;

this.button1.Text = "Aggiorna";

this.button1.UseVisualStyleBackColor = true;

this.button1.Click += new System.EventHandler(this.button1_Click);

//

// button2

//

this.button2.Enabled = false;

this.button2.Location = new System.Drawing.Point(697, 527);

this.button2.Name = "button2";

this.button2.Size = new System.Drawing.Size(75, 23);

this.button2.TabIndex = 5;

this.button2.Text = "Conduzione";

this.button2.UseVisualStyleBackColor = true;

this.button2.Click += new System.EventHandler(this.button2_Click);

//

// Diagnostica

//

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

this.ClientSize = new System.Drawing.Size(784, 562);

this.Controls.Add(this.button2);

this.Controls.Add(this.button1);

this.Controls.Add(this.label3);

this.Controls.Add(this.label2);

this.Controls.Add(this.label1);

this.Controls.Add(this.groupBox1);

this.MaximumSize = new System.Drawing.Size(800, 600);

this.MinimumSize = new System.Drawing.Size(800, 600);

this.Name = "Diagnostica";

this.Text = "Diagnostica";

this.TopMost = true;

this.Load += new System.EventHandler(this.Diagnostica_Load);

this.groupBox1.ResumeLayout(false);

this.groupBox1.PerformLayout();

this.ResumeLayout(false);

this.PerformLayout();

}

#endregion

private System.Windows.Forms.GroupBox groupBox1;

private System.Windows.Forms.CheckBox checkBox3;

private System.Windows.Forms.CheckBox checkBox2;

private System.Windows.Forms.CheckBox checkBox1;

private System.Windows.Forms.Label label1;

private System.Windows.Forms.Label label2;

private System.Windows.Forms.Label label3;

private System.Windows.Forms.Button button1;

private System.Windows.Forms.Button button2;

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 28 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

}

}

Codice event-handled namespace ConduzioneSASMP

{

public partial class Diagnostica : Form

{

FormConduzione FormPadre;

public Diagnostica(FormConduzione p)

{

InitializeComponent();

this.FormPadre = p;

}

private void Diagnostica_Load(object sender, EventArgs e)

{

//checkBox1.Checked = CheckCOMConnection();

}

bool CheckCOMConnection()

{

string data;

SerialPort serialPort1 = new SerialPort();

//configuring the serial port

serialPort1.PortName = "COM3";

serialPort1.BaudRate = 115200;

serialPort1.DataBits = 8;

serialPort1.Parity = Parity.None;

serialPort1.StopBits = StopBits.One;

//opening the serial port

try

{

serialPort1.Open();

//write data to serial port

serialPort1.Write("k");

//Check the interface status

data = serialPort1.ReadLine();

if (data == "OK")

{

//close the port

serialPort1.Close();

return true;

}

else

{

//close the port

serialPort1.Close();

return false;

}

}

catch

{

MessageBox.Show("Errore di comunicazione con il sistema di separazione delle materie

plastiche\nIl programma di conduzione verrà chiuso", "Errore di comunicazione",

MessageBoxButtons.OK, MessageBoxIcon.Error);

Application.Exit();

return false;

}

}

private void button1_Click(object sender, EventArgs e)

{

checkBox1.Checked = FormPadre.com.verify();

button2.Enabled = true;

}

private void button2_Click(object sender, EventArgs e)

{

ITI G.M. Angioy Sassari

Manuale software.odt

Pagina 29 di 29

Autore:Jacopo Sini Stampato: 23/08/2010 Creato: 18/08/2010

FormPadre.loopTimer.Enabled = true;

FormPadre.Visible = true;

this.Close();

this.Dispose();

}

}

}