introducción al modelo predictivo

Upload: alejandro-almonacid-rivas

Post on 13-Apr-2018

230 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/26/2019 Introduccin al modelo predictivo

    1/18

    Introduction to Model Predictive Control (MPC)

    For Classroom Use Only!

  • 7/26/2019 Introduccin al modelo predictivo

    2/18

    Important User Information

    This documentation, whether, illustrative, printed, online or electronic (hereinafter Documentation) is intended for use only asa learning aid when using Rockwell Automation approved demonstration hardware, software and firmware. The Documentationshould only be used as a learning tool by qualified professionals.

    The variety of uses for the hardware, software and firmware (hereinafter Products) described in this Documentation, mandatesthat those responsible for the application and use of those Products must satisfy themselves that all necessary steps have beentaken to ensure that each application and actual use meets all performance and safety requirements, including any applicablelaws, regulations, codes and standards in addition to any applicable technical documents.

    In no event will Rockwell Automation, Inc., or any of its affiliate or subsidiary companies (hereinafter Rockwell Automation) beresponsible or liable for any indirect or consequential damages resulting from the use or application of the Products described inthis Documentation. Rockwell Automation does not assume responsibility or liability for damages of any kind based on thealleged use of, or reliance on, this Documentation.

    No patent liability is assumed by Rockwell Automation with respect to use of information, circuits, equipment, or softwaredescribed in the Documentation.

    Except as specifically agreed in writing as part of a maintenance or support contract, equipment users are responsible for:

    properly using, calibrating, operating, monitoring and maintaining all Products consistent with all Rockwell Automation

    or third-party provided instructions, warnings, recommendations and documentation;

    ensuring that only properly trained personnel use, operate and maintain the Products at all times;

    staying informed of all Product updates and alerts and implementing all updates and fixes; and

    all other factors affecting the Products that are outside of the direct control of Rockwell Automation.

    Reproduction of the contents of the Documentation, in whole or in part, without written permission of Rockwell Automation isprohibited.

    Throughout this manual we use the following notes to make you aware of safety considerations:

    Identifies information about practices or circumstancesthat can cause an explosion in a hazardous environment,which may lead to personal injury or death, property damage, or economic loss.

    Identifies information that is critical for successful application and understanding of the product.

    Identifies information about practices or circumstances that can lead to personal injury or death, propertydamage, or economic loss. Attentions help you: identify a hazard avoid a hazard recognize the consequence

    Labels may be located on or inside the drive to alert people that dangerous voltage may be present.

    Labels may be located on or inside the drive to alert people that surfaces may be dangerous temperatures.

  • 7/26/2019 Introduccin al modelo predictivo

    3/18

    3 of 18

    Introduction to Model Predictive Control

    Contents

    Introduction to Model Predictive Control ....................................................................................................... 4

    About this lab .................................................................................................................................................................................... 4

    Workshop I Working with Models ................................................................................................................................................... 5

    Workshop II Constraints and Tuning............................................................................................................................................ 10

    Workshop III Applying MPC to a Simulated Process ................................................................................................................... 15

  • 7/26/2019 Introduccin al modelo predictivo

    4/18

    4 of 18

    Introduction to Model Predictive Control

    About this lab

    This lab provides an introduction to basic concepts of Model Predictive Control (MPC), a powerful advance process control(APC) strategy used on a wide range of industrial processes to provide improved performance. Workshop I of this lab will

    provide an overview of control model terminology and a basic understanding of how changing parameters affects control

    performance. Workshop II will provide an overview of the basic constraints used within an MPC application and how they can be

    used to achieve the desired process response to target changes and disturbances. Finally, Workshop III will provide the student

    with a dynamic simulation of a chemical reactor with multiple inputs and outputs to see how all the pieces work together.

    This lab takes approximately 90 minutes to complete.

    Tools & prerequisites

    Software programs required: Pavilion 8 Model Predictive Control, Internet Explorer

    Hardware devices required: None

    Files required: None. Lab includes a pre-configu red set of simulation applications and demonstration views

    Start the software and log in

    1. Start the program.

    Double-click the Pavilion8 MPC Console icon on the desktop.

    2. When the browser window opens, enter student as the Username and Password and click the

    Login button.

    Click on Help in the upper right corner of the window and select MPC Console Users Guide from the list. Minimize this

    file and keep it open for reference as you go through the lab workshops, especially chapter 4 Using Views.

  • 7/26/2019 Introduccin al modelo predictivo

    5/18

    5 of 18

    Now, click on the Views tab under the Pavilion8 logo to open the navigation tree.

    Workshop I Working with Models

    Before we begin, it is important to review some basic terminology. MPC is a multivariable control technique where each

    manipulated variable (MV) affects one or more controlled variable (CV) and each CV may be affected by one or more MVs.

    The relationship between each MV and CV is called a model pair and the overall MPC controller is usually shown as a matrix as

    below:

    CV1 CV2 CV3

    MV1MV1-CV1

    Model PairMV1-CV2

    Model PairMV1-CV3

    Model Pair

    MV2MV2-CV1

    Model PairMV2-CV2

    Model PairMV2-CV3

    Model Pair

    MV3 MV3-CV1Model Pair

    MV3-CV2Model Pair

    MV3-CV3Model Pair

    Each model pair is a different linear dynamic model indicating how the CV will change with respect to a unit step change in the

    associated MV. Because these are linear dynamic models, the total change in the CV is just the sum of all of the changes from

    each model pair. For simplicity, we will start with a very simple controller where each CV is affected by only a single MV and

    each MV affects only a single CV. Furthermore, we will use a first order plus dead-time (FOPDT) model for each of the model

    pairs as shown below:

  • 7/26/2019 Introduccin al modelo predictivo

    6/18

    6 of 18

    CV1 CV2 CV3

    MV1

    K = 1.0

    = 30 sec

    = 15 sec

    MV2K = 1.0

    = 30 sec

    = 15 sec

    MV3

    K = 1.0

    = 30 sec

    = 15 sec

    The parameters shown for each of the model pairs refer to the gain (K), time constant (tau), and dead-time (theta or Delay) of a

    FOPDT model. The graph below shows the relationship of each parameter to a unit step change in the input (MV).

    1. Expand the navigation tree to see the views under the Model Workshop folder and click on the Model

    Tests view.

  • 7/26/2019 Introduccin al modelo predictivo

    7/18

    7 of 18

    2. Click the trend history icon (circled above) and set the history to 5 minutes and the prediction to 3

    minutes and click OK. Click the Step Increase button and observe the results.

    The bottom row of trend plots are the MVs and each one should look similar. The blue shaded horizontal bands at the

    top and bottom are the upper and lower limits known as hard constraints. The black vertical line shows the current time,

    everything to the left is history and everything to the right is the future. The light blue line shows the actual measured

    value (abbreviated CurrVal for Current Value). The dark blue line is called the horizon and shows the calculatedsetpoints changes or control moves computed. Since the process gain is 1.0, we would expect the steady state value of

    the MV to be the same as the CV and that is shown by the MV horizon settling at 2.0. We also see that the controller

    computes larger moves initially to overcome some of the slow dynamics of the CV.

    The upper row of trend plots are the CVs and each one should look similar. The green line is the desired value or

    target. The gold line shows the actual measured value of the CV. The dark blue line is called the horizon and shows

    the predicted trajectory of the CV in response to the expected MV moves.

    Allow the simulation to run to let the CVs reach their steady state value and then click the Step Decreaset button to

    change the targets back to 1.0.

    The responses seen are typical for an MPC controller with near-perfect models and responding to a setpoint change in a

    CV.

    3. But what if the controller models are not perfect (which is closer to reality). How sensitive is our

    controller to modeling errors, also known as model mismatch? To find out, we will adjust the gains,

    time constants, and dead-times for our controller models while keeping the process models fixed and

    see how the controller reacts.

    Above the trend plots are cells indicating the model parameters for each of our 3 models. For models 1 and 3, there are

    places to enter new values for each of these parameters. To change a value, enter the new value in the appropriate cell

    and click the Submit button next to it.

  • 7/26/2019 Introduccin al modelo predictivo

    8/18

    8 of 18

    For our first test, change the gain of the Model1 from 1.0 to 0.5. Now change the gain for Model3 from 1.0 to 2.0.

    Model 2 will remain fixed throughout this lab for comparison purposes.

    Click the Step Increase button to generate a change.

    Observe the different MV moves computed initially, especially the predicted steady-state values.

    Because the gains for models 1 and 3 were wrong, they incorrectly predicted larger and smaller moves respectively in

    order effect the same change on their CV. You can also see that the predicted responses of the CVs are still similar

    since the controller thinks each model is correct. Let the simulation run and observe the MV moves at each refresh.

    What happened? CV1 overshot its desired value and MV1 had to make additional corrections in order to reach steady-

    state. CV3 did not overshoot or oscillate but was more sluggish due to its smaller initial moves. In all three cases, the

    models reached their correct steady state values since the controller constantly updates its prediction at each execution

    interval comparing the actual response to its predicted response and makes corrections along the way. This is evident

    by comparing the final MV moves to the initial set of predicted moves.

    If you are unsure of the Process Gain, is it better to err on the side of setting it too small or too large?

    4. Click the Reset Model 1 and Reset Model 3 buttons at any time to restore the default values. Now

    click the Step Decrease button and verify that all three models respond the same before proceeding.

    Now, lets see what happens when your model time constant is incorrect. Now, change the time

    constant of Model1 from 30 to 15 and for Model3 from 30 to 60.

    Observe the predicted MV moves. This time, all predict the correct steady state values (2.0) but the trajectories are very

    different. Model3 has the largest time constant and thus will have the slowest dynamics so the controller attempts to

    make large moves initially to partially compensate for this slowness. Similarly, Model1 has the fastest dynamics so it

    has much smaller moves. Let the simulation run and observe the changes to the MV moves at each refresh.

    What happened?

  • 7/26/2019 Introduccin al modelo predictivo

    9/18

    9 of 18

    As seen above, Model1s smaller time constant results in a sluggish response with overshoot compared to Model2 while

    Model3 has less overshoot but causes MV oscillations and a much longer time for the CV to reach target.

    If you are unsure of the Process time constant, is it better to err on the side of setting it too small or too large?

    5. Reset both models again and click the Step Decrease button before proceeding. Now, lets see what

    happens when your model dead time or delay is incorrect. Now, change the Delay for Model1 from

    15 to 5 and for Model3 from 15 to 30.

    Observe the initial predicted MV moves and CV trajectories. The MV moves are identical and the CV predicted

    trajectories are also the same except they are shifted in time by the different dead-times in the models. We would

    expect this since the gains and time-constants are the same and there is really no way to overcome dead-time by

    making larger or smaller control actions. Let the simulation run and observe what happens.

    What happened?

  • 7/26/2019 Introduccin al modelo predictivo

    10/18

    10 of 18

    As seen above, Model1s smaller dead time meant that the CV should have started responding after 5 seconds but no

    response was actually seen until after 15 seconds so the controller started making larger control actions to compensate.

    But, when the process actually started responding, those added control actions were too large, so changes in the

    opposite direction were needed, resulting in some overshoot and oscillation. Conversely, Model3 was not expecting to

    see any response for 30 seconds but started seeing changes in 15 seconds so it started making smaller corrections,resulting in oscillation and a very sluggish time to steady state.

    If you are unsure of the Process dead time, is it better to err on the side of setting it too small or too large?

    6. So, now we have seen the results of model error on controller response. There is really no right

    answer to the questions of which way is it better to err. It is really dependent on what performance

    criteria is most important - overshoot, speed of response, oscillation, etc. There are also many other

    constraints and tuning parameters for a model predictive controller to improve performance in the

    face of model mismatch which are covers in Workshop II. Try different combinations of model error to

    see how they affect controller responses and then proceed to the next workshop.

    Workshop II Constraints and Tuning

    Model predictive control differs from traditional control algorithms like PID in that it does not have an explicit algebraic equation

    that is computed each control interval. Instead, it solves an optimization problem to minimize some criteria over the prediction

    horizon while at the same time ensuring that all constraints are satisfied. By adjusting the constraints and tuning parameters,

    you can greatly affect the overall controller performance. We will only look at a few key parameters and see their impact on the

    controller.

    1. Before proceeding, make sure that all of the model dynamic parameters are set to their default

    values: K = 1.0, = 30 sec, = 15 sec.

    2. The Desired Value the most common constraint used for CVs. It consists of a value which is the

    target and a coefficient, which is a relative weighting factor used by the controller to see how much

    emphasis should be placed on trying to reduce the CV desired error (Desired Value CV Value) to

    zero. The higher the value, the more aggressive the control actions and the lower the value is, the

    more conservative the control actions. To change the Desired Coefficient, click on the menu arrow at

    the top right of the CV Trend Plot and then select the Edit Variable item.

  • 7/26/2019 Introduccin al modelo predictivo

    11/18

    11 of 18

    Change the Desired Coefficient for CV1 from 1 to 0.1 and for CV3 from 1 to 10. Click the Step button and observer the

    results

    3. As you can see, by changing the desired coefficient, you can adjust the controllers aggressiveness to

    minimize oscillations. This parameter is typically used when there are frequent, short-duration

    disturbances to keep the MV from chasing them. Set the desired coefficients back to 1.0 and click

    the reset button.

    4. There is another option in the target area that we can quickly look at and that is Price. Price or cost is

    a controller mode that instructs the controller to maximize (or minimize) the CV value until some other

    constraint is reached. This is most often used when throughput or production rate is a CV and the

    goal is to maximize production at all times as the process changes. Open the Edit Variable dialog for

    CV1 and set the Use Target value (the drop down list at the far right) to Price and click OK. The

    green line for Desired Value disappears from the chart since you are no longer controlling to a target

    and the MV1 value immediately starts to move to its upper hard constraint and the value of CV1 starts

    to respond accordingly.

    Note: If the y-axis range of the CV trend plot is too small to see the full response, click on the menu button and select Edit

    Display and change the Scaling Style from Manual to Auto with Margin. You can adjust the scaling of any of the trend

    plots this way to suit your preferences.

    5. Another common constraint for CVs are Fuzzy Constraints. A fuzzy constraint should not be

    confused with Fuzzy Logic which is completely different. It is the same as a soft constraint which is

    used to describe a constraint that may be exceeded under the right circumstances unlike a hard

    constraint which can never be exceeded. Fuzzy constraints are most often used when there is not aspecific target to control a CV to but there is a range that it should stay within for normal operation.

    By setting the fuzzy coefficient, you can adjust how hard the controller tries to honor the fuzzy

    constraint. While CV1 is still using Price as the target mode, open the Edit Variable dialog for CV1

    and click the Use checkbox for the Upper Fuzzy Limit and set the Limit to 3 and the coefficient to 1.0.

  • 7/26/2019 Introduccin al modelo predictivo

    12/18

    12 of 18

    6. MV1 moved CV1 away from its maximum value but not all the way to the Fuzzy Limit, shown by thelight green shaded band in the plot. That is because the Fuzzy coefficient is the same as the target

    coefficient so the optimum setting for the controller is a compromise between the two conflicting

    objectives. Now, change the Upper Fuzzy coefficient to 10 and observe what happens. It moves a

    little closer to the limit but still not quite there. You could continue to increase the coefficient to make

    it never exceed the constraint but that defeats the purpose of a soft constraint. If there really is a hard

    limit for a CV, use the Hard Constraints instead of a Fuzzy Constraint with a high coefficient.

    7. The last CV Constraint we will look at is the frustum. The frustum is a funnel shaped soft constraint

    that works in conjunction with the desired value. It causes the controller to be more aggressive when

    the CV value is far from the desired value and less aggressive as it gets closer to target and within

    the frustum funnel. Open the Edit Variable dialog for CV1 and turn off all constraints and switch the

    target mode back to Desired from Price. Click the Use checkbox for Frustrums and set the upper and

    lower values to 0.2 and the dead band to 0.0. The plot should look like the one shown below. Click

    the Step button and compare the CV1 and MV1 to CV2 and MV2.

    8. You will notice that the initial control actions are slightly larger for MV1 than MV2 but then they start todecrease once CV1 gets within the frustum and the time to steady state is almost the same. This

    simple example doesnt provide a good example of how frustums work but you will have more

    opportunities in the next workshop. Before proceeding, set all CVs back to use Desired as the target

    with a coefficient of 1.0 and turn all other constraints off. Do a Step and Reset to verify that all three

    CVs and MVs respond the same.

    9. Now, we will look at MV constraints. Click on the trend plot menu arrow for MV1 and select the Edit

    Variable option.

    In the Hard Constraints section, we see three different constraints. The DCS limits are shown but are not editable. These

    are the absolute limits as imposed by the control system where the MV regulatory loop resides and are absolute. The MV

    Hard Limits used by the controller are usually the same as the DCS constraints but may be made more restrictive in certain

    cases. If the Hard Limits are set outside of the DCS limits, the controller ignores them and uses the DCS limits. The

    controller will never compute a control move that exceeds a DCS or Hard limit UNLESS it is already outside the limits. This

    can happen only if the constraints are changed or the MV is already outside the limits when it is put on control. In this case,

  • 7/26/2019 Introduccin al modelo predictivo

    13/18

    13 of 18

    it will move at the maximum rate possible as specified by the Rate of Change constraints, to move the MV inside of the Hard

    Limits. For example, using the limits shown above, if the MV was at 1.0 and the Lower Hard Limit was changed to 2.0, it

    would move at the maximum rate of 0.4 per move, meaning it would change to 1.4, then 1.8, then 2.0 to get within the new

    constraints. The Rate of Change constraints are also absolute to the controller and the controller will never compute a

    move that exceeds these limits, without exception.

    10. As we have seen so far, when we make a step change, the MV typically makes large initial moves

    and moves beyond its steady state value and then settles down in order to make the CV respond

    faster. Set the Upper Hard Limit for CV1 to 2.1 and set the Rate of change constraints for MV3 to

    0.1. Click the Step button and observe the results.

    11. Sometimes it is desirable to minimize the amount of movement of the MVs due to physical limitations

    of the valves or other actuators involved, As seen above, adjusting various constraints and limits can

    have the desired effect but at the expense of controller responsiveness. Also, by making hard limits

    and rate of change constraints very restrictive, it makes it nearly impossible for the controller to react

    quickly during major process upsets. An alternative is to use the Move Suppression constraint to

    reduce MV movement. Move Suppression allows the MV moves to be smoothed out without severely

    restricting the ability to respond quickly when needed.

    In the previous workshop, we saw that an incorrect dead time in the model can cause serious oscillations in the MV and CV.

    Click on the Model Parameters view and set all three models dead time equal to 30 seconds. Click on the Model Tests

    view and set the Move Suppression value for MV1 to 1.0, for MV2 to 10.0 and for MV3 to 100.0. Leave the Type and

    Multiplier unchanged. Click the Step button and observe the results.

  • 7/26/2019 Introduccin al modelo predictivo

    14/18

    14 of 18

    All three CVs reach steady-state in roughly the same amount of time but CV3 follows a much smoother trajectory and MV3

    has no oscillation at all. Move Suppression is a key tuning parameter when model mismatch is suspected as a source of

    problems and/or when severe oscillations detected in one or more models. Try different Move Suppression values with

    different combinations of model errors to learn more about how the controller will react in different situations. Then, move

    on to Workshop III.

  • 7/26/2019 Introduccin al modelo predictivo

    15/18

    15 of 18

    Workshop III Applying MPC to a Simulated Process

    One of the key advantages of Model Predictive Control over classical control techniques is in dealing with multivariable

    interactions. Our previous workshops were intended to provide a background in basic MPC techniques and terminology to see

    how they can be applied in a real process situation. For this workshop, we will use a simulated chemical process as shown

    below.

    In this process, we have a chemical reactor whose end product is characterized by two quality variables pH and color which

    are Controlled Variables (CVs). The pH is primarily controlled by the base flow and the color by the additive flow into the reactor

    so these are Manipulated Variables (MVs). In addition, the reactor temperature is controlled by adjusting the temperature ofdilutant flow through a heat exchanger so we have a third CV and MV. All three MVs have some effect on the other two CVs

    (except additive to temperature) so there will be more complex interactions than in our previous workshop. Finally, we will

    introduce a third variable type, a Disturbance Variable or DV. A DV is a measured input which has an effect on one or more

    CVs but cannot be manipulated directly. In this process, both the acid flow and dilutant flow are measured and both have an

    effect on all three CVs but they cannot be controlled. The model must take these interactions into account and adjust the three

    MVs to compensate for any changes in the disturbance variables. Our controller matrix looks like this:

    Color pH Rx Temp

    Addi tive Primary Minor Effect None

    Base Minor Effect Primary Minor Effect

    Dil.Temp Minor Effect Minor Effect PrimaryAcid Minor Effect Minor Effect Minor Effect

    Dilutant Minor Effect Minor Effect Minor Effect

  • 7/26/2019 Introduccin al modelo predictivo

    16/18

    16 of 18

    1. Expand the MPC Workshop folder in the navigation tree and click on the Reactor What If? view.

    This view is a scenario analyzer view that allows you to test different input combinations and see

    what effect they have on the outputs. You can see all of the MVs and DVs on the left and the CVs on

    the right. Click the initialize button and then click the Predict Outputs button. This will initialize the

    MVs and DVs to their current values (normally from the control system but in this case from our

    simulator) and run the model to predict where the outputs should be. Click on the Reactor Trendsview to verify that the MVs and DVs have been initialized correctly and that the model accurately

    predicted where the CVs would be. Return to the What If view and change one or more inputs by

    either clicking then dragging the indicator or by clicking on the slider bar and entering a numeric value

    in the dialog box.

    Click the Predict Outputs button again to see what effect your change had on the outputs. Try moving multiple inputs to see

    if you can get the pH to be 8 and the color to be 9 while keeping the temperature at 25.

    2. With a lot of effort, you can probably get close but not exactly. Fortunately, there is a better way.

    Click on the Reactor Setpoint Opt. view and click the Initialize and Predict Inputs buttons. This looks

    similar to the previous view but it has more information. This view works very much like the MPC

    controller in a steady-state sense in that you can set the desired values for the outputs and it will

    determine the optimum steady-state values for the inputs.

    Click on the pH and color bars and enter desired values of 8 and 9 respectively and then click the Predict Inputs button.

    (You can also click and drag the desired indicators at the bottom of each bar instead of typing the numbers in.) This gives

    you the answer immediately instead of the trial and error method previously. You can change the hard constraints on the

    MVs by clicking and dragging the indicators at the bottom of the slider bars to widen or narrow the operating range. Note

    that the acid and dilutant flow indicators look different. This is because they are DVs so their values are clamped to

    whatever you specify. You can move them to different values but the scenario optimizer cannot calculate new values for

    them it just needs to use the specified values in determining the other input values.

    This tool allows the engineer to safely try different scenarios offline, without actually making any changes to the process.

    This can be a very useful tool for testing and validating controllers before putting them online. It also allows you to trydifferent variations to determine whether they are feasible or not. Click the Initialize button and then set the Acid flow to

    2200 and set the Max Hard Constraint for the Base flow to 1100 and click the Predict button. Note that the predicted value

    for pH (the blue indicator at the top) does not move to the desired value of 7. You can see that the Base flow has hit its

    upper limit so this configuration is not feasible. Adjust the Acid flow and Base limit to find a configuration that works for a pH

    of 7.

    Click-hold and drag Click anywhere inside

    Clamped indicator

    Constraints

    Current Value

    Desired Value

    Final Value

    Fuzzy Constraint

  • 7/26/2019 Introduccin al modelo predictivo

    17/18

    17 of 18

    3. The rest of this workshop is to experiment with the various constraints and coefficients on a simulated

    process. Use the Edit Variable dialogs to change desired values and modify constraints. To simulate

    disturbances, click on the Plant Disturbances view and click on the edit icon on the top row labeled

    Averages. In the dialog box that opens, enter new values for the Acid and/or Dilutant flows to

    simulate a process upset and observe how the controller reacts. Adjust the Acid flow between 800

    and 2500 and the Dilutant from 12 to 15.

  • 7/26/2019 Introduccin al modelo predictivo

    18/18

    18of18