Hello, I need to implement a Newton search algorithm to control space pressure using modulating fans. Is there a website or library where this type of Niagara control logic is shared and can be copied or used as a reference? Thanks.
Not aware of a public library with a Newton search for this. Most sites run a LoopPoint on space pressure into fan speed and tune it slow. If you want the search anyway, it’s easy enough in a Program object:
- Run it on a fixed interval (30-60 s) so the space settles between moves.
- Error = setpoint minus measured pressure.
- Estimate the slope from the last two samples: dP / dSpeed (really a secant step, which is fine here).
- New speed = speed + error / slope.
- Clamp the step to a few percent, clamp min/max speed, and add a deadband. Fall back to a small fixed step if the slope is near zero or the wrong sign.
- Hold output and clear history when the fan is off or in alarm.
I have done this on a few sites using a BQL to average the sensors if there’s one per floor or a lot. Have also done the loop point method just using a Niagara loop.
(I work on BMSDeveloper so sequences like this are exactly what I spend my time on compiling these into Workbench components.)