source: trunk/sample/controllers/sample_tanks_pid.mso @ 304

Last change on this file since 304 was 295, checked in by gerson bicca, 16 years ago

updated controllers models

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.3 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 295 2007-06-21 19:48:17Z bicca $
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        EQUATIONS
50        PIDc.Parameters.tau = 1*'s';   
51        PIDc.Parameters.tauSet = 1*'s';
52        PIDc.Parameters.alpha = 0.3;
53        PIDc.Parameters.bias = 0;       
54        PIDc.Parameters.gamma = 1;
55        PIDc.Parameters.beta = 1;
56        PIDc.Options.action = -1;
57        PIDc.Options.clip=1;
58        PIDc.Options.autoMan = 0;
59        PIDc.Parameters.intTime=5000*'s';
60        PIDc.Parameters.gain = 3.5;
61        PIDc.Parameters.derivTime=1*'s';
62        PIDc.Ports.input = h_ad;
63        h_ad = (Tanque1.h-h_min)/(h_max-h_min);
64        Tanque1.k = 8*'m^2.5/h'*PIDc.Ports.output;     
65
66        #Perturbação servo
67        #Nível desejado=1*'m'
68        PIDc.Ports.setPoint=0.5;
69
70        #Perturbação regulatória
71        if time<10*"h" then
72                Tanque1.Fin= 3*'m^3/h';
73        else
74                Tanque1.Fin= 1.5*'m^3/h';
75        end     
76       
77        INITIAL
78        "altura inicial"
79        Tanque1.h = 0.2 * 'm';
80       
81        OPTIONS
82        DAESolver(File = "dassl");
83        TimeStep = 0.1;
84        TimeEnd = 30;
85        TimeUnit = 'h';
86end
87
88FlowSheet Tanque
89        DEVICES
90        Tanque1 as tank;
91        PIDx     as PID;
92       
93        PARAMETERS     
94        h_max as Real (Brief="Altura máxima do nível do tanque", Unit='m');
95        h_min as Real (Brief="Altura mínima do nível do tanque", Unit='m');
96
97    VARIABLES
98        h_ad  as Real (Brief="Altura adimensional do nível do tanque", Lower=0,Upper=1);
99
100        CONNECTIONS
101       
102        SET
103        Tanque1.A = 8 * 'm^2';
104        h_max = 2 * 'm';
105        h_min = 0 * 'm';
106        PIDx.PID_Select = "Ideal_AWBT";
107       
108        EQUATIONS
109        PIDx.Parameters.tau = 1*'s';   
110    PIDx.Parameters.tauSet = 1*'s';     
111        PIDx.Parameters.alpha = 0.3;
112        PIDx.Parameters.bias = 0;
113        PIDx.Parameters.gamma = 1;
114        PIDx.Parameters.beta = 1;
115        PIDx.Parameters.intTime=5000*'s';
116        PIDx.Parameters.gain =3.5;
117        PIDx.Parameters.derivTime=1*'s';
118        PIDx.Options.action = -1;
119        PIDx.Options.clip=1;
120        PIDx.Options.autoMan = 0;
121        PIDx.Ports.input = h_ad;
122        h_ad = (Tanque1.h-h_min)/(h_max-h_min);
123        Tanque1.k = 8*'m^2.5/h'*PIDx.Ports.output;     
124
125        #Perturbação servo
126        #Nível desejado=1*'m'
127        PIDx.Ports.setPoint=0.5;
128
129        #Perturbação regulatória
130        if time<10*"h" then
131                Tanque1.Fin= 3*'m^3/h';
132        else
133                Tanque1.Fin= 1.5*'m^3/h';
134        end
135       
136        INITIAL
137        "altura inicial"
138        Tanque1.h = 0.2 * 'm';
139       
140        OPTIONS
141        TimeStep = 0.1;
142        TimeEnd = 30;
143        TimeUnit = 'h';
144end
145
146
147
Note: See TracBrowser for help on using the repository browser.