tyrrellsystems / node-red-contrib-pid-controller

Apache License 2.0
7 stars 2 forks source link

New Issue for Ged's email #15

Open hardillb opened 8 years ago

hardillb commented 8 years ago

Main Issues

  1. Fire Interlock is working the wrong way around. This should be a True or Boolean 1 to allow the loop to run. Fire is a normally closed input when it is OK.

  2. The integral action does not work properly as far as I can test. The Gain, when set to 10, with a deviation of 1.5 (Setpoint 21, Temperature 19.5), results in an output of 15 with no integral action. The integral action needs to operate as per spec. I tried many values in this box but it certainly does not appear to represent the values shown in the above spec. I expect to be able to put in a value of say 300(s) and have the 15% output added over a 300s period to the output, resulting in an output of 30% after that 300s. It will continue to add that amount until the deviation goes to zero, where the output is held, and when the deviation goes negative, the same calculation is used to deduct from the output until the output gets to 0.

  3. I do not understand why we need to rely on the polling rate of the temperature input to set the reschedule time of the loop, when this, in my view, as per spec, should be fixed inside the loop with an adjustment or even just simply fixed in code at 5s. The guy from Wales who has written his own loop has done this and this is as it is described in the spec.

/cc @davidoc85 @gedtyrrell

hardillb commented 8 years ago

Updates for 1 & 3 pushed, please test as soon as possible.

I will have to spend some more time looking at 2

hardillb commented 8 years ago

@gedtyrrell for 2 We need to clarify terms here when you say Gain, do you mean proportional value?

gedtyrrell commented 8 years ago

Hi Thanks for 1&3.

Yes Gain is another term on PB. PB of 10 means 10 units of deviation between input and Setpoint gives 100% output; Degc in our case. Expressed as Gain it's just easier to understand since Gain of 10 is 10% output for every 1 unit of deviation so temp is 20, Setpoint is 21 with Gain 10 you get 10% on the output.

What we see is no matter what integral action time is set the output is going straight to 100 if input is less than Setpoint. It's explains this in the spec. This is why you have to have a fixed reschedule or recalculation time, typically 5s so that you only increment the output slightly at each recalculation interval. I think your using the input polling time for this but it could be fixed in the node too.

Hope that helps.

Ged Tyrrell Managing Director Tyrrell Systems Ltd m: +447779 712538 w: +44845 0450171 e: ged.Tyrrell@tyrrellsystems.commailto:ged.Tyrrell@tyrrellsystems.com i: www.tyrrellsystems.comhttp://www.tyrrellsystems.com

On 24 Nov 2016, at 10:49, Ben Hardill notifications@github.com<mailto:notifications@github.com> wrote:

@gedtyrrellhttps://github.com/gedtyrrell for 2 We need to clarify terms here when you say Gain, do you mean proportional value?

- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/tyrrellsystems/node-red-contrib-pid-controller/issues/15#issuecomment-262746843, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AQexbLewOk58-ei7rWhw0Gs5mkGT-AFcks5rBWuIgaJpZM4K7eI4.

hardillb commented 8 years ago

Just checked in a new version of the PID loop that hopefully is a lot closer to the spec.

Please delete any current instances of the node in your flow and recreate them after upgrading.

I still need to add some deadband stuff, but it should be closer to what I think we want. Output is now 0-10 rounded to 3 decimal places rather than 0-100 previously.

hardillb commented 8 years ago

@davidoc85 new update with deadband in place. Please test as soon as you can.

Please delete any current instances of the node in your flow and recreate them after upgrading.

I still need to add some deadband stuff, but it should be closer to what I think we want. Output is now 0-10 rounded to 3 decimal places rather than 0-100 previously.

hardillb commented 8 years ago

@davidoc85 @gedtyrrell Any feedback on these updates?

gedtyrrell commented 8 years ago

Hello Ben I have been busy all day sorry and David is away.

I have tested the loop again and it is a lot better but still needs some work.

I have taken some screen shots so you should be able to recreate this.

Shot1) I injected a setpoint of 21. The headband was set to 1. I injected a temperature of 21.5 but it started to add integral action straight away, yet there should be no action until the temperature goes above the setpoint + deadband.

Shot 2) I injected setpoint 21 and temperature 21. Outputs correctly stay at 0. Then I injected 20. The integral action was added to the calculated proportional output. I then injected 21 again. It jumped very sharply on first injection to 20 from 30. See shot 3.

I then injected 21.5 over and over again and the integral action wound down on the heating loop but when it got to zero, it then started to add it to the cooling loop, which should not happen when there is a deadband.

I then injected 19.5 and the heating output shot up to 65.

It is also hard to know what the Integral values mean. They are normally a period of seconds over which the output is added over, being added in increments of the same across the period each time it is recalculated.

Finally, the fire input should be a 1 for normal, going off to disable the loop so it is fail-safe.

