model predictive control - github pages...ii.matlab built-in functions. matlab 1.high-fidelity...

113
Lecture 9 Principles of Modeling for Cyber-Physical Systems Instructor: Madhur Behl Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 1 Model Predictive Control Slides adapted from: Mark Canon (U. of Oxford) Manfred Morari (ETH, UPenn) Alberto Bemporad (IMT Lucca)

Upload: others

Post on 13-Feb-2021

13 views

Category:

Documents


0 download

TRANSCRIPT

  • Lecture 9

    Pr inc ip les of Model ing for Cyber-Phys ica l Systems

    Instructor: Madhur Behl

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 1

    Model Predictive Control

    Slides adapted from: Mark Canon (U. of Oxford)Manfred Morari (ETH, UPenn)Alberto Bemporad (IMT Lucca)

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 2

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 3

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 4

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 5

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 6

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 7

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 8

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 9

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 10

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 11

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 12

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 13

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 14

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 15

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 16

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 17

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 18

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 19

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 20

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 21

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 22

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 23

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 24

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 25

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 26

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 27

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 28

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 29

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 30

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 31

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 32

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 33

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 34

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 35

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 36

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 37

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 38

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 39

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 40

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 41

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 42

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 43

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 44

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 45

  • MPC: Mathematical formulation

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 46

  • MPC: Mathematical formulation

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 47

  • Receding horizon philosophy

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 48

  • MPC: Mathematical formulation

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 49

  • Receding horizon philosophy

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 50

  • Energy Efficient Building Control

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 51

  • Energy Efficient Building Control

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 52

  • Energy Efficient Building Control

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 53

  • Constraints

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 54

  • Constrained Infinite Time Optimal Control

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 55

  • Constrained Finite Time Optimal Control (CFTOC)

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 56

  • On-line Receding Horizon Control

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 57

  • On-line Receding Horizon Control

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 58

  • Unconstrained problem

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 59

  • Unconstrained problem

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 60

  • Unconstrained problem

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 61

  • Unconstrained problem

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 62

  • Unconstrained problem

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 63

  • Unconstrained problem

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 64

  • Unconstrained problem

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 65

  • Unconstrained problem

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 66

  • Example

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 67

  • Example

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 68

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 69

  • Example

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 70

  • Example

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 71

  • Example

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 72

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 73

  • MPC challenges

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 74

  • Literature

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 75

  • MPC for buildings

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 76

  • MPC for buildings

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 77

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 78

  • Disturbances

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 79

  • Controlled variables

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 80

  • Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 81

  • MLE+

    MLE+ Overview

    2. The scientific computational capability of Matlab/Simulink:I.Matlab Toolboxes

    II.Matlab Built-in Functions.

    Matlab

    1. High-Fidelity Physical models of the whole-building Energy Simulator EnergyPlus.

    E+

    BACnet

    3. Control Synthesis - Building Control Deployment.

    82Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • EnergyPlus Building Model 1 System Identification2

    Control Deployment54 Simulation ResultsControl Design inMatlab

    3

    From Control/Scheduling Algorithmsto Synthesis and Deployment in Real Buildings

    MLE+ Workflow

    83Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • EnergyPlus Building Modelü Small office building with 3 zonesü Chicago weather file during winterü Model Predictive Control:

    o Minimize the power consumption of the radiant heatero Maintain thermal comfort (22°C - 24°C)

    Advanced Controls: Model Predictive Control (MPC)

    84Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • Inputs to EnergyPlus

    Outputs from EnergyPlus

    Variable Configuration Screen1. Parses E+ File to abstract IN/OUT2. Selects Inputs/Outputs3. Writes Configuration File Automatically

    Advanced Controls: Variable Configuration

    85Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • Inputs to EnergyPlus

    Outputs from EnergyPlus

    Configuration File1. .xml file contains Co-Simulation Exchange Variables2. Inputs to E+

    • Power of radiant heating system3. Outputs from E+

    • Room temperatures• Radiant heating system power

    Advanced Controls: Input/Output Configuration

    86Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • System Identification1. Random Signal Generator2. IDINPUT (Matlab Built-in

    function)3. Package Data: IDDATA

    (Matlab Built-in type)4. Import to System

    Identification Toolbox (IDENT)

    Advanced Controls: System Identification

    87Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • System Identification (2)1. Estimate Model According

    (IDENT)2. Inputs:

    • Radiant Power• Outside Temp• Solar Radiation

    3. Outputs:• Room Temp

    Advanced Controls: System Identification (2)

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 88

  • ü Use template script to specify controllerü Easily integrate with Matlab’s Model Predictive Control toolbox.ü MPC:

    ü Prediction Horizon: 2ü Control Horizon: 9ü Minimize Total Power Consumption

    Advanced Controls: Control Design

    89Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • Simulation Resultsü Displays and save results in Matlab

    8 am 6 pm

    Advanced Controls: Simulation Results

    90Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • Simulink Example: Co-Design & Controlsü 5 Zone Buildingü California Weather Fileü July 1st – 7th (Summer Time)ü VAV System

    Integrated Modeling: MLE+ Simulink

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 91

  • HVAC

    E+ Building

    Integrated Modelingü E+ Buildingü VAV model in Simulinkü Inputs to E+:

    ü Heat Flowü Outputs from E+

    ü Room Tempü Outdoor Temp

    Integrated Modeling: Simulation Overview

    92Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • HVAC System• Temperature Setpoints according to

    Schedule• Central HVAC Model• VAV Boxes

    CentralHVAC

    VAV BoxesOccupancy Setpoints

    Integrated Modeling: HVAC System

    93Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • VAV Model1. Thermostat2. Reheat Coil

    VAV Box

    Integrated Modeling: VAV boxes

    94Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • Thermostat

    Reheat Coilü VAV Boxü Inputs:

    ü Setpointsü Room Tempü Supply Air Temp

    ü Outputs:ü Mass Flow Rate

    ü Thermostat Room Levelü Heat/FreeCool/Mec

    hanicalCoolü Reheat Coil

    Integrated Modeling: VAV Box

    95Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • MLE+ is a featured third party tool recognized by DoE

    96Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • Campus-Wide Simulation

    Supply SideEPlus LoadProfilerobject

    Demand SideEPlus TemperatureSource object

    MLE+ S function block in Simulink

    97Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • MLE+ Over 400+

    users

    98Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • How are building models obtained today ?

    White Box

    1/Ugw

    1/Ugi

    1/Ugo

    Cgo

    Cgi

    Tgo

    Tg

    Tgi

    Tz

    Q.rad,e

    1/Uei1/Uew1/Ueo

    Ceo Cei

    TaTeo Tei

    Q.sol,eQ.solt/2

    1/Uci

    1/Ucw

    1/UcoCci

    Cci

    Ta

    Q.sol,c

    Q.rad,c

    TaQ.conv + Q.sens

    1/Uii 1/Uiw 1/Uio

    Cii Cio

    Tci

    Tco

    1/Uwin Tii Tio

    Q.solt/2

    Q.rad,g

    [ExternalWalls]

    Ti

    [Ceiling]

    [Floor]

    [InternalWalls]

    [Windows]

    Grey Box

    Black Box

    99Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • How are building models obtained today ?

    White Box

    Grey Box

    Black Box

    100Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • White-Box Modeling

    Hire building modeling experts

    Set parametersFloor by floorZone by zoneWall by wall

    Layer by layerEquipment by

    equipmentTransfer geometry

    Floor PlanHVAC layout

    Not always

    available

    Guess nominalparameter

    values

    First principles basedHigh fidelity

    Building energy simulation

    Model TuningData

    Sensor retrofits

    101Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • White-Box Modeling

    Hire building modeling experts

    Set parametersFloor by floorZone by zoneWall by wall

    Layer by layerEquipment by

    equipmentTransfer geometry

    Floor PlanHVAC layout

    Not always

    available

    Guess nominalparameter

    values

    First principles basedHigh fidelity

    Building energy simulation

    Model TuningData

    Sensor retrofits

    Cost and time prohibitive(sensor installation, commissioning & expertise)

    Not suitable for model-based controlModel complexity and uncertainty, (1000’s parameters and states)

    102Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • How are building models obtained today ?

    White Box

    1/Ugw

    1/Ugi

    1/Ugo

    Cgo

    Cgi

    Tgo

    Tg

    Tgi

    Tz

    Q.rad,e

    1/Uei1/Uew1/Ueo

    Ceo Cei

    TaTeo Tei

    Q.sol,eQ.solt/2

    1/Uci

    1/Ucw

    1/UcoCci

    Cci

    Ta

    Q.sol,c

    Q.rad,c

    TaQ.conv + Q.sens

    1/Uii 1/Uiw 1/Uio

    Cii Cio

    Tci

    Tco

    1/Uwin Tii Tio

    Q.solt/2

    Q.rad,g

    [ExternalWalls]

    Ti

    [Ceiling]

    [Floor]

    [InternalWalls]

    [Windows]

    Grey Box

    Black Box

    103Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • Grey-Box [Inverse] Modeling

    Hire building modeling experts

    Set parametersFloor by floorZone by zoneWall by wall

    Layer by layerEquipment by

    equipmentTransfer geometry

    Floor PlanHVAC layout

    Not always

    available

    Guess nominalparameter

    values

    Parameter Estimation

    DataSensor retrofits

    Lumped Parameter‘RC’ model 104Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • Grey-Box Modeling

    Hire building modeling experts

    Set parametersFloor by floorZone by zoneWall by wall

    Layer by layerEquipment by

    equipmentTransfer geometry

    Floor PlanHVAC layout

    Not always

    available

    Guess nominalparameter

    values

    Parameter Estimation

    DataSensor retrofits

    Lumped Parameter‘RC’ model

    Promising but still cost and time prohibitive(sensor installation, commissioning & expertise

    Modeling uncertainty,Time-varying parameters)

    Suitable for model-based control(10-100’s parameters and states)

    105Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • Cost and Time prohibitive modeling

    Project duration: May 2007 – March 2015

    Phase 1: EnergyPlus model (white-box), RC model (grey box), MPC development and evaluation. [Only simulated studies]

    Phase 2: Retrofitted building with sensors, commercial MPC software, demand response, peak reduction, uncertain models..

    “..the biggest hurdle to mass adoption of intelligent building control is the cost and effort required to capture accurate dynamical models of

    the buildings.”

    Sturzenegger, D.; Gyalistras, D.; Morari, M.; Smith, R.S., "Model Predictive Climate Control of

    a Swiss Office Building: Implementation, Results, and Cost-Benefit Analysis," Control Systems

    Technology, IEEE Transactions on , vol.PP, no.99, pp.1,1, March 2015

    106Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • How are building models obtained today ?

    White Box

    Grey Box

    Black Box

    107Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • Black-Box Modeling

    Data

    Could beautomated

    Feature engineering

    Not well aligned with control synthesis

    Coarse grained predictions

    Non-physical parameters

    108Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • Too many sub-systemsNon-linear interactions

    Modeling using first principles is hard !

    Each building design is different.Must be uniquely modeled

    Long operational lifetimes~50-100 years

    109Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • Energy Systems Modeling

    Suitability for control

    Mod

    elin

    g Di

    fficu

    lty

    (cos

    t)

    UnsuitableSuitable

    High

    Lo

    w

    White Box

    Grey Box

    Black Box

    110Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • Foundations of Data Predictive Control for CPS

    mbCRT DPC-RT Ensemble-DPC

    Single-step look ahead[with single reg. trees]

    Finite receding horizon[with single reg. trees]

    Finite receding horizon[with ensemble models]

    111Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • Foundations of Data Predictive Control for CPS

    mbCRT DPC-RT Ensemble-DPC

    Single-step look ahead[with single reg. trees]

    Finite receding horizon[with single reg. trees]

    Finite receding horizon[with ensemble models]

    112

    - ICCPS ‘16, BuildSys 15, CISBAT 15, Journal of Applied Energy- Best Paper Award (SRC TECHCON-IoT): ‘Sometimes, Money Does Grow on Trees’-Ph.D. Dissertation: Madhur Behl, UPenn(2016)

    - ACM BuildSys 16 (Best Presentation Award )

    - ACM Transactions of Cyber Physical Systems.

    - American Control Conference 17 (Best Energy Systems Paper Award )

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected]

  • Energy CPS Module RecapReview of ODEs and dynamical systems.State-Space modeling and implementation

    in MATLAB, LTI models.First principles – Generalized systems

    theory.Heat transfer basics.HVAC systems and electricity markets

    overview.Introduction to EnergyPlus.‘RC’ network based state-space thermal

    modeling.

    Nominal values of parameters from IDF file.Parameter estimation optimizationNon-linear least squares.Model evaluation and goodness of fit.Model sensitivity analysis and experiment

    designModel predictive control basicsCodebase to learn a state-space model from

    any data-set.

    Principles of Modeling for CPS – Fall 2018 Madhur Behl [email protected] 113