This example classifies wind-speed samples for a turbine and estimates energy production over a short sequence of intervals.
A turbine has practical operating thresholds: too little wind produces no useful power, moderate wind produces partial power, strong but safe wind reaches rated power, and very high wind stops the turbine for safety.
For each wind-speed sample, the program compares the speed with cut-in, rated, and cut-out thresholds. Below cut-in and at or above cut-out, power is zero. Between cut-in and rated speed, power follows a cubic curve. Between rated speed and cut-out, power is capped at rated power.
Energy is then accumulated by multiplying each interval’s power by the interval duration.
The output lists every interval with speed, status, and power. It also reports four usable intervals and total energy of 1.571 MWh. The interval-by-interval listing makes the aggregate result easier to audit.
The trust gate verifies that every wind sample receives one classification, the interval counts partition the samples, generated power is non-negative, and generated power never exceeds rated power. This catches threshold-boundary and power-curve errors.
From the repository root:
node examples/wind_turbine.js