I hope this input helps.

Thanks [cid:10668183-E4BD-452D-AC47-B789D9C9F00E][cid:159B596E-F1D0-42B1-9ACE-97B38D1CC9EE][cid:4EE49DA6-1E93-4564-AECD-320E395819AE][cid:AE12CE6B-4AE4-4545-8F8F-5D52F6BF05C8][cid:D5CC2B6C-ABFF-49A0-9A3C-C66C3F288A2E][cid:6433E1EE-E897-4534-A119-86EA003F31C9] Ged

Ged Tyrrell Managing Director

Tyrrell Systems Ltd t: +441942 732819 m: +447779 712538 f: +44845 8056915 i: www.tyrrellsystems.comhttp://www.tyrrellsystems.com e: ged.tyrrell@tyrrellsystems.commailto:ged.tyrrell@tyrrellsystems.com

View our extended services on our new website. Call today to arrange a meeting to discuss any requirements you may have.

On 28 Nov 2016, at 17:15, Ben Hardill notifications@github.com<mailto:notifications@github.com> wrote:

@davidoc85https://github.com/davidoc85 @gedtyrrellhttps://github.com/gedtyrrell Any feedback on these updates?

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/tyrrellsystems/node-red-contrib-pid-controller/issues/15#issuecomment-263332324, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AQexbCn8gjGip_A-YRtlIWsE4x9vrPF2ks5rCwxLgaJpZM4K7eI4.

hardillb commented 8 years ago

@gedtyrrell I can't see any of the images you attached, github seams to have stripped them. Please log into github and add them to the issue directly as I think they will always be stripped when emailed in.

But also I don't think you have the latest version of the code running for several reasons.

1) I've just checked and the current version of the code had the deadband configuration commented out so there was no way to set it as it's not in the config dialogue. I have just updated the repo, with the latest.

2) the Fire control works exactly as you've described. when you send true/1 to the system it runs, when you send false/0 it pushes the outputs to zero. It defaults to true at the start

Please make sure you remove the old version from the flow and re-add it. You should also make sure you refresh the Node-RED editor in the web browser as well as restarting the node-red instance.

davidoc85 commented 8 years ago

Hi Ben,

Back for testing now. Did a few tests and I think it just needs polishing: start Injected a set point of 21, temperature of 21 with the following values: deadband=0.5 Gain=10 Ti=250 (seconds) Recalculation time=5 (secs) The cooling and heating output went to 0.

1) With the same settings, injected a temp value of 16.
Output went straight to 5 for heating and left it there for a while until the output was maxed out at 10. Ok so far, then I injected a temperature slowly (on a 0.5 basis) to decrease the output and it went down to 7.5 when injecting 18.5, then it stayed at 7.5 all the time i.e. it would not increment any more.

2 )Tested with Gain only in a similar way. When increasing the value and reached set point the heating is showing 0 and cooling is showing NAN. Injected up to 24 and cooling is still showing NAN.

Please find the export code attached:

pid test.txt

hardillb commented 7 years ago
davidoc85 commented 7 years ago

Injected a set point of 21, temperature of 21 with the following values: deadband=0.5 Gain=10 Ti=0 (seconds) Recalculation time=5 (secs) The cooling and heating output went to 0.
Injected a temp value of 16. Output went straight to 5 for heating and left it there for a while, then I injected a temperature slowly (on a 0.5 basis) to decrease the output and it went down to 7.5 when injecting 18.5, then it stayed at 7.5. Kept increasing the temperature and when and when got to setpoint, the cooling started to show NaN and the heating was 0.

hardillb commented 7 years ago

OK, that makes sense, Ti can not be zero, as it ends up on the as the bottom of a fraction so you end up with infinity out the other end.

davidoc85 commented 7 years ago

How can we use then a gain only value? In order to tune the pid it is important to have this functionality to see the oscillation level. Can a check be added to see if value is zero, then use gain only part of the algorithm.

David

On 1 Dec 2016, at 15:04, Ben Hardill notifications@github.com wrote:

OK, that makes sense, Ti can not be zero, as it ends up on the as the bottom of a fraction so you end up with infinity out the other end.

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

gedtyrrell commented 7 years ago

Integral can be zero. This is why the spec shows it at a time and that's how it should be. It's the period over which the entire proportional calculated output is added, split across the number of recalculation intervals. If it is set to zero the loop works as P only. You can't have I without P even if the P is tiny.

Ged Tyrrell Managing Director Tyrrell Systems Ltd m: +447779 712538 w: +44845 0450171 e: ged.Tyrrell@tyrrellsystems.commailto:ged.Tyrrell@tyrrellsystems.com i: www.tyrrellsystems.comhttp://www.tyrrellsystems.com

On 1 Dec 2016, at 22:10, David notifications@github.com<mailto:notifications@github.com> wrote:

How can we use then a gain only value? In order to tune the pid it is important to have this functionality to see the oscillation level. Can a check be added to see if value is zero, then use gain only part of the algorithm.

David

On 1 Dec 2016, at 15:04, Ben Hardill notifications@github.com<mailto:notifications@github.com> wrote:

OK, that makes sense, Ti can not be zero, as it ends up on the as the bottom of a fraction so you end up with infinity out the other end.

- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/tyrrellsystems/node-red-contrib-pid-controller/issues/15#issuecomment-264311321, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AQexbMUzk5ViqvE4t4gWr-tPLGx7TQbCks5rD0XZgaJpZM4K7eI4.

hardillb commented 7 years ago

OK, Integral now pinned at zero when Ti = 0.

davidoc85 commented 7 years ago

Have just tested this, however I am still seeing the same issue when Setpoint=21, P=10 and T=0 and temperature reaches setpoint or goes above setpoint the cooling output goes to NaN. Have updated to 0.1.1.

capture

hardillb commented 7 years ago

OK, finally managed to reproduce this and it's fixed.

davidoc85 commented 7 years ago

Just doing the testing live and I have got 0.1.3 installed, however I am still seeing the same issue with the NAN. Is that the latest version? Temperature 22,48; Setpoint=23, Gain=10 and Ti=300; Deadband=0.5

poedk commented 7 years ago

I am testing ver 0.1.4 With Ti set to 0 it works as expected. But as soon as Ti is different from 0 output stays on 0

Any ideas?

gedtyrrell commented 7 years ago

Hi Please make sure you have a value of 1 onto the fire input as this is an interlock.

Ged Tyrrell Managing Director

Tyrrell Systems Ltd t: +441942 732819 m: +447779 712538 f: +44845 8056915 i: www.tyrrellsystems.comhttp://www.tyrrellsystems.com e: ged.tyrrell@tyrrellsystems.commailto:ged.tyrrell@tyrrellsystems.com

View our extended services on our new website. Call today to arrange a meeting to discuss any requirements you may have.

On 23 Mar 2017, at 17:26, poedk notifications@github.com<mailto:notifications@github.com> wrote:

I am testing ver 0.1.4 With Ti set to 0 it works as expected. But as soon as Ti is different from 0 output stays on 0

Any ideas?

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/tyrrellsystems/node-red-contrib-pid-controller/issues/15#issuecomment-288797191, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AQexbCBq7IjQ5-uuiOFSPHgQUxy3_6Qpks5roqtigaJpZM4K7eI4.

poedk commented 7 years ago

Hi Ged,

Thanks for your help, but still no luck.

Gain, Ti, Dead Band and Recalc time set to 1 (for testing).

If I inject false, with topic fire, node shows "FIRE" If I inject true, node shows SP:30 IN: 20.0

But output is 0, no matter what I do. Except if I set Ti to 0, then output changes.

Can you help me?

I want to brew tomorrow, but it is difficult when you need a PID, but only have a P πŸ˜€

/Preben

2017-03-23 23:39 GMT+01:00 gedtyrrell notifications@github.com:

Hi Please make sure you have a value of 1 onto the fire input as this is an interlock.

Ged Tyrrell Managing Director

Tyrrell Systems Ltd t: +441942 732819 <+44%201942%20732819> m: +447779 712538 <+44%207779%20712538> f: +44845 8056915 <+44%20845%20805%206915> i: www.tyrrellsystems.comhttp://www.tyrrellsystems.com e: ged.tyrrell@tyrrellsystems.commailto:ged.tyrrell@tyrrellsystems.com

View our extended services on our new website. Call today to arrange a meeting to discuss any requirements you may have.

On 23 Mar 2017, at 17:26, poedk <notifications@github.com<mailto: notifications@github.com>> wrote:

I am testing ver 0.1.4 With Ti set to 0 it works as expected. But as soon as Ti is different from 0 output stays on 0

Any ideas?

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/ tyrrellsystems/node-red-contrib-pid-controller/issues/ 15#issuecomment-288797191, or mute the threadhttps://github.com/ notifications/unsubscribe-auth/AQexbCBq7IjQ5-uuiOFSPHgQUxy3_ 6Qpks5roqtigaJpZM4K7eI4.

β€” You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tyrrellsystems/node-red-contrib-pid-controller/issues/15#issuecomment-288882051, or mute the thread https://github.com/notifications/unsubscribe-auth/AZZf2MUXZIzLOcKPsUBlG14NfI8uAF9Kks5rovSIgaJpZM4K7eI4 .

chasinreno commented 6 years ago

poedk! or anyone else who cares to answer. :) I also am trying to work this into a temperature controller for making beer and am having some success. How is your's working out? What process did you use to tune? Are you measuring wort temp or enclosure temperature? CC