Looking for PID library


Has anyone worked up a PID library or class? I’ve seen some posts in the Imp WayBack machine, but nothing recent. I’d like to work up some code for area heating by controlling fan speed to move passive solar hot air. I can do a simple thermostat type function, but thought PID would provide better regulation. But maybe that’s overkill?

I’m mostly looking for a library to handle the math functions, since that’s a weak point of mine. Suggestion welcome.