Forums

"Bogo process"/plant transfer functions for PID testing

Started by bitrex February 9, 2018
I'm looking for a "bogo process" transfer function for a PID loop plant. 
That is to say something that's not real hardware but just so I can 
calibrate the software/ensure that the loop is generating sane values 
prior to connecting it to a real plant and working on tuning.

The "bogo loop" would just be say PID core -> PWM output/DAC -> analog 
filter -> back into uP via ADC -> digital filter representing the 
transfer function of some idealized plant and sensor -> "virtual" ADC -> 
control value/input summer/error amp -> PID core

Again this isn't to derive any kind of tuning parameters representative 
of the real world, just to sanity-check the software implementation by 
e.g. transmitting real-time values at various nodes in the loop over 
serial to a PC and logging them.

Like maybe a "generic" heater + temperature sensor model or something 
that generates a vaguely realistic lag for some parameters of thermal 
time constant, max power output, and Vout/degree for the sensor
On Friday, February 9, 2018 at 2:06:31 PM UTC-5, bitrex wrote:
> I'm looking for a "bogo process" transfer function for a PID loop plant. > That is to say something that's not real hardware but just so I can > calibrate the software/ensure that the loop is generating sane values > prior to connecting it to a real plant and working on tuning. > > The "bogo loop" would just be say PID core -> PWM output/DAC -> analog > filter -> back into uP via ADC -> digital filter representing the > transfer function of some idealized plant and sensor -> "virtual" ADC -> > control value/input summer/error amp -> PID core > > Again this isn't to derive any kind of tuning parameters representative > of the real world, just to sanity-check the software implementation by > e.g. transmitting real-time values at various nodes in the loop over > serial to a PC and logging them. > > Like maybe a "generic" heater + temperature sensor model or something > that generates a vaguely realistic lag for some parameters of thermal > time constant, max power output, and Vout/degree for the sensor
That's mostly confusing. You can do a simple RC model of your system. R is the thermal resistance and C the heat capacity. JL posted some thermal 'cheat sheet' at some time in the past.... That will have no lag in it. The lag you can somewhat guesstimate from the relative positions of the plant and sensor.. closer is less lag. George H.
On 02/09/2018 02:23 PM, George Herold wrote:
> On Friday, February 9, 2018 at 2:06:31 PM UTC-5, bitrex wrote: >> I'm looking for a "bogo process" transfer function for a PID loop plant. >> That is to say something that's not real hardware but just so I can >> calibrate the software/ensure that the loop is generating sane values >> prior to connecting it to a real plant and working on tuning. >> >> The "bogo loop" would just be say PID core -> PWM output/DAC -> analog >> filter -> back into uP via ADC -> digital filter representing the >> transfer function of some idealized plant and sensor -> "virtual" ADC -> >> control value/input summer/error amp -> PID core >> >> Again this isn't to derive any kind of tuning parameters representative >> of the real world, just to sanity-check the software implementation by >> e.g. transmitting real-time values at various nodes in the loop over >> serial to a PC and logging them. >> >> Like maybe a "generic" heater + temperature sensor model or something >> that generates a vaguely realistic lag for some parameters of thermal >> time constant, max power output, and Vout/degree for the sensor > > That's mostly confusing. > You can do a simple RC model of your system. R is the thermal resistance > and C the heat capacity. JL posted some thermal 'cheat sheet' at some time > in the past.... > That will have no lag in it. The lag you can somewhat guesstimate from the > relative positions of the plant and sensor.. closer is less lag. > > George H. >
Ok, that makes sense. So to model say some kind of idealized box of air or whatever medium with a heater in it, of some size, immersed in some other medium that conducts heat away, I could maybe use an RCR circuit - series R to model the thermal resistance of the heater element and element to "ambient" thermal resistance, C to model the heat capacity of the box, and an R to "ground" to model the escaping heat energy. Multiply s-domain transfer function of that by e^(-sT) to add idealized delay of T seconds to model lag time of the sensor. Seems like that should be straightforward enough to discretize (the Z transform of a delayed sequence is just z^(-m) times the Z transform X(z) of the sequence)
On Friday, February 9, 2018 at 8:39:36 PM UTC-5, bitrex wrote:
> On 02/09/2018 02:23 PM, George Herold wrote: > > On Friday, February 9, 2018 at 2:06:31 PM UTC-5, bitrex wrote: > >> I'm looking for a "bogo process" transfer function for a PID loop plant. > >> That is to say something that's not real hardware but just so I can > >> calibrate the software/ensure that the loop is generating sane values > >> prior to connecting it to a real plant and working on tuning. > >> > >> The "bogo loop" would just be say PID core -> PWM output/DAC -> analog > >> filter -> back into uP via ADC -> digital filter representing the > >> transfer function of some idealized plant and sensor -> "virtual" ADC -> > >> control value/input summer/error amp -> PID core > >> > >> Again this isn't to derive any kind of tuning parameters representative > >> of the real world, just to sanity-check the software implementation by > >> e.g. transmitting real-time values at various nodes in the loop over > >> serial to a PC and logging them. > >> > >> Like maybe a "generic" heater + temperature sensor model or something > >> that generates a vaguely realistic lag for some parameters of thermal > >> time constant, max power output, and Vout/degree for the sensor > > > > That's mostly confusing. > > You can do a simple RC model of your system. R is the thermal resistance > > and C the heat capacity. JL posted some thermal 'cheat sheet' at some time > > in the past.... > > That will have no lag in it. The lag you can somewhat guesstimate from the > > relative positions of the plant and sensor.. closer is less lag. > > > > George H. > > > > Ok, that makes sense. So to model say some kind of idealized box of air > or whatever medium with a heater in it, of some size, immersed in some > other medium that conducts heat away, I could maybe use an RCR circuit - > series R to model the thermal resistance of the heater element and > element to "ambient" thermal resistance, C to model the heat capacity of > the box, and an R to "ground" to model the escaping heat energy. > > Multiply s-domain transfer function of that by e^(-sT) to add idealized > delay of T seconds to model lag time of the sensor. Seems like that > should be straightforward enough to discretize (the Z transform of a > delayed sequence is just z^(-m) times the Z transform X(z) of the sequence)
Air is hard, it's non-linear, I'm not sure the RC thing will work. Conduction, convection, turbulence (chaos :^) George H. George H.
bitrex wrote:
> I'm looking for a "bogo process" transfer function for a PID loop plant. > That is to say something that's not real hardware but just so I can > calibrate the software/ensure that the loop is generating sane values > prior to connecting it to a real plant and working on tuning. > > The "bogo loop" would just be say PID core -> PWM output/DAC -> analog > filter -> back into uP via ADC -> digital filter representing the > transfer function of some idealized plant and sensor -> "virtual" ADC -> > control value/input summer/error amp -> PID core > > Again this isn't to derive any kind of tuning parameters representative > of the real world, just to sanity-check the software implementation by > e.g. transmitting real-time values at various nodes in the loop over > serial to a PC and logging them. > > Like maybe a "generic" heater + temperature sensor model or something > that generates a vaguely realistic lag for some parameters of thermal > time constant, max power output, and Vout/degree for the sensor
I have used Cubie Boards/RasPi/BeagleBone with USB peripherals for this. It works if the plant is slow enough. You can connect to an Arduino and use PWM out into a lowpass filter for very low latency. You still need a good model of the "affinity laws" of the plant. -- Les Cargill
Les Cargill wrote:

