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

Starting checking new EML.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/eml/controllers/PIDs.mso

    r771 r909  
    2828
    2929        PID_Select      as Switcher     (Brief="Type of PID Incremental", Valid=["Ideal","Parallel","Series","Ideal_AWBT","Parallel_AWBT","Series_AWBT","Ideal_AW","Parallel_AW","Series_AW"], Default = "Ideal");
    30         Action                          as Switcher     (Brief="Controller action", Valid=["Direct","Reverse"], Default = "Reverse");
    31         Mode                    as Switcher     (Brief="Controller mode", Valid=["Automatic","Manual"], Default = "Automatic");
    32         Clip                            as Switcher     (Brief="Controller mode", Valid=["Clipped","Unclipped"], Default = "Clipped");
    33 
    34         alpha                   as positive                             (Brief="Derivative term filter constant", Default=1);
    35         beta                    as positive                             (Brief="Proportional term setPoint change filter");
    36         bias                    as control_signal       (Brief="Previous scaled bias", Default=0.5);
    37         derivTime       as time_sec                     (Brief="Derivative time constant");
    38         intTime         as time_sec                     (Brief="Integral time constant");
    39         gain                    as positive                             (Brief="Controller gain", Default=0.5);
    40         gamma           as positive                             (Brief="Derivative term SP change filter");
    41         tau                     as time_sec                     (Brief="Input filter time constant");
    42         tauSet          as time_sec                     (Brief="Input filter time constant");
    43         MinInput                as control_signal       (Default=-1000);
     30        Action          as Switcher     (Brief="Controller action", Valid=["Direct","Reverse"], Default = "Reverse");
     31        Mode            as Switcher     (Brief="Controller mode", Valid=["Automatic","Manual"], Default = "Automatic");
     32        Clip            as Switcher     (Brief="Controller mode", Valid=["Clipped","Unclipped"], Default = "Clipped");
     33
     34        alpha           as positive             (Brief="Derivative term filter constant", Default=1);
     35        beta            as positive             (Brief="Proportional term setPoint change filter");
     36        bias            as control_signal       (Brief="Previous scaled bias", Default=0.5);
     37        derivTime       as time_sec             (Brief="Derivative time constant");
     38        intTime         as time_sec             (Brief="Integral time constant");
     39        gain            as positive             (Brief="Controller gain", Default=0.5);
     40        gamma           as positive             (Brief="Derivative term SP change filter");
     41        tau             as time_sec             (Brief="Input filter time constant");
     42        tauSet          as time_sec             (Brief="Input filter time constant");
     43        MinInput        as control_signal       (Default=0);
    4444        MaxInput        as control_signal       (Default=1000);
    45         MinOutput       as control_signal       (Default=-1000);
    46         MaxOutput       as control_signal       (Default=1000);
    47        
     45        MinOutput       as control_signal       (Default=0);
     46        MaxOutput       as control_signal       (Default=1);
     47
    4848VARIABLES
    49 in              Input           as control_signal       (Protected=true, PosX=0, PosY=0.5);
    50 out     Output  as control_signal       (Protected=true, PosX=0.54, PosY=1);
    51         SetPoint                as control_signal;
     49in      Input           as control_signal       (Protected=true, PosX=0, PosY=0.5);
     50out     Output          as control_signal       (Protected=true, PosX=0.54, PosY=1);
     51        SetPoint        as control_signal;
    5252
    5353#++++++++++++++++++++ PID Internal Variables ++++++++++++++++++++++++++++++++
    5454        PID_derivTerm   as control_signal       (Brief="Derivative term", Hidden =true , Default=0);
    55         PID_dFilt               as control_signal       (Brief="Derivative term filtered", Hidden =true ,Default=0.5);
    56         PID_error               as control_signal       (Brief="Error definition for proportional term",Hidden =true );
     55        PID_dFilt       as control_signal       (Brief="Derivative term filtered", Hidden =true ,Default=0.5);
     56        PID_error       as control_signal       (Brief="Error definition for proportional term",Hidden =true );
    5757        PID_errorD      as control_signal       (Brief="Error definition for derivative term", Hidden =true );
    58         PID_errorI              as control_signal       (Brief="Error definition for integral term", Hidden =true);
    59         PID_inputFilt           as control_signal       (Brief="Filtered input", Hidden =true);
     58        PID_errorI      as control_signal       (Brief="Error definition for integral term", Hidden =true);
     59        PID_inputFilt   as control_signal       (Brief="Filtered input", Hidden =true);
    6060        PID_intTerm     as control_signal       (Brief="Integral term", Hidden =true , Default=0);
    61         PID_outp                as control_signal       (Brief="Sum of proportional, integral and derivative terms", Hidden =true );
    62         PID_outps               as control_signal       (Brief="Variable outp scaled between -1 and 1",Hidden =true);
     61        PID_outp        as control_signal       (Brief="Sum of proportional, integral and derivative terms", Hidden =true );
     62        PID_outps       as control_signal       (Brief="Variable outp scaled between -1 and 1",Hidden =true);
    6363        PID_propTerm    as control_signal       (Brief="Proportional term", Default=0 , Hidden =true );
    64         PID_setPointFilt  as control_signal     (Brief="Filtered setPoint", Default=0, Hidden =true);
    65         PID_AWFactor    as Real                                 (Brief="Integral term multiplier used in anti-reset windup", Hidden=true);
    66         PID_action              as Real                                 (Protected=true, Hidden=true);
     64        PID_setPointFilt  as control_signal (Brief="Filtered setPoint", Default=0, Hidden =true);
     65        PID_AWFactor    as Real                 (Brief="Integral term multiplier used in anti-reset windup", Hidden=true);
     66        PID_action      as Real                         (Protected=true, Hidden=true);
    6767       
    6868        PID_input       as control_signal       (Brief="Previous scaled input signal", Default=0.5, Hidden=true);
    6969        PID_output      as control_signal       (Brief="Scaled output signal", Default=0.5, Hidden=true);
    70         PID_setPoint   as control_signal        (Brief="Scaled setPoint",Default=0.5, Hidden=true);
     70        PID_setPoint    as control_signal       (Brief="Scaled setPoint",Default=0.5, Hidden=true);
    7171#++++++++++++++++++++++++++++++++++++++++++++++++++++
    7272
     
    7777
    7878"Output "
    79         Output = PID_output*(MaxOutput-MinOutput) +MinOutput;
     79        Output = PID_output*(MaxOutput - MinOutput) + MinOutput;
    8080       
    8181"Set Point "
     
    9494        EQUATIONS
    9595
    96         if (tau equal 0) then
     96        if (tau < 1e-3*'s') then
    9797                "Input first order filter"
    9898                (tau + 1e-3*'s')*diff(PID_inputFilt)= PID_input - PID_inputFilt;
     
    102102        end
    103103
    104         if (tauSet equal 0) then
     104        if (tauSet < 1e-3*'s') then
    105105                "setPoint first order filter"
    106106                (tauSet + 1e-3*'s')*diff(PID_setPointFilt)= PID_setPoint - PID_setPointFilt;
     
    130130        PID_propTerm=PID_error;
    131131       
    132         if (derivTime equal 0) then
     132        if (derivTime < 1e-3*'s') then
    133133                "Derivative term filter"       
    134134                alpha*(derivTime + 1e-3*'s')*diff(PID_dFilt) = PID_errorD - PID_dFilt;
     
    147147        case "Clipped":
    148148                if abs(PID_outps)>1 then
    149                         "Calculate clipped output when it´s saturated"
    150                         PID_output=(sign(PID_outps)*1+1)/2;
     149                        "Calculate clipped output when saturated"
     150                        PID_output=(sign(PID_outps)+1)/2;
    151151                else
    152                         "Calculate clipped output when it´s not saturated"
     152                        "Calculate clipped output when not saturated"
    153153                        PID_output=PID_outp;
    154154                end
Note: See TracChangeset for help on using the changeset viewer.