Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for cascading PID #203

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

deiger
Copy link

@deiger deiger commented Jan 16, 2024

No description provided.

@deiger
Copy link
Author

deiger commented Jan 24, 2024

Works really well:
graph

@deiger
Copy link
Author

deiger commented Feb 11, 2024

Hey, will you be able to review this PR?

@ScratMan ScratMan self-requested a review February 14, 2024 16:03
Copy link
Owner

@ScratMan ScratMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get the point to cascade two PIDs in the code. It doubles the PID loops and all the corresponding parameters.

Cascading PIDs is relevant for systems on which you need very accurate regulation while variation on one of the input can create large output changes.
Room temperature regulation criticity level is not so high, I think, and don't require cascaded PID.
Could you please explain how you are using this ?

@deiger
Copy link
Author

deiger commented Feb 15, 2024

I don't get the point to cascade two PIDs in the code. It doubles the PID loops and all the corresponding parameters.

Cascading PIDs is relevant for systems on which you need very accurate regulation while variation on one of the input can create large output changes. Room temperature regulation criticity level is not so high, I think, and don't require cascaded PID. Could you please explain how you are using this ?

There is a large delay between the in-floor temperature and the room temperature. If I turn on the heating, the floor temperature can get up to 40°C before the room warms up. The cascading PID helps by allowing capping the max floor temperature, as well as have better regulation, with parameters that properly address the heating delay. Considering that in practice the heating is layered (heating body -> floor, floor -> room), it makes sense for the regulation to be layered as well.

@ScratMan
Copy link
Owner

OK, 40°C is the absolute maximum water temperature limit for underfloor heating, that's strange that your system reaches such high temperature.
The system should rather use a heating curve to adjust the water temperature based on outdoor temperature, with gain and offset adjusted to compensate the losses of your house. It would allow to have almost constant heating power delivered to your floor, softening the regulation of the (single) PID.

That's what I'm using at home, using the heating curve on my boiler with it's external temperature sensor ; and a Netatmo thermostat that uses a PID. During cold rainy days, the maximum temperature overshoot is 0.2°C.

@deiger
Copy link
Author

deiger commented Feb 15, 2024

It's an electric system, not water based, so it's just an on/off system.
The mentioned temperature is the temperature measured under the floor - I have two DS18B20 sensors in every room, one under the floor, and the other in the room. The floor tiles take time to heat up, and then radiate the heat.

@ScratMan
Copy link
Owner

Wouldn't it be simpler to set two thermostat: one to control the floor temperature when heating, with it's setpoint depending on outside temperature to emulate the heating curve, and the second thermostat (the main one) that will control the first, requesting heating by turning it on and off.
That would be a much simpler and more reliable solution to me compared to trying to maintain a single thermostat with two cascaded PIDs that must still work with only one.

@deiger
Copy link
Author

deiger commented Feb 15, 2024

I'm not sure how that would be easier. I don't really care for the floor temperature itself, besides preventing over-heating, so exposing another thermostat doesn't help.
pidtuner.com works the same ingenerating a pid for either an on/off by pwm, or for temperature mapping. Using the cascading PID makes the thermostat far more accurate in its response, since the intermediary sensor is taken into account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants