Ignore:
Timestamp:
Jun 11, 2017, 2:37:15 PM (6 years ago)
Author:
Argimiro Resende Secchi
Message:

Fixed sintaxe problem of old version.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sample/controllers/CSTR_noniso_pid.mso

    r973 r1003  
    105105# Process with controlled CSTR and multiple steady-states
    106106FlowSheet CSTR_controller
     107        PARAMETERS
     108        Lmin as length;
     109        Lmax as length;
     110        Tmin as temperature;
     111        Tmax as temperature;
    107112
    108113        DEVICES
     
    113118 
    114119        VARIABLES
    115         L_ad as Real;
    116         Lmin as length;
    117         Lmax as length;
    118         T_ad as Real;
    119         Tmin as temperature;
    120         Tmax as temperature;
    121120        Lsp as length;
    122121        Tsp as temperature;
     122out     TI      as control_signal;
     123out     LI      as control_signal;
    123124       
    124125        CONNECTIONS
    125126        FEED to CSTR1.Inlet;
    126        
     127        LI       to PIDL.Input;
     128        TI       to PIDT.Input;
     129
    127130        SET
    128131#       CSTR Parameters
     
    136139        CSTR1.D   = 3.2 * 'm';
    137140        CSTR1.Cv  = 2.7 * 'm^2.5/h';
    138        
    139         PIDL.PID_Select = "Ideal_AWBT";
    140         PIDT.PID_Select = "Ideal_AWBT";
    141        
    142         EQUATIONS
    143 
    144         "Dimensionless level to connect PID"
    145         L_ad*(Lmax-Lmin)=CSTR1.h-Lmin;
    146         PIDL.Ports.input=L_ad;
    147 
    148         "Dimensionless temperature to connect PID"
    149         T_ad*(Tmax-Tmin)=CSTR1.T-Tmin;
    150         PIDT.Ports.input=T_ad;
    151        
    152         "Manipulated Variables"
    153         CSTR1.x  = PIDL.Ports.output;
    154         CSTR1.Tw  = PIDT.Ports.output*(Tmax-Tmin)+Tmin;
    155        
    156 #   Level control: PID parameters
    157         PIDL.Parameters.bias=0;
    158         PIDL.Parameters.alpha=0.1;
    159         PIDL.Options.action=-1;
    160         PIDL.Parameters.gamma=1;
    161         PIDL.Parameters.beta=1;
    162         PIDL.Options.clip=1;
    163         PIDL.Options.autoMan=0;
    164         PIDL.Parameters.gain=1;
    165         PIDL.Parameters.intTime=2.5*'h';
    166         PIDL.Parameters.derivTime=0*'s';
    167         PIDL.Ports.setPoint=(Lsp - Lmin)/(Lmax - Lmin);
    168         PIDL.Parameters.tau=1*'s';
    169         PIDL.Parameters.tauSet=1*'s';
    170 
    171 #   Temperature control: PID parameters
    172         PIDT.Parameters.bias = 0;
    173         PIDT.Parameters.alpha=0.1;
    174         PIDT.Options.action=1;
    175         PIDT.Parameters.gamma=1;
    176         PIDT.Parameters.beta=1;
    177         PIDT.Options.clip=1;
    178         PIDT.Options.autoMan=0;
    179         PIDT.Parameters.gain=1;
    180         PIDT.Parameters.intTime=2.5*'h';
    181         PIDT.Parameters.derivTime=1*'h';
    182         PIDT.Ports.setPoint=(Tsp - Tmin)/(Tmax - Tmin);
    183         PIDT.Parameters.tau=1*'s';
    184         PIDT.Parameters.tauSet=1*'s';   
    185        
    186         "Operating range for control variables"
     141
     142#       Operating range for control variables
    187143        Lmax=5*'m';
    188144        Lmin=0*'m';
    189145        Tmax=700*'K';
    190         Tmin=230*'K';   
     146        Tmin=230*'K';
     147
     148        PIDL.PID_Select = "Ideal_AWBT";
     149        PIDT.PID_Select = "Ideal_AWBT";
     150
     151#   Level control: PID parameters
     152        PIDL.bias=0;
     153        PIDL.alpha=0.1;
     154        PIDL.Action="Direct";
     155        PIDL.gamma=1;
     156        PIDL.beta=1;
     157        PIDL.Clip="Clipped";
     158        PIDL.Mode="Automatic";
     159        PIDL.gain=1;
     160        PIDL.intTime=2.5*'h';
     161        PIDL.derivTime=0*'s';
     162        PIDL.tau=1*'s';
     163        PIDL.tauSet=1*'s';
     164        PIDL.MinInput=Lmin/'m';
     165        PIDL.MaxInput=Lmax/'m';
     166
     167#   Temperature control: PID parameters
     168        PIDT.bias = 0;
     169        PIDT.alpha=0.1;
     170        PIDT.Action="Reverse";
     171        PIDT.gamma=1;
     172        PIDT.beta=1;
     173        PIDT.Clip="Clipped";
     174        PIDT.Mode="Automatic";
     175        PIDT.gain=1;
     176#       PIDT.gain=15; # for a setpoint of 523K or a faster response
     177        PIDT.intTime=2.5*'h';
     178        PIDT.derivTime=1*'h';
     179        PIDT.tau=1*'s';
     180        PIDT.tauSet=1*'s';
     181        PIDT.MinInput=Tmin/'K';
     182        PIDT.MaxInput=Tmax/'K';
     183        PIDT.MinOutput=Tmin/'K';
     184        PIDT.MaxOutput=Tmax/'K';
     185       
     186        EQUATIONS
     187
     188        "Dimensionless level to connect PID"
     189        LI=CSTR1.h/'m';
     190
     191        "Dimensionless temperature to connect PID"
     192        TI=CSTR1.T/'K';
     193
     194        "Manipulated Variables"
     195        CSTR1.x  = PIDL.Output;
     196        CSTR1.Tw  = PIDT.Output*'K';
     197
     198        "Level setpoint"
     199        PIDL.SetPoint=Lsp/'m';
     200
     201        "Temperature setpoint"
     202        PIDT.SetPoint=Tsp/'K';
    191203
    192204        "Feed Stream"
     
    206218        else
    207219          Tsp = 400 * 'K';
     220#         Tsp = 523 * 'K'; # near unstable steady-state (change also the controller's gain)
    208221        end
    209222
Note: See TracChangeset for help on using the changeset viewer.