snip

> I have used Cubie Boards/RasPi/BeagleBone with USB peripherals > for this. It works if the plant is slow enough. > > You can connect to an Arduino and use PWM out into a lowpass > filter for very low latency. > > You still need a good model of the "affinity laws" of the plant. >
https://www.solid-run.com/nxp-family/hummingboard/ Top quality.
On 02/09/2018 10:21 PM, George Herold wrote:
> On Friday, February 9, 2018 at 8:39:36 PM UTC-5, bitrex wrote: >> On 02/09/2018 02:23 PM, George Herold wrote: >>> On Friday, February 9, 2018 at 2:06:31 PM UTC-5, bitrex wrote: >>>> I'm looking for a "bogo process" transfer function for a PID loop plant. >>>> That is to say something that's not real hardware but just so I can >>>> calibrate the software/ensure that the loop is generating sane values >>>> prior to connecting it to a real plant and working on tuning. >>>> >>>> The "bogo loop" would just be say PID core -> PWM output/DAC -> analog >>>> filter -> back into uP via ADC -> digital filter representing the >>>> transfer function of some idealized plant and sensor -> "virtual" ADC -> >>>> control value/input summer/error amp -> PID core >>>> >>>> Again this isn't to derive any kind of tuning parameters representative >>>> of the real world, just to sanity-check the software implementation by >>>> e.g. transmitting real-time values at various nodes in the loop over >>>> serial to a PC and logging them. >>>> >>>> Like maybe a "generic" heater + temperature sensor model or something >>>> that generates a vaguely realistic lag for some parameters of thermal >>>> time constant, max power output, and Vout/degree for the sensor >>> >>> That's mostly confusing. >>> You can do a simple RC model of your system. R is the thermal resistance >>> and C the heat capacity. JL posted some thermal 'cheat sheet' at some time >>> in the past.... >>> That will have no lag in it. The lag you can somewhat guesstimate from the >>> relative positions of the plant and sensor.. closer is less lag. >>> >>> George H. >>> >> >> Ok, that makes sense. So to model say some kind of idealized box of air >> or whatever medium with a heater in it, of some size, immersed in some >> other medium that conducts heat away, I could maybe use an RCR circuit - >> series R to model the thermal resistance of the heater element and >> element to "ambient" thermal resistance, C to model the heat capacity of >> the box, and an R to "ground" to model the escaping heat energy. >> >> Multiply s-domain transfer function of that by e^(-sT) to add idealized >> delay of T seconds to model lag time of the sensor. Seems like that >> should be straightforward enough to discretize (the Z transform of a >> delayed sequence is just z^(-m) times the Z transform X(z) of the sequence) > > Air is hard, it's non-linear, > I'm not sure the RC thing will work. > Conduction, convection, turbulence (chaos :^) > > George H. > > > George H. >
It doesn't need to be realistic, it's not for tuning, just for ensuring there aren't any bugs in the implementation before trying to connect it to anything real.
On 02/09/2018 10:43 PM, Les Cargill wrote:
> bitrex wrote: >> I'm looking for a "bogo process" transfer function for a PID loop >> plant. That is to say something that's not real hardware but just so I >> can calibrate the software/ensure that the loop is generating sane >> values prior to connecting it to a real plant and working on tuning. >> >> The "bogo loop" would just be say PID core -> PWM output/DAC -> analog >> filter -> back into uP via ADC -> digital filter representing the >> transfer function of some idealized plant and sensor -> "virtual" ADC >> -> control value/input summer/error amp -> PID core >> >> Again this isn't to derive any kind of tuning parameters >> representative of the real world, just to sanity-check the software >> implementation by e.g. transmitting real-time values at various nodes >> in the loop over serial to a PC and logging them. >> >> Like maybe a "generic" heater + temperature sensor model or something >> that generates a vaguely realistic lag for some parameters of thermal >> time constant, max power output, and Vout/degree for the sensor > > I have used Cubie Boards/RasPi/BeagleBone with USB peripherals > for this. It works if the plant is slow enough. > > You can connect to an Arduino and use PWM out into a lowpass > filter for very low latency. > > You still need a good model of the "affinity laws" of the plant. >
Yeah, that's along the lines I was going for. A "dummy plant" black box providing some reconfigurable input to output transfer function in the analogy of a "dummy load" for an amplifier; if the software isn't generating sane values with an idealized model of e.g. a heater or motor or something then there's little point in taking the time to hooking it up to anything real.
> -> digital filter representing the > transfer function of some idealized plant and sensor
In the old days they used analog computers for that. Popular book here in Germany claimed these 10 were typical basic test cases for plants: http://www.embeddedFORTH.de/temp/linear.pdf Simulating real plants would be a combination. But not too complex, assuming the controler was limited to PID. * thermal loops are very slow, thats bad for OP-AMPs. But nobody would simulate them in real time. * one would ad noise. Broadband white noise is not realistic. 1/f seems to be more real world. http://www.embeddedFORTH.de/temp/noise.pdf * delay elements are hard with OP-AMPs. There exist circuits using Padé approximations. They do not ideal step response, but they are probably good enough for the real world that does not ideal steps either. But one would have to use SC-filters to make the delay easy to program. * real world is nonlinear, there it gets realy hard doing simulations with analog circuits. MfG JRD
On Saturday, February 10, 2018 at 8:38:21 AM UTC-5, bitrex wrote:
> On 02/09/2018 10:21 PM, George Herold wrote: > > On Friday, February 9, 2018 at 8:39:36 PM UTC-5, bitrex wrote: > >> On 02/09/2018 02:23 PM, George Herold wrote: > >>> On Friday, February 9, 2018 at 2:06:31 PM UTC-5, bitrex wrote: > >>>> I'm looking for a "bogo process" transfer function for a PID loop plant. > >>>> That is to say something that's not real hardware but just so I can > >>>> calibrate the software/ensure that the loop is generating sane values > >>>> prior to connecting it to a real plant and working on tuning. > >>>> > >>>> The "bogo loop" would just be say PID core -> PWM output/DAC -> analog > >>>> filter -> back into uP via ADC -> digital filter representing the > >>>> transfer function of some idealized plant and sensor -> "virtual" ADC -> > >>>> control value/input summer/error amp -> PID core > >>>> > >>>> Again this isn't to derive any kind of tuning parameters representative > >>>> of the real world, just to sanity-check the software implementation by > >>>> e.g. transmitting real-time values at various nodes in the loop over > >>>> serial to a PC and logging them. > >>>> > >>>> Like maybe a "generic" heater + temperature sensor model or something > >>>> that generates a vaguely realistic lag for some parameters of thermal > >>>> time constant, max power output, and Vout/degree for the sensor > >>> > >>> That's mostly confusing. > >>> You can do a simple RC model of your system. R is the thermal resistance > >>> and C the heat capacity. JL posted some thermal 'cheat sheet' at some time > >>> in the past.... > >>> That will have no lag in it. The lag you can somewhat guesstimate from the > >>> relative positions of the plant and sensor.. closer is less lag. > >>> > >>> George H. > >>> > >> > >> Ok, that makes sense. So to model say some kind of idealized box of air > >> or whatever medium with a heater in it, of some size, immersed in some > >> other medium that conducts heat away, I could maybe use an RCR circuit - > >> series R to model the thermal resistance of the heater element and > >> element to "ambient" thermal resistance, C to model the heat capacity of > >> the box, and an R to "ground" to model the escaping heat energy. > >> > >> Multiply s-domain transfer function of that by e^(-sT) to add idealized > >> delay of T seconds to model lag time of the sensor. Seems like that > >> should be straightforward enough to discretize (the Z transform of a > >> delayed sequence is just z^(-m) times the Z transform X(z) of the sequence) > > > > Air is hard, it's non-linear, > > I'm not sure the RC thing will work. > > Conduction, convection, turbulence (chaos :^) > > > > George H. > > > > > > George H. > > > > It doesn't need to be realistic, it's not for tuning, just for ensuring > there aren't any bugs in the implementation before trying to connect it > to anything real.
OK, I guess I'd make a big dummy load of power resistors and turn it on. (I turn down the current limit for the PS when first firing up a board.) George H.