Skip to content
LIBRARY
Examples.HVAC.HVACPlant.md

Examples.HVAC.HVACPlant ​

Linear thermal model of a house heated by a heat pump through floor heating, the model of the DyadControlSystems HVAC tutorial (https://help.juliahub.com/dyad/DyadControlSystems.jl/stable/examples/hvac/). Four lumped temperatures — wall, indoor air, floor and circulating water — exchange heat with time constants in hours; the heat pump's compressor power level power (kW, 0–4) heats the water and the outdoor temperature Text acts on the wall. Time is in hours.

Misplaced &

The output y is the indoor temperature. The model is linear, so its linearization is exact; HVACClosedLoop gives the plant itself to its MPC as the prediction model.

Usage ​

MPCComponents.Examples.HVAC.HVACPlant(tau_wall_ext=48.0, tau_wall_int=18.0, tau_int_floor=3.6, tau_water_floor=6.0, input_gain=0.1666, T0=18.0)

Parameters: ​

NameDescriptionUnitsDefault value
tau_wall_extWall–outdoor time constant [h]–48.0
tau_wall_intWall–indoor air time constant [h]–18.0
tau_int_floorIndoor air–floor time constant [h]–3.6
tau_water_floorWater–floor time constant [h]–6.0
input_gainHeating gain of the compressor power [°C/(h kW)], COP 4.9 × 0.034–0.1666
T0Initial temperature of all four lumps [°C]–18.0

Connectors ​

  • power - This connector represents a real signal as an input to a component (RealInput)

  • Text - This connector represents a real signal as an input to a component (RealInput)

  • y - This connector represents a real signal as an output from a component (RealOutput)

Variables ​

NameDescriptionUnits
TwallWall temperature [°C]–
TintIndoor air temperature [°C]–
TfloorFloor temperature [°C]–
TwaterCirculating water temperature [°C]–

Behavior ​

Behavior of this component cannot be rendered because it includes path variables.

Source ​

dyad
"""
Linear thermal model of a house heated by a heat pump through floor heating, the model of the
DyadControlSystems HVAC tutorial (https://help.juliahub.com/dyad/DyadControlSystems.jl/stable/examples/hvac/).
Four lumped temperatures — wall, indoor air, floor and circulating water — exchange heat with time
constants in hours; the heat pump's compressor power level `power` (kW, 0–4) heats the water and the
outdoor temperature `Text` acts on the wall. Time is in hours.

```math
\\begin{aligned}
\\dot T_{wall} &= (T_{ext} - T_{wall})/\\tau_{wall,ext} + (T_{int} - T_{wall})/\\tau_{wall,int} \\\\
\\dot T_{int} &= (T_{wall} - T_{int})/\\tau_{wall,int} + (T_{floor} - T_{int})/\\tau_{int,floor} \\\\
\\dot T_{floor} &= (T_{int} - T_{floor})/\\tau_{int,floor} + (T_{water} - T_{floor})/\\tau_{water,floor} \\\\
\\dot T_{water} &= (T_{floor} - T_{water})/\\tau_{water,floor} + k_{in}\\, power
\\end{aligned}
```

The output `y` is the indoor temperature. The model is linear, so its linearization is exact;
`HVACClosedLoop` gives the plant itself to its MPC as the prediction model.
"""
component HVACPlant
  "Heat-pump compressor power level [kW]"
  power = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 350, "x2": 0, "y2": 450, "rot": 0}
      },
      "tags": []
    }
  }
  "Outdoor temperature [°C]"
  Text = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 550, "x2": 0, "y2": 650, "rot": 0}
      },
      "tags": []
    }
  }
  "Indoor air temperature [°C]"
  y = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Wall–outdoor time constant [h]"
  parameter tau_wall_ext::Real = 48.0
  "Wall–indoor air time constant [h]"
  parameter tau_wall_int::Real = 18.0
  "Indoor air–floor time constant [h]"
  parameter tau_int_floor::Real = 3.6
  "Water–floor time constant [h]"
  parameter tau_water_floor::Real = 6.0
  "Heating gain of the compressor power [°C/(h kW)], COP 4.9 × 0.034"
  parameter input_gain::Real = 0.1666
  "Initial temperature of all four lumps [°C]"
  parameter T0::Real = 18.0
  "Wall temperature [°C]"
  variable Twall::Real(initial = T0)
  "Indoor air temperature [°C]"
  variable Tint::Real(initial = T0)
  "Floor temperature [°C]"
  variable Tfloor::Real(initial = T0)
  "Circulating water temperature [°C]"
  variable Twater::Real(initial = T0)
