Ignore:
Timestamp:
Jun 21, 2007, 4:48:17 PM (16 years ago)
Author:
gerson bicca
Message:

updated controllers models

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/eml/controllers/PIDs.mso

    r243 r295  
    1212* EMSO is distributed under the therms of the ALSOC LICENSE as
    1313* available at http://www.enq.ufrgs.br/alsoc.
    14 *
    15 *-------------------------------------------------------------------
    16 * Model of PIDs
    17 *--------------------------------------------------------------------
    18 *  - Inputs
    19 *       - a scaled processs variable
    20 *       - a scaled bias
    21 *       - a scaled setpoint
    22 *
    23 *  - Outputs
    24 *   - a scaled output
    25 *
    26 *
    2714*--------------------------------------------------------------------
    2815* Author: Tiago Osório
     
    3320Model MParameters
    3421
     22ATTRIBUTES
     23        Pallete         = false;
     24        Brief           = "Model of Parameters to be used with PIDs.";
     25       
    3526        VARIABLES
    3627       
     
    4940Model MOptions 
    5041
     42ATTRIBUTES
     43        Pallete         = false;
     44        Brief           = "Model of Options to be used with PIDs.";
     45       
    5146        VARIABLES       
    5247       
     
    5954Model MPorts
    6055
     56ATTRIBUTES
     57        Pallete         = false;
     58        Brief           = "Model of Ports to be used with PIDs.";
     59       
    6160        VARIABLES
    6261       
     
    6867
    6968Model MInternal_Variables
     69       
     70        ATTRIBUTES
     71        Pallete         = false;
     72        Brief           = "Model of Internal Variables to be used with PIDs.";
    7073       
    7174        VARIABLES
     
    8588end
    8689
    87 Model PID_basic
    88 
     90Model PID
     91
     92ATTRIBUTES
     93        Pallete         = true;
     94        Icon            = "PID";
     95        Brief           = "Model of PIDs.";
     96        Info            =
     97        "
     98        - Inputs
     99        *       - a scaled processs variable.
     100        *       - a scaled bias.
     101        *       - a scaled setpoint.
     102
     103        - Outputs
     104        *  - a scaled output.
     105        ";
     106       
     107        PARAMETERS
     108        PID_Select as Switcher (Brief="Type of PID", Valid=["Ideal","Parallel","Series","Ideal_AWBT","Parallel_AWBT","Series_AWBT","Ideal_AW","Parallel_AW","Series_AW"], Default = "Ideal");
     109       
    89110        VARIABLES
    90111        Parameters         as MParameters;
     
    92113        Internal           as MInternal_Variables;
    93114        Ports              as MPorts;
     115        AWFactor     as Real     (Brief="Integral term multiplier used in anti-reset windup");
     116       
     117        INITIAL
     118        Internal.intTerm = 0;
     119        diff(Internal.dFilt) = 0/'s';
     120        diff(Internal.inputFilt) = 0/'s';
     121        diff(Internal.setPointFilt) = 0/'s';
    94122       
    95123        EQUATIONS
     
    157185        end
    158186
    159         INITIAL
    160         Internal.intTerm = 0;
    161         diff(Internal.dFilt) = 0/'s';
    162         diff(Internal.inputFilt) = 0/'s';
    163         diff(Internal.setPointFilt) = 0/'s';
    164 end
    165 
    166 
    167 Model PID_Ideal_AW as PID_basic
    168        
    169         VARIABLES
    170         AWFactor     as Real     (Brief="Integral term multiplier used in anti-reset windup");
    171 
    172         EQUATIONS
     187switch PID_Select
     188       
     189case "Ideal_AW":
    173190       
    174191        "Calculate integral term with anti-windup"
     
    185202                AWFactor=1;
    186203        end
    187 end
    188 
    189 Model PID_Parallel_AW as PID_basic
    190        
    191         VARIABLES
    192         AWFactor     as Real     (Brief="Integral term multiplier used in anti-reset windup");
    193 
    194         EQUATIONS
     204
     205case "Parallel_AW":
    195206       
    196207        "Calculate integral term with anti-windup"
     
    207218                AWFactor=1;
    208219        end
    209 end
    210 
    211 Model PID_Series_AW as PID_basic
    212        
    213         VARIABLES
    214         AWFactor     as Real     (Brief="Integral term multiplier used in anti-reset windup");
    215        
    216         EQUATIONS
    217        
     220
     221
     222case "Series_AW":
     223
    218224        "Calculate integral term with anti-windup"     
    219225        Parameters.intTime*diff(Internal.intTerm) = AWFactor*Internal.errorI;
     
    229235                AWFactor=1;
    230236        end
    231 end
    232 
    233 Model PID_Ideal as PID_basic
    234        
    235         EQUATIONS
     237
     238case "Ideal":
    236239       
    237240        "Calculate integral term"       
     
    241244        Internal.outp = Parameters.bias + Options.action*Parameters.gain*(Internal.propTerm + Internal.intTerm + Internal.derivTerm);
    242245
    243 end
    244 
    245 Model PID_Parallel as PID_basic
    246        
    247         EQUATIONS
     246        "Calculate AWFactor - Not in use in this mode"
     247        AWFactor=1;
     248       
     249case "Parallel":
    248250       
    249251        "Calculate integral term"       
     
    253255        Internal.outp = Parameters.bias + Options.action*(Parameters.gain*Internal.propTerm + Internal.intTerm + Internal.derivTerm);
    254256
    255 end
    256 
    257 Model PID_Series as PID_basic
    258        
    259         EQUATIONS
     257        "Calculate AWFactor - Not in use in this mode"
     258        AWFactor=1;
     259       
     260case "Series":
    260261       
    261262        "Calculate integral term"       
     
    264265        "Sum of proportional, integral and derivative terms"
    265266        Internal.outp = Parameters.bias + Options.action*(Parameters.gain*(Internal.propTerm + Internal.intTerm)*(1 + Internal.derivTerm));
    266 
    267 end
    268 
    269 Model PID_Ideal_AWBT as PID_basic
    270        
    271         EQUATIONS
     267       
     268        "Calculate AWFactor - Not in use in this mode"
     269        AWFactor=1;
     270       
     271case "Ideal_AWBT":
    272272       
    273273        "Calculate integral term with anti-windup and bumpless transfer"       
     
    276276        "Sum of proportional, integral and derivative terms"   
    277277        Internal.outp = Parameters.bias + Options.action*Parameters.gain*(Internal.propTerm + Internal.intTerm + Internal.derivTerm);
    278 
    279 end
    280 
    281 Model PID_Parallel_AWBT as PID_basic
    282        
    283         EQUATIONS
     278       
     279        "Calculate AWFactor - Not in use in this mode"
     280        AWFactor=1;
     281       
     282case "Parallel_AWBT":
    284283       
    285284        "Calculate integral term with anti-windup and bumpless transfer"       
     
    288287        "Sum of proportional, integral and derivative terms"   
    289288        Internal.outp = Parameters.bias + Options.action*(Parameters.gain*Internal.propTerm + Internal.intTerm + Internal.derivTerm);
    290 
    291 end
    292 
    293 Model PID_Series_AWBT as PID_basic
    294        
    295         EQUATIONS
     289       
     290        "Calculate AWFactor - Not in use in this mode"
     291        AWFactor=1;
     292       
     293case "Series_AWBT":
    296294       
    297295        "Calculate integral term with anti-windup and bumpless transfer"
     
    301299        Internal.outp = Parameters.bias + Options.action*(Parameters.gain*(Internal.propTerm + Internal.intTerm)*(1 + Internal.derivTerm));
    302300
    303 end
     301        "Calculate AWFactor - Not in use in this mode"
     302        AWFactor=1;
     303       
     304end
     305
     306end
Note: See TracChangeset for help on using the changeset viewer.