*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit 9580155b authored by Schabbauer, Johannes's avatar Schabbauer, Johannes
Browse files

Fix PID turnoff when last output value should not be saved. Bugfix was not save with output limits.

parent 21dd41bd
No related branches found
No related tags found
1 merge request!2PID and timing improvements
......@@ -336,19 +336,21 @@ EVENT:
i = DATA_5[pidIdx] ' output channel index
set_pid[i] = DATA_6[pidIdx] ' input/PID channel index
pid_prev_dError[i] = 0
' Set output value. Because we don't have an input value yet, use just the I part.
' (Either the I value from the previous PID time, or the one set in Data_30.
IF (DATA_30[pidIdx] = 100000) THEN
set_output[i] = pid_sum[i] + N
ELSE
set_output[i] = DATA_30[pidIdx]
pid_sum[i] = set_output[i] - N
ENDIF
IF ((set_pid[i]=0) AND (DATA_30[pidIdx]=100000)) THEN
IF (set_pid[i]=0) THEN
' When we turn off PID, use the last output value as the new target value.
' With this we can turn a beam off and on with the previous power during one shot.
set_target[i] = set_output[i]
IF (DATA_30[pidIdx]=100000) THEN set_target[i] = set_output[i]
ELSE
' Set output value when PID is tunred on. Because we don't have an input value yet, use just the I part.
' (Either the I value from the previous PID time, or the one set in Data_30.
IF (DATA_30[pidIdx] = 100000) THEN
set_output[i] = pid_sum[i] + N
ELSE
set_output[i] = DATA_30[pidIdx]
pid_sum[i] = set_output[i] - N
ENDIF
ENDIF
UNTIL(DATA_4[pidIdx+1] > processIdx)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment