DS18B20 smoothing and PID tuning


#81

I was working on a flow that would save my data to a file last night. I ran into an error that wouldn’t go away, no matter what I did so I rebooted Raspberry Pi and it fixed my problem. I wonder if the -infinity% problem might have been something similar?

I can restore the original pid.js and try again if you think it might work.
Charles


#82

I notice the value has disappeared from the pid status too. Can you send me the old pid.js file please? You can private email me: gt at clanlaw dot org dot uk since the forum won’t allow .js files as attachments it seems.


#83

Come to think of it, my profile pic does look like i’m smirking. hmmmm, didn’t mean to do that.


#84

And yes, restore the old file too and see what happens.


#85

Old file restored. I don’t see any change but curiously, no output either. (?)


#86

I also rebooted my pi3 again.


#87

The file looks fine. It does look as if something was horribly confused and the reboot fixed it. Very odd.

By no output do you mean payload of 0? When the pv is high (as it is) the output will be low or zero as the algorithm assumes a process where power increases the setpoint (as in a heating system). So when the process is above setpoint the power is low. When used in a cooling loop the bit following that needs to be set such that 0 generates full cool and 1 generates no cool. When you have the heat/cool splitter node that does that for you so each output is 0 for off, 1 for on. To get it working in heat only mode you can either set (or clear) the Invert checkbox in the Timeprop node (if you are using mine) or if you want to leave that the same then insert a Scale node set to scale 0 to 1 and1 to 0.


#88

Should I restore the split heat/cool and see what happens?


#89

Just noticed you have somehow got the Max Sample Interval setting in the node at zero. That is not valid as it means you expect the max time between process values to be zero. Set it to something larger than the normal interval (I usually have mine at 5 mins). The purpose of this is that if that long elapses between samples then it knows there is something wrong and locks the integral calculations to prevent the error condition winding the integral up to one end. With it at zero the integral will be permanently locked.


#90

I think you can get on with trying to tune just the cool loop first, which if can remember that far back was what the idea was when it all went banana shaped (to use a politically correct metaphor).


#91

hahaha! I haven’t heard that one before but I know exactly what you mean.
I reset all the process parameters and am watching it work as expected. ugh, why didn’t I remember the reboot thing. I’m an old Windows 3.0 user and that should have been the first thing I thought of (The big red switch-fix). In the early days of visual basic (v1.0) a persistent error that defied logic could often be fixed by a reboot.

Thanks for all the help. I learned a lot and hope I didn’t waste to much of your time.

Charles


#92

Fortunately that is much less common a situation on Linux.


#93

I’m restoring my PID flow and noticed that when I disable the PID my cool status out of the “Split heat/cool” node remains at 1. Is there a way to disable PID so both outputs of the spliter are 0?


#94

When you disable it, it goes to the “Output when power disabled” value, so if you set that 0.5 then both should be off.


#95

node.status is the only thing that should set the status (or maybe this.status if you use it that way.)


#96

OK, thanks, that what I thought. It seems that it has stopped doing it and the node is behaving correctly following a reboot - very strange.


#97

@backup - that copyright statement is for the contrib one (from Ben) - not the one we released… (node-red-node-pidcontrol). As Nick pointed out Ben wrote it when he as at IBM - but as his own (contrib) work - not part of the core code /node set - so was never transferred to JS foundation and indeed the copyright would still be with IBM.


#98

As of my own experience with this kind of sensors, I prefer median function better than mean. With a depth of only 10 samples you can get good smoothing without spikes.
It get last readings, order them and select central value.


#99

Hi gmag11!
The smoother I wrote was just an average of 10 samples. How do you get a median? Do you have some sample code?

Charles


#100

FYI The node-red-node-smooth node will do a moving average over the last x readings