Skip to main content
This tutorial walks through building an automated greenhouse vent simulation: a thermostat controller reads temperature and commands a servo; a position sensor reports how far the vent is open. By the end you will have:
  • Defined a custom signal type (VentAngle)
  • Written two custom components from scratch
  • Wired a multi-component simulation graph
  • Run steady-state and transient simulations
  • Added per-run I/O logging (export_telemetry)
  • Optionally trained a hosted ML model from measurements
  • Wrapped everything into a reusable composite component
All code is executable. No hardware required.

The system

A real greenhouse would also include a TemperatureSensor, ADC, and power supply. This tutorial feeds temperature directly into the controller so you can focus on component authoring and graph wiring.

1. Project setup

2. Custom type: VentAngle

3. ThermostatController

Maps temperature linearly to vent openness (0-1) and encodes it as a 50 Hz PWM signal:

4. VentPositionSensor

5. Wire the graph

Fan-out vs fan-in. One output can connect to many inputs (fan-out) on any port. Multiple outputs into one input (fan-in) requires aggregating_input_port() on the target. See Aggregating Input Ports.

6. Steady-state sweep

7. Composite assembly

Package the full control loop as a single reusable component. See Composite Components for the BuildContext API.
Use it as a drop-in single component:

What you learned

The full step-by-step tutorial with hosted ML models, transient, and fault examples is in the TUTORIAL.md file in the Hardwave repository.