I am trying to control a heater with either constant power or constant temperature (I have a thermocouple to measure the temperature). So I created 2 PID loops; I set temperature in one and power in the other one. The problem is that both have the same control variable at the output, the heater current.
My initial idea was to enable the PID loop that I need to use with SetPidMode(PID_name,0) while having the other one as manual SetPidMode(PID_name,1) (~disable)
The problem I have is how to deal with the output variable. I think I cannot set the same output variable in both PIDs as they will write in the same variable. The PID in “auto” will write whatever it needs and the PID in “manual” will write something else, constant I guess. So that does not sound like a good idea.
It seems that I can set the output of one PID as host. In this way I can tell to use the output of the other PID, the problem in this case is that I do not know how to configure that. The closest to do so will be to use SetPidOutput(PID_name,value), but this does not seem like the way to go, as with this function I can only set a value for the output of the PID, not a variable.
Any ideas on how to deal with this? Thank you.