"Global Name" value
In v1.1RC (1.0.1 build 10) How do we use(view) a Global variable inside a script, the 'new' command makes a new variable, the 'global' command is not recognized...
Thank you!!
Since it is an element, not a variable, you do not need to declare it inside a script. Just access it via
Code:"Global Name" value
thank you both, it was the 'value' I was missing...
Having a blast with it, I really, really, really like the keypad that pops up when you click a PID or variable... that is a HUGE help on a tablet...
question, is Tilt in this release?
what interface model and firmware are you using for Tilt? I plan on trying to use Feather M0, and v44J.
The release notes say: TILT sensor Device Element (ESP32 only, on virtual ports 220 - 224) - does that mean a vanilla ESP32 or something based on that like the Feather?
Either way, my vanilla ESP32's will be here Saturday to play with.
Does changing a BruControl PID Target to 0.5 degrees above or below the input(via script if that matters) cause the PID algorithm to act the same way as if the input were to move 0.5 degrees below or above the Target? Or does it 'reset' things in the PID algorithm that would make it act differently than the input just changing on it's own?
I suppose either scenario would give similar results. Technically a lowered temp target would be arrived at via no heating and a higher target would be arrived to via heating, so the times would be different, but probably not much difference to notice.
The real crux of your question however is the "reset" question. And thats a really good one. So, when a PID is running, re-establishing it (which occurs during a settings change) does not erase the steady-state parameters such as cycle time points and the integral. If you disable it and then re-enable it, those are indeed erased and started over. Make sense?
BruControl v44J.E Debug:1
%1&14;Rsp:%1
End:86290
IP:192.168.1.202
CL:0
IP:192.168.1.202
CL:0
IP:192.168.1.202
CL:0
IP:192.168.1.202
CL:0
IP:192.168.1.202
CL:0
IP:192.168.1.202
CL:0
Beg:140424
Msg:%2&17;
Debug:0
%2&17;
and this is what I get when going into the debug:
Code:BruControl v44J.E Debug:1 %1&14;Rsp:%1 End:86290 IP:192.168.1.202 CL:0 IP:192.168.1.202 CL:0 IP:192.168.1.202 CL:0 IP:192.168.1.202 CL:0 IP:192.168.1.202 CL:0 IP:192.168.1.202 CL:0 Beg:140424 Msg:%2&17; Debug:0 %2&17;
First, I'm not sure what the graph is showing. I assume temps from 1-wire sensors. While those spikes look really big, you have a span of only 2 degrees on the graph, so I wouldn't call them spikes. The 1-wire resolution is about 0.225 degrees F, so one step would look big on a temp graph like that. The blue spike is about that amount. The orange looks like 2 or 4 times that amount, but again, not sure what these are displaying.
Assuming you want the PID values... you need to go to the second level of debug, so send %1&14; twice.
Port:3 PWM out:0
1W on:200
-Port:3-
In:6732
Err:10
Prop:1
TInt:-4863
Int:-48
Der:0
Out:0
--
Port:3 PWM out:0
1W on:200
-Port:3-
In:6755
Err:-13
Prop:-1
TInt:-4876
Int:-48
Der:6900
Out:0
--
Port:3 PWM out:0
1W on:200
-Port:3-
In:6732
Err:10
Prop:1
TInt:-4866
Int:-48
Der:-6900
Out:255
--
Port:3 PWM out:61
1W on:200
-Port:3-
In:6822
Err:10
Prop:10
TInt:5100
Int:51
Der:0
Out:61
--
Port:3 PWM out:61
1W on:200
1W on:200
-Port:3-
In:6844
Err:-12
Prop:-12
TInt:3900
Int:39
Der:22
Out:5
--
Port:3 PWM out:5
1W on:200
-Port:3-
In:6844
Err:-12
Prop:-12
TInt:2700
Int:27
Der:0
Out:15
--
how do I get that output to not go full scale?
BruControl v44J.E Debug:1
%1&14;Rsp:%1
End:991
Beg:2589
Msg:%1&14;
BruControl v44J.E Debug:2
%1&14;Rsp:%1
End:2590
IP:192.168.1.202
CL:0
IP:192.168.1.202
CL:0
I tried to click 'edit' on the interface and got this:
View attachment 616233
Your Kd is extremly high you want to dramatically reduce it or the best is to set it to zero. Derivative is as a rule of thumb best used in processes with large time constant or "lag". Otherwise there's mostly drawbacks using it especially if the input got noise of any kind.
Shouldn't the Derivative in the 2nd message be added to, not subtracted from the other components, giving 49 instead of 5 as the output value?
Hi Greg,
No worries. We have already integrated the Atlas Scientific pH and DO sensors to BC via the I2C. We are working on including it in v1.1.
No, otherwise it would accelerate!
Derivative is a damper. This might help: https://www.controleng.com/articles/understanding-derivative-in-pid-control/
// Derivative term using error change
// derivative = (error - pre_error) / (double)(timeChange * .000001); // uses real delta T not a fixed delta T
// DTerm = kd * derivative;
// Derivative term using angle change
if (kd) {
derivative = (input - lastInput) / (double)(timeChange * .000001); // uses real delta T not a fixed delta T
DTerm = (-kd * derivative);
}
So did this Atlas Scientific pH sensor make it into RC v1.0.1.10 because I haven't found it mentioned yet. If not, when might it be? I've had a shiny new Atlas pH setup for a while and I would very much like to use it .
OK, how do I keep the output from changing so rapidly with a tiny error of a tenth of a degree? it went from 61 to 5 in a single sample... normally, I would use derivative.. I was thinking if it added it, it would have gone from 61 to 49, which is big, but not as big as 61 to 5..
Are you using something like this I found on arduino.cc? I am thinking if I do the math I will get a better picture
Code:// Derivative term using error change // derivative = (error - pre_error) / (double)(timeChange * .000001); // uses real delta T not a fixed delta T // DTerm = kd * derivative; // Derivative term using angle change if (kd) { derivative = (input - lastInput) / (double)(timeChange * .000001); // uses real delta T not a fixed delta T DTerm = (-kd * derivative); }
You do not want to use derivative. Any singular change, multiplied by a big coefficient, will create a massive variation. Eliminate it completely IMO. If you want slow adjustments... use a moderate P and a moderate I. Limit the integral as needed to perform but prevent overwhelming windup.
unsigned long now = micros();
unsigned long timeChange = (now - lastTime);
if (timeChange >= (SampleTime * 1000)) // Minimum Sample Time
{
double DTerm = 0;
double derivative = 0;
// kp - proportional gain
// ki - Integral gain
// kd - derivative gain
// dt - loop interval time
// outMax - maximum value of manipulated variable
// outMin - minimum value of manipulated variable
// Calculate error
double error = Setpoint - input;
// Proportional term
double PTerm = kp * error;
// Integral term
integral += error * (double) (timeChange * .000001); // uses real delta T not a fixed delta T
ITerm = ki * integral;
if ((ITerm > outMax) || (ITerm < outMin) ) integral -= error * (double) (timeChange * .000001); // Prevemts Windup
/*
///////////////////////////////////////////////////////////////////////////////////////////////////
We were not talking about that but it's something clever:
....Jerky robot, that's because the Kd * de(t)/dt term goes to infinity when you change the set-point. Try instead of using the angle error, e(t), use the negative of the actual value change, dangle(t)/dt. they are equivalent but this way you avoid infinity errors.
Kd*de(t)/dt = -Kd*dangle(t)/dt
///////////////////////////////////////////////////////////////////////////////////////////////////
*/
// Derivative term using error change
// derivative = (error - pre_error) / (double)(timeChange * .000001); // uses real delta T not a fixed delta T
// DTerm = kd * derivative;
// Derivative term using angle change
if (kd) {
derivative = (input - lastInput) / (double)(timeChange * .000001); // uses real delta T not a fixed delta T
DTerm = (-kd * derivative);
}
//Compute PID Output
double output = PTerm + ITerm + DTerm ;
//output = max(outMin,output);
if (output > outMax) output = outMax;
else if (output < outMin) output = outMin;
//Remember some variables for next time
pre_error = error;
lastInput = input;
lastTime = now;
// Debugging
#ifdef DEBUG
static long QTimer = millis();
if ((long)( millis() - QTimer ) >= 100) { // Spam Delay at 100 miliseconds
QTimer = millis() ;
char S[10];
//Serial.print(F("\tSkipCtr ")); Serial.print(SkipCtr);
Serial.print(F("\tIn ")); Serial.print(dtostrf(input, 6, 2, S));
Serial.print(F("\tSetpt ")); Serial.print(dtostrf(Setpoint, 6, 2, S));
Serial.print(F("\t/\\T ")); Serial.print(dtostrf(timeChange, 6, 2, S));
Serial.print(F("\tKp ")); Serial.print(dtostrf(PTerm, 6, 2, S));
Serial.print(F("\tKi ")); Serial.print(dtostrf(ITerm, 6, 2, S));
//Serial.print(F("\tKd ")); Serial.print(dtostrf(kd,6,2,S));
//Serial.print(F("\tderivative ")); Serial.print(dtostrf(derivative,6,2,S));
Serial.print(F("\tKd ")); Serial.print(dtostrf(DTerm, 9, 0, S));
Serial.print(F("\tOut ")); Serial.print((int)output);
Serial.println();
}
#endif
}
Ouch! Called to the carpet. Truth be told... we deferred it! It's taken us long enough to get this version out. But I will make sure we get it added for incremental updates.
Does anyone have a link to a preferred DIN rail mount 30A DP 120V coil? My google-fu is not strong this morning for some reason.
Enter your email address to join: