Thermostat PID¶
Adds feedback — backward information flow within a single timestep.
GDS Decomposition¶
Composition¶
(sensor >> controller >> plant >> update).feedback([
Energy Cost: plant -> controller CONTRAVARIANT
])
flowchart TD
Temperature_Sensor([Temperature Sensor]) --> PID_Controller[PID Controller]
PID_Controller --> Room_Plant[Room Plant]
Room_Plant --> Update_Room[[Update Room]]
Room_Plant ==Energy Cost==> PID_Controller
What You'll Learn¶
.feedback()composition for within-timestep backward flow- CONTRAVARIANT flow direction (backward_out → backward_in)
- ControlAction role — reads state and emits control signals
backward_in/backward_outports on block interfaces- Multi-variable Entity (Room has both temperature and energy_consumed)
Key distinction
Room Plant is ControlAction (not Mechanism) because it has backward_out. Mechanisms cannot have backward ports.