Ignore:
Timestamp:
Feb 19, 2010, 7:08:11 PM (12 years ago)
Author:
Argimiro Resende Secchi
Message:

Starting checking new EML.

File:
1 edited

Legend:

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

    r735 r909  
    2222* Author: Rafael de Pelegrini Soares
    2323* $Id$
    24 *------------------------------------------------------------------#
     24*------------------------------------------------------------------*#
    2525
    2626using "stage_separators/flash";
     27using "pressure_changers/valve.mso";
    2728using "controllers/PIDIncr";
    2829
     
    3536                VapourModel = "PR");
    3637        NComp   as Integer;
    37         #Maximum and minimum vapor and liquid flow rates
    38         FVMin as flow_mol;
    39         FVMax as flow_mol;
    40         FLMax as flow_mol;
    41         FLMin as flow_mol;
    42         #Maximum and minimum pressure
    43         PMin as pressure;
    44         PMax as pressure;
    45         #Maximum and minimum level
    46         LMax as length;
    47         LMin as length;
    4838
    4939        VARIABLES
    50         L_ad as Real (Brief="Dimensionless level");
    51         P_ad as Real (Brief="Dimensionless pressure");
    5240        Q       as energy_source (Brief="Heat supplied");
    5341       
     
    5745        fl as flash;
    5846        s1 as source;
    59        
     47        valve_top as valve_flow;
     48        valve_bot as valve_flow;
     49
    6050        SET
    6151        NComp = PP.NumberOfComponents;
     
    6555       
    6656        #Flash model parameters
    67         fl.V = 10 * 'm^3';
    68         fl.diameter = 0.5 * 'm';
    69         fl.orientation = "vertical";
     57        fl.Geometry.Lenght = 10 * 'm';
     58        fl.Geometry.Diameter = 1 * 'm';
     59        fl.Geometry.Orientation = "vertical";
    7060       
    7161        #Maximum and minimum values
    72         PMax=2.36 *'atm';
    73         PMin=0 *'atm';
    74         LMax=2 *'m';
    75         LMin=0 *'m';
    76         FVMax=300*'kmol/h';
    77         FVMin=0*'kmol/h';
    78         FLMax=692.7*'kmol/h';
    79         FLMin=0*'kmol/h';
     62        pidP.MaxInput=2.36;
     63        pidP.MinInput=0;
     64        pidL.MaxInput=2;
     65        pidL.MinInput=0;
     66        valve_top.MaxFlow=300*'kmol/h';
     67        valve_top.MinFlow=0*'kmol/h';
     68        valve_bot.MaxFlow=692.7*'kmol/h';
     69        valve_bot.MinFlow=0*'kmol/h';
    8070
    8171        CONNECTIONS
    8272        s1.Outlet to fl.Inlet;
    8373        Q.OutletQ to fl.InletQ;
     74        fl.OutletLiquid to valve_bot.Inlet;
     75        fl.OutletVapour to valve_top.Inlet;
     76        fl.LI to pidL.Input;
     77        fl.PI to pidP.Input;
     78        pidP.Output to valve_top.FlowFraction;
     79        pidL.Output to valve_bot.FlowFraction;
    8480
    8581        SET
     
    108104        pidP.beta =1;
    109105        pidP.gamma =1;
    110         #Pressure controller configuration
    111106        pidP.Mode = "Automatic";               
    112107        pidP.Clip = "Clipped";
    113108        pidP.Action = "Direct";
     109
     110        #Initial conditions
     111        fl.Levelpercent_Initial = 0.5;
     112        fl.Temperature_Initial = 340 * 'K';
     113        fl.Composition_Initial = [0.1, 0.1, 0.8];
    114114
    115115        SPECIFY
     
    118118
    119119        #Level controller parameters
    120         pidL.Ports.setPoint=0.5;
    121 
     120        pidL.SetPoint=0.5;
    122121
    123122        EQUATIONS
     
    134133                s1.F = 450 * 'kmol/h';
    135134        end
    136 
    137         #Control variables: fl.Level and fl.OutletV.P
    138         #Normalized control variables
    139         L_ad*(LMax-LMin)=fl.Level-LMin;
    140         P_ad*(PMax-PMin)=fl.OutletV.P-PMin;
    141        
    142         #Controllers input ports
    143         pidL.Ports.input=L_ad;
    144         pidP.Ports.input=P_ad; 
    145135       
    146136        #Setpoint change
    147137        if time < 2*'h' then
    148                 pidP.Ports.setPoint=0.501822;
     138                pidP.SetPoint=1;
    149139        else
    150                 pidP.Ports.setPoint=0.8474576;
     140                pidP.SetPoint=2;
    151141        end     
    152142       
    153         #Controllers output ports
    154         #Manipulated variables: fl.OutletV.F (pressure control) and fl.OutletL.F (level control)
    155         fl.OutletV.F = pidP.Ports.output*(FVMax-FVMin)+FVMin;
    156         fl.OutletL.F = pidL.Ports.output*(FLMax-FLMin)+FLMin;
    157 
    158         INITIAL
    159         fl.OutletL.T = 340 *'K';
    160         fl.Level = 1* 'm';
    161         fl.OutletL.z(1) = 0.1;
    162         fl.OutletL.z(2) = 0.1;
    163 
    164143        OPTIONS
    165144        TimeStep = 0.02;
Note: See TracChangeset for help on using the changeset viewer.