source: branches/gui/sample/controllers/sample_tanks_pid.mso @ 735

Last change on this file since 735 was 735, checked in by gerson bicca, 13 years ago

updates (some samples are obsoletes)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.1 KB
RevLine 
[84]1#*-------------------------------------------------------------------
2* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
[1]3*
[84]4* This LIBRARY is free software; you can distribute it and/or modify
5* it under the therms of the ALSOC FREE LICENSE as available at
6* http://www.enq.ufrgs.br/alsoc.
[1]7*
[84]8* EMSO Copyright (C) 2004 - 2007 ALSOC, original code
9* from http://www.rps.eng.br Copyright (C) 2002-2004.
10* All rights reserved.
[1]11*
[84]12* EMSO is distributed under the therms of the ALSOC LICENSE as
13* available at http://www.enq.ufrgs.br/alsoc.
[1]14*
[84]15*
16*-------------------------------------------------------------------
17* Sample file for tanks level control
18*
19*-------------------------------------------------------------------
20* Author: Tiago Osório
21* $Id: sample_tanks_pid.mso 735 2009-02-27 02:00:39Z bicca $
[735]22*-----------------------------------------------------------------#
[1]23
24using "tanksmodel";
[7]25using "controllers/PIDs";
[1]26using "controllers/PIDIncr";
27
28
29FlowSheet Tanque_inc
30        DEVICES
31        Tanque1 as tank;
[295]32        PIDc     as PIDIncr;
[1]33       
34        PARAMETERS     
[190]35        h_max as Real (Brief="Altura máxima do nível do tanque", Unit='m');
36        h_min as Real (Brief="Altura mínima do nível do tanque", Unit='m');
[1]37
38    VARIABLES
39        h_ad  as Real (Brief="Altura adimensional do nível do tanque", Lower=0,Upper=1);
40
41        CONNECTIONS
42       
43        SET
[190]44        Tanque1.A = 8 * 'm^2';
45        h_max = 2 * 'm';
46        h_min = 0 * 'm';
[295]47        PIDc.PID_Select = "Ideal_AWBT";
[294]48       
[558]49        PIDc.tau = 1*'s';       
50        PIDc.tauSet = 1*'s';   
51        PIDc.alpha = 0.3;
52        PIDc.bias = 0; 
53        PIDc.gamma = 1;
54        PIDc.beta = 1;
55        PIDc.Action = "Direct";
56        PIDc.Clip = "Clipped";
57        PIDc.Mode = "Automatic";
58        PIDc.intTime=5000*'s';
59        PIDc.gain = 3.5;
60        PIDc.derivTime=1*'s';
61       
[1]62        EQUATIONS
[558]63
[295]64        PIDc.Ports.input = h_ad;
[1]65        h_ad = (Tanque1.h-h_min)/(h_max-h_min);
[295]66        Tanque1.k = 8*'m^2.5/h'*PIDc.Ports.output;     
[1]67
68        #Perturbação servo
[190]69        #Nível desejado=1*'m'
[295]70        PIDc.Ports.setPoint=0.5;
[1]71
72        #Perturbação regulatória
[481]73        if time<10*'h' then
[190]74                Tanque1.Fin= 3*'m^3/h';
[1]75        else
[190]76                Tanque1.Fin= 1.5*'m^3/h';
[1]77        end     
78       
79        INITIAL
80        "altura inicial"
[190]81        Tanque1.h = 0.2 * 'm';
[1]82       
83        OPTIONS
[190]84        TimeStep = 0.1;
85        TimeEnd = 30;
86        TimeUnit = 'h';
[1]87end
88
89FlowSheet Tanque
90        DEVICES
91        Tanque1 as tank;
[295]92        PIDx     as PID;
[1]93       
94        PARAMETERS     
[190]95        h_max as Real (Brief="Altura máxima do nível do tanque", Unit='m');
96        h_min as Real (Brief="Altura mínima do nível do tanque", Unit='m');
[1]97
98    VARIABLES
99        h_ad  as Real (Brief="Altura adimensional do nível do tanque", Lower=0,Upper=1);
100
101        CONNECTIONS
102       
103        SET
[190]104        Tanque1.A = 8 * 'm^2';
105        h_max = 2 * 'm';
106        h_min = 0 * 'm';
[295]107        PIDx.PID_Select = "Ideal_AWBT";
108       
[558]109        PIDx.tau = 1*'s';       
110    PIDx.tauSet = 1*'s';       
111        PIDx.alpha = 0.3;
112        PIDx.bias = 0;
113        PIDx.gamma = 1;
114        PIDx.beta = 1;
115        PIDx.intTime=5000*'s';
116        PIDx.gain =3.5;
117        PIDx.derivTime=1*'s';
118        PIDx.Action = "Direct";
119        PIDx.Clip = "Clipped";
120        PIDx.Mode = "Automatic";
121
[1]122        EQUATIONS
[558]123       
[295]124        PIDx.Ports.input = h_ad;
[1]125        h_ad = (Tanque1.h-h_min)/(h_max-h_min);
[295]126        Tanque1.k = 8*'m^2.5/h'*PIDx.Ports.output;     
[1]127
128        #Perturbação servo
[190]129        #Nível desejado=1*'m'
[295]130        PIDx.Ports.setPoint=0.5;
[1]131
132        #Perturbação regulatória
[481]133        if time<10*'h' then
[190]134                Tanque1.Fin= 3*'m^3/h';
[1]135        else
[190]136                Tanque1.Fin= 1.5*'m^3/h';
[1]137        end
138       
139        INITIAL
140        "altura inicial"
[190]141        Tanque1.h = 0.2 * 'm';
[1]142       
143        OPTIONS
[190]144        TimeStep = 0.1;
145        TimeEnd = 30;
146        TimeUnit = 'h';
[1]147end
148
149
150
Note: See TracBrowser for help on using the repository browser.