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

Last change on this file since 558 was 558, checked in by Rafael de Pelegrini Soares, 15 years ago

Added some simple PI controllers and another signal models

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.1 KB
Line 
1#*-------------------------------------------------------------------
2* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
3*
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.
7*
8* EMSO Copyright (C) 2004 - 2007 ALSOC, original code
9* from http://www.rps.eng.br Copyright (C) 2002-2004.
10* All rights reserved.
11*
12* EMSO is distributed under the therms of the ALSOC LICENSE as
13* available at http://www.enq.ufrgs.br/alsoc.
14*
15*
16*-------------------------------------------------------------------
17* Sample file for tanks level control
18*
19*-------------------------------------------------------------------
20* Author: Tiago Osório
21* $Id: sample_tanks_pid.mso 558 2008-07-21 20:41:41Z rafael $
22*-----------------------------------------------------------------*#
23
24using "tanksmodel";
25using "controllers/PIDs";
26using "controllers/PIDIncr";
27
28
29FlowSheet Tanque_inc
30        DEVICES
31        Tanque1 as tank;
32        PIDc     as PIDIncr;
33       
34        PARAMETERS     
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');
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
44        Tanque1.A = 8 * 'm^2';
45        h_max = 2 * 'm';
46        h_min = 0 * 'm';
47        PIDc.PID_Select = "Ideal_AWBT";
48       
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       
62        EQUATIONS
63
64        PIDc.Ports.input = h_ad;
65        h_ad = (Tanque1.h-h_min)/(h_max-h_min);
66        Tanque1.k = 8*'m^2.5/h'*PIDc.Ports.output;     
67
68        #Perturbação servo
69        #Nível desejado=1*'m'
70        PIDc.Ports.setPoint=0.5;
71
72        #Perturbação regulatória
73        if time<10*'h' then
74                Tanque1.Fin= 3*'m^3/h';
75        else
76                Tanque1.Fin= 1.5*'m^3/h';
77        end     
78       
79        INITIAL
80        "altura inicial"
81        Tanque1.h = 0.2 * 'm';
82       
83        OPTIONS
84        TimeStep = 0.1;
85        TimeEnd = 30;
86        TimeUnit = 'h';
87end
88
89FlowSheet Tanque
90        DEVICES
91        Tanque1 as tank;
92        PIDx     as PID;
93       
94        PARAMETERS     
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');
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
104        Tanque1.A = 8 * 'm^2';
105        h_max = 2 * 'm';
106        h_min = 0 * 'm';
107        PIDx.PID_Select = "Ideal_AWBT";
108       
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
122        EQUATIONS
123       
124        PIDx.Ports.input = h_ad;
125        h_ad = (Tanque1.h-h_min)/(h_max-h_min);
126        Tanque1.k = 8*'m^2.5/h'*PIDx.Ports.output;     
127
128        #Perturbação servo
129        #Nível desejado=1*'m'
130        PIDx.Ports.setPoint=0.5;
131
132        #Perturbação regulatória
133        if time<10*'h' then
134                Tanque1.Fin= 3*'m^3/h';
135        else
136                Tanque1.Fin= 1.5*'m^3/h';
137        end
138       
139        INITIAL
140        "altura inicial"
141        Tanque1.h = 0.2 * 'm';
142       
143        OPTIONS
144        TimeStep = 0.1;
145        TimeEnd = 30;
146        TimeUnit = 'h';
147end
148
149
150
Note: See TracBrowser for help on using the repository browser.