Ignore:
Timestamp:
Jul 15, 2011, 3:44:52 PM (12 years ago)
Author:
mamuller
Message:

updated samples

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/sample/controllers/CSTR_noniso.mso

    r536 r941  
    2121
    2222using "types";
     23using "controllers/PIDs";
    2324
    2425const_valv as positive(Brief = "Valve Constant", Default=1,Lower=0,Upper=100, Unit='m^2.5/h');
     
    152153        DAESolver(File = "dassl");
    153154end
     155
     156Model CSTR_pid as CSTR
     157       
     158        VARIABLES
     159out     LI as control_signal (Brief="Level Indicator");
     160out     TI as control_signal (Brief="Temperature Indicator");
     161       
     162        EQUATIONS
     163        "Level sensor"
     164        LI * 'm' = h;
     165
     166        "Temperature sensor"
     167        TI * 'K' = T;
     168       
     169end
     170
     171# Process with controlled CSTR and multiple steady-states
     172FlowSheet CSTR_controller
     173
     174        DEVICES
     175        FEED as stream_cstr;
     176        CSTR1 as CSTR_pid;
     177        PIDL as PID;
     178        PIDT as PID;
     179 
     180        VARIABLES
     181        Lsp as length;
     182        Tsp as temperature;
     183
     184
     185        CONNECTIONS
     186        FEED to CSTR1.Inlet;
     187        CSTR1.LI to PIDL.Input;
     188        CSTR1.TI to PIDT.Input;
     189       
     190        SET
     191#       CSTR Parameters
     192        CSTR1.R   = 8.3144 * 'kJ/kmol/K';
     193        CSTR1.U   = 300 * 'kJ/h/m^2/K';
     194        CSTR1.ro  = 1000 * 'kg/m^3';
     195        CSTR1.Cp  = 4*'kJ/kg/K';
     196        CSTR1.Hr  = -7000 * 'kJ/kmol';
     197        CSTR1.Ea  = 6e4 * 'kJ/kmol';
     198        CSTR1.ko  = 89 * '1/s';
     199        CSTR1.D   = 3.2 * 'm';
     200        CSTR1.Cv  = 2.7 * 'm^2.5/h';
     201       
     202        PIDL.PID_Select = "Ideal_AWBT";
     203        PIDT.PID_Select = "Ideal_AWBT";
     204       
     205#   Level control: PID parameters
     206        PIDL.bias=0;
     207        PIDL.alpha=0.1;
     208        PIDL.Action="Direct";
     209        PIDL.gamma=1;
     210        PIDL.beta=1;
     211        PIDL.Clip="Clipped";
     212        PIDL.Mode="Automatic";
     213        PIDL.gain=1;
     214        PIDL.intTime=2.5*'h';
     215        PIDL.derivTime=0*'s';
     216        PIDL.tau=1*'s';
     217        PIDL.tauSet=1*'s';
     218
     219#   Temperature control: PID parameters
     220        PIDT.bias = 0;
     221        PIDT.alpha=0.1;
     222        PIDT.Action="Direct";
     223        PIDT.gamma=1;
     224        PIDT.beta=1;
     225        PIDT.Clip="Clipped";
     226        PIDT.Mode="Automatic";
     227        PIDT.gain=1;
     228        PIDT.intTime=2.5*'h';
     229        PIDT.derivTime=1*'h';
     230        PIDT.tau=1*'s';
     231        PIDT.tauSet=1*'s';     
     232       
     233#       Operating range for control variables
     234        PIDL.MaxInput=5;
     235        PIDL.MinInput=0;
     236        PIDT.MaxInput=700;
     237        PIDT.MinInput=230;     
     238        PIDT.MaxOutput=700;
     239        PIDT.MinOutput=230;     
     240
     241        EQUATIONS
     242
     243        "Setpoints"
     244        PIDL.SetPoint * 'm' = Lsp;
     245        PIDT.SetPoint * 'K' = Tsp;
     246
     247        "Manipulated Variables"
     248        CSTR1.x = PIDL.Output;
     249        CSTR1.Tw = PIDT.Output * 'K';
     250
     251        "Feed Stream"
     252        FEED.Ca = 300 * 'kmol/m^3';
     253        FEED.F = 3.5 * 'm^3/h';
     254
     255#   Disturbance
     256        if time < 50 * 'h' then
     257                FEED.T = 300 * 'K';
     258        else
     259                FEED.T = 285 * 'K'; # change to 350 K to saturate controller
     260        end
     261
     262#   Set-point changes
     263        if time < 100 * 'h' then
     264          Tsp = 630 * 'K';
     265        else
     266          Tsp = 400 * 'K';
     267        end
     268
     269        if time < 150 * 'h' then
     270          Lsp = 1.7 * 'm';
     271        else
     272          Lsp = 4 * 'm';
     273        end
     274
     275        INITIAL
     276        CSTR1.Ca = 50 * 'kmol/m^3';
     277        CSTR1.h = 1.7 * 'm';
     278        CSTR1.T = 570 * 'K';
     279       
     280        OPTIONS
     281        TimeStep = 1;
     282        TimeEnd = 250;
     283        TimeUnit = 'h';
     284        DAESolver(File = "dassl");
     285end
     286
Note: See TracChangeset for help on using the changeset viewer.