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

Last change on this file since 996 was 910, checked in by Argimiro Resende Secchi, 13 years ago

Checking new EML.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.6 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 910 2010-02-20 03:24:41Z arge $
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    VARIABLES
35out     LI as control_signal (Brief="Level Indicator");
36
37        CONNECTIONS
38        LI to PIDc.Input;
39       
40        SET
41        Tanque1.A = 8 * 'm^2';
42        PIDc.MaxInput = 2;
43        PIDc.MinInput = 0;
44        PIDc.PID_Select = "Ideal_AWBT";
45       
46        PIDc.tau = 1*'s';       
47        PIDc.tauSet = 1*'s';   
48        PIDc.alpha = 0.3;
49        PIDc.bias = 0; 
50        PIDc.gamma = 1;
51        PIDc.beta = 1;
52        PIDc.Action = "Direct";
53        PIDc.Clip = "Clipped";
54        PIDc.Mode = "Automatic";
55        PIDc.intTime=5000*'s';
56        PIDc.gain = 3.5;
57        PIDc.derivTime=1*'s';
58       
59        EQUATIONS
60
61        Tanque1.k = 8*'m^2.5/h'*PIDc.Output;   
62
63        "Level sensor"
64        LI * 'm' = Tanque1.h;
65
66        #Setpoint tracking
67        PIDc.SetPoint=1;
68
69        #Disturbance rejection
70        if time<10*'h' then
71                Tanque1.Fin= 3*'m^3/h';
72        else
73                Tanque1.Fin= 1.5*'m^3/h';
74        end     
75       
76        INITIAL
77        "altura inicial"
78        Tanque1.h = 0.2 * 'm';
79       
80        OPTIONS
81        TimeStep = 0.1;
82        TimeEnd = 30;
83        TimeUnit = 'h';
84end
85
86FlowSheet Tanque
87        DEVICES
88        Tanque1 as tank;
89        PIDx     as PID;
90       
91    VARIABLES
92out     LI as control_signal (Brief="Level Indicator");
93
94        CONNECTIONS
95        LI to PIDx.Input;
96       
97        SET
98        Tanque1.A = 8 * 'm^2';
99        PIDx.MaxInput = 2;
100        PIDx.MinInput = 0;
101        PIDx.PID_Select = "Ideal_AWBT";
102       
103        PIDx.tau = 1*'s';       
104    PIDx.tauSet = 1*'s';       
105        PIDx.alpha = 0.3;
106        PIDx.bias = 0;
107        PIDx.gamma = 1;
108        PIDx.beta = 1;
109        PIDx.intTime=5000*'s';
110        PIDx.gain =3.5;
111        PIDx.derivTime=1*'s';
112        PIDx.Action = "Direct";
113        PIDx.Clip = "Clipped";
114        PIDx.Mode = "Automatic";
115
116        EQUATIONS
117       
118        Tanque1.k = 8*'m^2.5/h'*PIDx.Output;   
119
120        "Level sensor"
121        LI * 'm' = Tanque1.h;
122
123        #Setpoint tracking
124        PIDx.SetPoint=1;
125
126        #Disturbance rejection
127        if time<10*'h' then
128                Tanque1.Fin= 3*'m^3/h';
129        else
130                Tanque1.Fin= 1.5*'m^3/h';
131        end
132       
133        INITIAL
134        "altura inicial"
135        Tanque1.h = 0.2 * 'm';
136       
137        OPTIONS
138        TimeStep = 0.1;
139        TimeEnd = 30;
140        TimeUnit = 'h';
141end
142
143
144
Note: See TracBrowser for help on using the repository browser.