relations
  der(Twall) = (Text - Twall) / tau_wall_ext + (Tint - Twall) / tau_wall_int
  der(Tint) = (Twall - Tint) / tau_wall_int + (Tfloor - Tint) / tau_int_floor
  der(Tfloor) = (Tint - Tfloor) / tau_int_floor + (Twater - Tfloor) / tau_water_floor
  der(Twater) = (Tfloor - Twater) / tau_water_floor + input_gain * power
  y = Tint
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MPCComponents/HVACPlant.svg"},
    "doc": {"behavior": false}
  }
}
end
Flattened Source
dyad
"""
Linear thermal model of a house heated by a heat pump through floor heating, the model of the
DyadControlSystems HVAC tutorial (https://help.juliahub.com/dyad/DyadControlSystems.jl/stable/examples/hvac/).
Four lumped temperatures — wall, indoor air, floor and circulating water — exchange heat with time
constants in hours; the heat pump's compressor power level `power` (kW, 0–4) heats the water and the
outdoor temperature `Text` acts on the wall. Time is in hours.

```math
\\begin{aligned}
\\dot T_{wall} &= (T_{ext} - T_{wall})/\\tau_{wall,ext} + (T_{int} - T_{wall})/\\tau_{wall,int} \\\\
\\dot T_{int} &= (T_{wall} - T_{int})/\\tau_{wall,int} + (T_{floor} - T_{int})/\\tau_{int,floor} \\\\
\\dot T_{floor} &= (T_{int} - T_{floor})/\\tau_{int,floor} + (T_{water} - T_{floor})/\\tau_{water,floor} \\\\
\\dot T_{water} &= (T_{floor} - T_{water})/\\tau_{water,floor} + k_{in}\\, power
\\end{aligned}
```

The output `y` is the indoor temperature. The model is linear, so its linearization is exact;
`HVACClosedLoop` gives the plant itself to its MPC as the prediction model.
"""
component HVACPlant
  "Heat-pump compressor power level [kW]"
  power = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 350, "x2": 0, "y2": 450, "rot": 0}
      },
      "tags": []
    }
  }
  "Outdoor temperature [°C]"
  Text = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 550, "x2": 0, "y2": 650, "rot": 0}
      },
      "tags": []
    }
  }
  "Indoor air temperature [°C]"
  y = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Wall–outdoor time constant [h]"
  parameter tau_wall_ext::Real = 48.0
  "Wall–indoor air time constant [h]"
  parameter tau_wall_int::Real = 18.0
  "Indoor air–floor time constant [h]"
  parameter tau_int_floor::Real = 3.6
  "Water–floor time constant [h]"
  parameter tau_water_floor::Real = 6.0
  "Heating gain of the compressor power [°C/(h kW)], COP 4.9 × 0.034"
  parameter input_gain::Real = 0.1666
  "Initial temperature of all four lumps [°C]"
  parameter T0::Real = 18.0
  "Wall temperature [°C]"
  variable Twall::Real(initial = T0)
  "Indoor air temperature [°C]"
  variable Tint::Real(initial = T0)
  "Floor temperature [°C]"
  variable Tfloor::Real(initial = T0)
  "Circulating water temperature [°C]"
  variable Twater::Real(initial = T0)
relations
  der(Twall) = (Text - Twall) / tau_wall_ext + (Tint - Twall) / tau_wall_int
  der(Tint) = (Twall - Tint) / tau_wall_int + (Tfloor - Tint) / tau_int_floor
  der(Tfloor) = (Tint - Tfloor) / tau_int_floor + (Twater - Tfloor) / tau_water_floor
  der(Twater) = (Tfloor - Twater) / tau_water_floor + input_gain * power
  y = Tint
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MPCComponents/HVACPlant.svg"},
    "doc": {"behavior": false}
  }
}
end


Test Cases ​

No test cases defined.

  • Examples

  • Experiments

  • Analyses