Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
95e99d16
Commit
95e99d16
authored
May 14, 2014
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Plc control, new algorithm for PID and CompPID, and windup limit in Inc3P-object (refs #177)
parent
16ed5c5d
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
822 additions
and
418 deletions
+822
-418
bcomp/lib/rt/src/rt_plc_bcomp.c
bcomp/lib/rt/src/rt_plc_bcomp.c
+85
-61
bcomp/wbl/bcomp/src/basecomponent.wb_load
bcomp/wbl/bcomp/src/basecomponent.wb_load
+228
-146
src/lib/rt/src/rt_plc_pid.c
src/lib/rt/src/rt_plc_pid.c
+99
-70
src/wbl/pwrb/src/pwrb_c_inc3p.wb_load
src/wbl/pwrb/src/pwrb_c_inc3p.wb_load
+15
-1
src/wbl/pwrb/src/pwrb_c_mode.wb_load
src/wbl/pwrb/src/pwrb_c_mode.wb_load
+19
-21
src/wbl/pwrb/src/pwrb_c_pid.wb_load
src/wbl/pwrb/src/pwrb_c_pid.wb_load
+189
-88
src/wbl/pwrb/src/pwrb_sv_se.txt
src/wbl/pwrb/src/pwrb_sv_se.txt
+90
-31
src/wbl/pwrb/src/pwrb_td_windupmaskenum.wb_load
src/wbl/pwrb/src/pwrb_td_windupmaskenum.wb_load
+97
-0
No files found.
bcomp/lib/rt/src/rt_plc_bcomp.c
View file @
95e99d16
...
...
@@ -240,6 +240,11 @@ void CompPID_Fo_init( pwr_sClass_CompPID_Fo *o)
#define DALG 8
/* Derivative part exists */
#define DAVV 16
/* Derivative part working on control difference */
#define IWUP 1
/* Windup limitation on I part */
#define BIWUP 2
/* Windup limitation on Bias and I part */
#define BPIWUP 4
/* Windup limitation on Bias PI part */
#define BPIDWUP 8
/* Windup limitation on Bias and PID part (Default, old funcionality */
void
CompPID_Fo_exec
(
plc_sThread
*
tp
,
pwr_sClass_CompPID_Fo
*
o
)
{
...
...
@@ -252,6 +257,9 @@ void CompPID_Fo_exec( plc_sThread *tp,
float
ut
;
float
dut
;
float
kd
;
float
absut
;
float
gain
;
pwr_sClass_CompPID
*
co
=
(
pwr_sClass_CompPID
*
)
o
->
PlcConnectP
;
if
(
!
co
)
...
...
@@ -284,104 +292,120 @@ void CompPID_Fo_exec( plc_sThread *tp,
ddiff
=
((
co
->
PidAlg
&
DAVV
)
!=
0
)
?
(
co
->
ControlDiff
-
eold
)
/
*
o
->
ScanTime
:
(
co
->
ProcVal
-
xold
)
/
*
o
->
ScanTime
;
if
((
co
->
DerGain
<=
0
.
0
)
||
(
co
->
DerTime
<=
0
))
if
((
(
co
->
DerGain
*
*
o
->
ScanTime
)
>=
co
->
DerTime
)
||
(
co
->
DerTime
<=
0
))
co
->
FiltDer
=
ddiff
;
/* No Filter */
else
{
kd
=
1
.
0
/
(
1
.
0
+
co
->
DerGain
*
*
o
->
ScanTime
/
co
->
DerTime
);
co
->
FiltDer
+=
(
ddiff
-
derold
)
*
(
1
.
0
-
kd
);
}
if
(
co
->
Inverse
==
0
)
gain
=
co
->
Gain
;
else
gain
=
-
co
->
Gain
;
if
(
co
->
Force
)
{
/* Force */
dut
=
co
->
OutVal
;
co
->
OutVal
=
co
->
ForcVal
;
co
->
OutChange
=
co
->
OutVal
-
dut
;
co
->
OutChange
=
co
->
ForcVal
-
co
->
OutVal
;
co
->
OutVal
=
co
->
OutWindup
=
co
->
ForcVal
;
co
->
EndMin
=
FALSE
;
co
->
EndMax
=
FALSE
;
/* Adjust for bumpless transfer to auto */
co
->
PDManOffset
=
co
->
OutVal
-
gain
*
co
->
ControlDiff
-
co
->
BiasGain
*
co
->
Bias
;
if
((
co
->
PidAlg
&
IALG
)
!=
0
)
co
->
AbsOut
=
0
.
0
;
else
co
->
AbsOut
=
co
->
OutVal
;
if
(
co
->
WindupMask
<
BIWUP
)
co
->
OutWindup
-=
co
->
BiasGain
*
co
->
Bias
;
if
(
co
->
WindupMask
<
BPIWUP
)
co
->
OutWindup
-=
gain
*
co
->
ControlDiff
;
co
->
AbsOut
=
co
->
OutVal
-
co
->
OutWindup
;
}
else
{
/* Auto mode */
if
((
co
->
PidAlg
&
IALG
)
!=
0
)
{
dut
=
absut
=
0
.
0
;
if
((
co
->
PidAlg
&
IALG
)
!=
0
)
/* Incremental algorithm */
{
/* Integral-part */
if
((
*
o
->
IntOffP
==
FALSE
)
&&
(
co
->
IntTime
>
0
))
dut
=
co
->
ControlDiff
*
*
o
->
ScanTime
/
co
->
IntTime
;
else
dut
=
0
;
if
((
co
->
PidAlg
&
PALG
)
!=
0
)
{
/* Not pure I-controller */
/* Derivative-part */
if
((
co
->
PidAlg
&
DALG
)
!=
0
)
dut
+=
(
co
->
FiltDer
-
derold
)
*
co
->
DerTime
;
if
((
co
->
PidAlg
&
PALG
)
!=
0
)
dut
*=
gain
;
else
gain
=
0
.
0
;
/* Pure I-controller */
/* Bias */
if
(
co
->
WindupMask
>=
BIWUP
)
/* Windup on Bias */
dut
+=
co
->
BiasGain
*
(
co
->
Bias
-
bfold
);
else
absut
=
co
->
BiasGain
*
co
->
Bias
;
/* P-part */
if
(
co
->
WindupMask
>=
BPIWUP
)
/* Windup on P */
dut
+=
((
co
->
PidAlg
&
PAVV
)
!=
0
)
?
co
->
ControlDiff
-
eold
:
co
->
ProcVal
-
xold
;
dut
*=
co
->
Gain
;
gain
*
(
co
->
ControlDiff
-
eold
)
:
gain
*
(
co
->
ProcVal
-
xold
)
;
else
absut
+=
gain
*
co
->
ControlDiff
;
/* Derivative-part */
if
((
co
->
PidAlg
&
DALG
)
!=
0
)
{
if
(
co
->
WindupMask
>=
BPIDWUP
)
/* Windup on D */
dut
+=
gain
*
(
co
->
FiltDer
-
derold
)
*
co
->
DerTime
;
else
absut
+=
gain
*
co
->
FiltDer
*
co
->
DerTime
;
}
if
(
co
->
Inverse
!=
0
)
dut
=
-
dut
;
/* Bias */
dut
+=
co
->
BiasGain
*
(
co
->
Bias
-
bfold
);
/* Limit output */
ut
=
co
->
OutVal
+
dut
;
if
(
co
->
MaxOut
>
co
->
MinOut
)
{
if
(
ut
>
co
->
MaxOut
)
{
ut
=
co
->
MaxOut
;
co
->
EndMin
=
FALSE
;
co
->
OutWindup
+=
dut
;
if
(
co
->
OutWindup
>
co
->
MaxWindup
)
{
co
->
OutWindup
=
co
->
MaxWindup
;
co
->
EndMax
=
TRUE
;
}
else
if
(
ut
<
co
->
MinOut
)
{
ut
=
co
->
MinOut
;
}
else
if
(
co
->
OutWindup
<
co
->
MinWindup
)
{
co
->
OutWindup
=
co
->
MinWindup
;
co
->
EndMin
=
TRUE
;
co
->
EndMax
=
FALSE
;
}
else
{
if
(
co
->
EndMin
&&
(
ut
>=
(
co
->
MinOut
+
co
->
EndHys
)))
co
->
EndMin
=
FALSE
;
if
(
co
->
EndMax
&&
(
ut
<=
(
co
->
MaxOut
-
co
->
EndHys
)))
co
->
EndMax
=
FALSE
;
}
}
ut
=
co
->
OutWindup
+
absut
;
if
(
ut
>
co
->
MaxOut
)
ut
=
co
->
MaxOut
;
else
if
(
ut
<
co
->
MinOut
)
ut
=
co
->
MinOut
;
dut
+=
absut
-
co
->
AbsOut
;
}
else
{
else
/* Nonincremental algorithm */
{
/* P-part */
ut
=
co
->
ControlDiff
;
/* Derivative-part */
if
((
co
->
PidAlg
&
DALG
)
!=
0
)
ut
+=
co
->
FiltDer
*
co
->
DerTime
;
/* Gain */
ut
*=
co
->
Gain
;
if
(
co
->
Inverse
!=
0
)
ut
=
-
ut
;
/* Bias */
ut
+=
co
->
BiasGain
*
co
->
Bias
;
ut
*=
gain
;
/* Bias and Man offset*/
if
(
co
->
PDAbsFlag
)
co
->
PDManOffset
=
0
;
ut
+=
co
->
BiasGain
*
co
->
Bias
+
co
->
PDManOffset
;
/* Limit output */
if
(
co
->
MaxOut
>
co
->
MinOut
)
{
if
(
ut
>
co
->
MaxOut
)
{
ut
=
co
->
MaxOut
;
co
->
EndMin
=
FALSE
;
co
->
EndMax
=
TRUE
;
}
else
if
(
ut
<
co
->
MinOut
)
{
ut
=
co
->
MinOut
;
co
->
EndMin
=
TRUE
;
co
->
EndMax
=
FALSE
;
}
else
{
if
(
co
->
EndMin
&&
(
ut
>=
(
co
->
MinOut
+
co
->
EndHys
)))
co
->
EndMin
=
FALSE
;
if
(
co
->
EndMax
&&
(
ut
<=
(
co
->
MaxOut
-
co
->
EndHys
)))
co
->
EndMax
=
FALSE
;
}
if
(
co
->
MaxOut
>
co
->
MinOut
)
{
if
(
ut
>
co
->
MaxOut
)
ut
=
co
->
MaxOut
;
else
if
(
ut
<
co
->
MinOut
)
ut
=
co
->
MinOut
;
}
dut
=
ut
-
co
->
OutVal
;
absut
=
ut
;
}
/* Output Auto */
co
->
OutChange
=
dut
;
co
->
OutVal
=
ut
;
co
->
AbsOut
=
absut
;
}
/* Transfer outputs */
...
...
bcomp/wbl/bcomp/src/basecomponent.wb_load
View file @
95e99d16
...
...
@@ -51117,10 +51117,9 @@ and no Auto/Man button."
! XSetVal.
!*/
Object SetVal $Attribute 7 18-MAY-2006 14:34:02.85
Body SysBody
18-MAY-2006 15:34:43.61
Body SysBody
27-MAR-2014 07:39:05.83
Attr PgmName = "SetVal"
Attr Size = 4
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
...
...
@@ -51288,99 +51287,100 @@ and no Auto/Man button."
EndBody
EndObject
!/**
! The operator's authorities to change SetVal.
!
! 0 -- Changes not allowed.
! = 0 -- Changes allowed.
!*/
Object AccSet $Attribute 18 18-MAY-2006 14:35:28.87
Body SysBody 18-MAY-2006 14:39:48.69
Attr PgmName = "AccSet"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Int32"
EndBody
EndObject
!/**
! The choice of the operator of SetVal is checked against
! the interval { MinSet, MaxSet}. The value may be
! changed in the control modes MANUAL and AUTO from the
! display of the Mode object.
!*/
Object MinSet $Attribute 19 18-MAY-2006 14:35:33.96
Body SysBody 18-MAY-2006 14:39:55.12
Attr PgmName = "MinSet"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
Object MaxSet $Attribute 20 18-MAY-2006 14:35:37.63
Body SysBody 18-MAY-2006 14:39:58.39
Attr PgmName = "MaxSet"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! The lower respectively upper limits in the bar graphs
! at presentation of process and set point values in the
! Mode object display. The values may be changed in the
! more info form of the Mode object.
!*/
Object SetM
axShow $Attribute 21 18-MAY-2006 14:35:43.48
Body SysBody 18-MAY-2006 14:40:0
1
.58
Attr PgmName = "SetM
ax
Show"
Object SetM
inShow $Attribute 22 27-MAR-2014 08:02:34.71
Body SysBody 18-MAY-2006 14:40:0
4
.58
Attr PgmName = "SetM
in
Show"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
Object SetM
inShow $Attribute 22 18-MAY-2006 14:35:47.67
Body SysBody 18-MAY-2006 14:40:0
4
.58
Attr PgmName = "SetM
in
Show"
Object SetM
axShow $Attribute 21 27-MAR-2014 08:02:37.36
Body SysBody 18-MAY-2006 14:40:0
1
.58
Attr PgmName = "SetM
ax
Show"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Specifies the engineering unit of SetVal / XSetVal / SetMinShow /
! SetMaxShow, e.g. kg. Used in the Mode object display.
! OutEngUnit
!*/
Object SetEngUnit $Attribute 25 27-MAR-2014 08:02:40.12
Body SysBody 18-MAY-2006 14:40:48.75
Attr PgmName = "SetEngUnit"
Attr Size = 16
Attr TypeRef = "pwrs:Type-$String16"
EndBody
EndObject
!/**
! The lower respectively upper limits in the bar graph at
! presentation of the control signal, OutVal, of the Pid
! object in the Mode display. The values may be changed
! in the more info form of the Mode object.
!*/
Object OutM
axShow $Attribute 23 18-MAY-2006 14:35:53.81
Body SysBody 18-MAY-2006 14:40:
09.36
Attr PgmName = "OutM
ax
Show"
Object OutM
inShow $Attribute 24 27-MAR-2014 08:02:43.20
Body SysBody 18-MAY-2006 14:40:
13.52
Attr PgmName = "OutM
in
Show"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
Object OutM
inShow $Attribute 24 18-MAY-2006 14:36:06.19
Body SysBody 18-MAY-2006 14:40:
13.52
Attr PgmName = "OutM
in
Show"
Object OutM
axShow $Attribute 23 27-MAR-2014 08:02:46.40
Body SysBody 18-MAY-2006 14:40:
09.36
Attr PgmName = "OutM
ax
Show"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Specifies the engineering unit of
SetMinShow
/
!
SetMaxShow, e.g. kg. Used in the Mode object display
.
!
OutEngUnit
! Specifies the engineering unit of
OutVal / Force
/
!
OutMinShow / OutMaxShow e.g. %
.
!
Used in the Mode object display.
!*/
Object
SetEngUnit $Attribute 25 18-MAY-2006 14:36:17.79
Body SysBody 18-MAY-2006 14:40:
48.75
Attr PgmName = "
Se
tEngUnit"
Object
OutEngUnit $Attribute 26 27-MAR-2014 08:02:49.27
Body SysBody 18-MAY-2006 14:40:
51.89
Attr PgmName = "
Ou
tEngUnit"
Attr Size = 16
Attr TypeRef = "pwrs:Type-$String16"
EndBody
EndObject
!/**
! Specifies the engineering unit of OutMinShow /
! OutMaxShow e.g. %. Used in the Mode object display.
! The operator's authorities to change SetVal.
!
! 0 -- Changes not allowed.
! = 0 -- Changes allowed.
!*/
Object AccSet $Attribute 18 18-MAY-2006 14:35:28.87
Body SysBody 18-MAY-2006 14:39:48.69
Attr PgmName = "AccSet"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Int32"
EndBody
EndObject
!/**
! The choice of the operator of SetVal is checked against
! the interval { MinSet, MaxSet}. The value may be
! changed in the control modes MANUAL and AUTO from the
! display of the Mode object.
!*/
Object OutEngUnit $Attribute 26 18-MAY-2006 14:36:23.64
Body SysBody 18-MAY-2006 14:40:51.89
Attr PgmName = "OutEngUnit"
Attr Size = 16
Attr TypeRef = "pwrs:Type-$String16"
Object MinSet $Attribute 19 18-MAY-2006 14:35:33.96
Body SysBody 18-MAY-2006 14:39:55.12
Attr PgmName = "MinSet"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
Object MaxSet $Attribute 20 18-MAY-2006 14:35:37.63
Body SysBody 18-MAY-2006 14:39:58.39
Attr PgmName = "MaxSet"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
...
...
@@ -51718,7 +51718,7 @@ and no Auto/Man button."
Object RtBody $ObjBodyDef 1 18-MAY-2006 14:49:52.65
Body SysBody 18-MAY-2006 14:49:57.64
Attr StructName = "CompPID"
Attr NextAix = "_X5
0
"
Attr NextAix = "_X5
7
"
EndBody
!/**
! Process value.
...
...
@@ -51900,7 +51900,7 @@ and no Auto/Man button."
! based on the control error.
!*/
Object PidAlg $Attribute 12 18-MAY-2006 15:12:04.04
Body SysBody
18-MAY-2006 15:20:47.24
Body SysBody
27-MAR-2014 07:30:20.83
Attr PgmName = "PidAlg"
Attr Size = 4
Attr TypeRef = "pwrb:Type-PidAlgEnum"
...
...
@@ -51969,7 +51969,7 @@ and no Auto/Man button."
! decreasing control signal.
!*/
Object Inverse $Attribute 17 18-MAY-2006 15:12:26.34
Body SysBody
18-MAY-2006 15:21:26.53
Body SysBody
27-MAR-2014 07:28:57.76
Attr PgmName = "Inverse"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Boolean"
...
...
@@ -51990,18 +51990,66 @@ and no Auto/Man button."
EndBody
EndObject
!/**
! At AUTO and CASCADE control the control signal OutVal
! is supposed to be in the interval { MinOut, MaxOut }.
! The EndMin /EndMax flags are used to signal if any
! limitation has occurred.
! If OutVal is greater than MaxOut or less than MinOut,
! OutVal is limited to the value at the end of the
! interval.
! Flag to force no offset after amnual mode. Will cause an output jump
! when switching from manual to Auto. Not Bumpless transfer!
!*/
Object PDAbsFlag $Attribute 50 27-MAR-2014 07:28:33.85
Body SysBody 27-MAR-2014 07:29:01.36
Attr PgmName = "PDAbsFlag"
Attr Flags = 16777216
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
!/**
! WindupMask
! The possible values are as follows:
!
! 1 -- I Only the I-part is limited in OutWindup
! 2 -- BI Bias and I are limited in OutWindup
! 4 -- BPI Bias, P and I are limited in OutWindup
! 8 -- BPID All parts of the controller are limited in OutWindup
!*/
Object WindupMask $Attribute 51 27-MAR-2014 07:30:11.91
Body SysBody 27-MAR-2014 07:30:41.64
Attr PgmName = "WindupMask"
Attr Flags = 16777216
Attr TypeRef = "pwrb:Type-WindupMaskEnum"
EndBody
EndObject
!/**
! At AUTO and CASCADE control, for controllers with an I-part,
! the control signal OutWindup is supposed to be
! in the interval { MinWindup, MaxWindup }.
! The EndMin / EndMax flags are used to signal if any
! limitation has ocurred.
! If OutWindup is greater than MaxWindup, or less than MinWindup,
! OutWindup is limited to the value at the end of the interval.
! If MinWindup >= MaxWindup no limitation will occur.
!
! After addition of the absolute part,
! OutVal is limited to the interval { MinOut, MaxOut }.
! If MinOut >= MaxOut no limitation will occur.
!
!*/
Object MinWindup $Attribute 52 27-MAR-2014 07:31:26.25
Body SysBody 27-MAR-2014 07:31:28.04
Attr PgmName = "MinWindup"
Attr Flags = 16777216
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
Object MaxWindup $Attribute 53 27-MAR-2014 07:31:36.34
Body SysBody 27-MAR-2014 07:31:37.96
Attr PgmName = "MaxWindup"
Attr Flags = 16777216
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
!
!*/
Object MinOut $Attribute 19 18-MAY-2006 15:15:23.71
Body SysBody
18-MAY-2006 15:22:31.22
Body SysBody
27-MAR-2014 07:31:06.73
Attr PgmName = "MinOut"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Float32"
...
...
@@ -52015,6 +52063,81 @@ and no Auto/Man button."
EndBody
EndObject
!/**
! Specifies the hysteresis on MinOut and MaxOut in
! connection with the handling of EndMin/EndMax.
! @image orm_en1-144.gif
!*/
Object EndHys $Attribute 47 27-MAR-2014 07:31:58.98
Body SysBody 18-MAY-2006 15:25:54.52
Attr PgmName = "EndHys"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! The lower respectively upper limit in the graph at
! presentation of ProcVal and SetVal in the Pid object
! display. The values may be changed in the more info
! form of the Pid object.
!*/
Object SetMinShow $Attribute 41 27-MAR-2014 07:32:06.25
Body SysBody 18-MAY-2006 15:24:38.58
Attr PgmName = "SetMinShow"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
Object SetMaxShow $Attribute 40 27-MAR-2014 07:32:09.87
Body SysBody 18-MAY-2006 15:24:32.20
Attr PgmName = "SetMaxShow"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Specifies the engineering unit of SetVal / SetMinShow /
! SetMaxShow, e.g. meter. Used in the Pid object display.
!*/
Object SetEngUnit $Attribute 44 27-MAR-2014 07:32:13.42
Body SysBody 18-MAY-2006 15:25:29.00
Attr PgmName = "SetEngUnit"
Attr Size = 16
Attr TypeRef = "pwrs:Type-$String16"
EndBody
EndObject
!/**
! The lower respectively upper limit in the graph at
! presentation of the control signal OutVal in the Pid
! object display. The values may be changed in the more
! info form of the Pid object.
!*/
Object OutMinShow $Attribute 43 27-MAR-2014 07:32:20.89
Body SysBody 18-MAY-2006 15:24:44.30
Attr PgmName = "OutMinShow"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
Object OutMaxShow $Attribute 42 27-MAR-2014 07:32:24.40
Body SysBody 18-MAY-2006 15:24:41.44
Attr PgmName = "OutMaxShow"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Specifies the engineering unit of OutVal / OutMinShow /
! OutMaxShow, e.g., %. Used in the in the Pid object
! display.
!*/
Object OutEngUnit $Attribute 45 27-MAR-2014 07:32:27.14
Body SysBody 18-MAY-2006 15:25:32.42
Attr PgmName = "OutEngUnit"
Attr Size = 16
Attr TypeRef = "pwrs:Type-$String16"
EndBody
EndObject
!/**
! The operator's authorities to change Gain respectively
! IntTime.
! 0 -- Changes not allowed.
...
...
@@ -52181,69 +52304,6 @@ and no Auto/Man button."
EndBody
EndObject
!/**
! The lower respectively upper limit in the graph at
! presentation of ProcVal and SetVal in the Pid object
! display. The values may be changed in the more info
! form of the Pid object.
!*/
Object SetMaxShow $Attribute 40 18-MAY-2006 15:17:50.62
Body SysBody 18-MAY-2006 15:24:32.20
Attr PgmName = "SetMaxShow"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
Object SetMinShow $Attribute 41 18-MAY-2006 15:17:57.23
Body SysBody 18-MAY-2006 15:24:38.58
Attr PgmName = "SetMinShow"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! The lower respectively upper limit in the graph at
! presentation of the control signal OutVal in the Pid
! object display. The values may be changed in the more
! info form of the Pid object.
!*/
Object OutMaxShow $Attribute 42 18-MAY-2006 15:18:01.66
Body SysBody 18-MAY-2006 15:24:41.44
Attr PgmName = "OutMaxShow"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
Object OutMinShow $Attribute 43 18-MAY-2006 15:18:07.98
Body SysBody 18-MAY-2006 15:24:44.30
Attr PgmName = "OutMinShow"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Specifies the engineering unit of SetMinShow /
! SetMaxShow, e.g. meter. Used in the Pid object display.
!*/
Object SetEngUnit $Attribute 44 18-MAY-2006 15:18:13.35
Body SysBody 18-MAY-2006 15:25:29.00
Attr PgmName = "SetEngUnit"
Attr Size = 16
Attr TypeRef = "pwrs:Type-$String16"
EndBody
EndObject
!/**
! Specifies the engineering unit of OutMinShow /
! OutMaxShow, e.g., %. Used in the in the Pid object
! display.
!*/
Object OutEngUnit $Attribute 45 18-MAY-2006 15:18:20.75
Body SysBody 18-MAY-2006 15:25:32.42
Attr PgmName = "OutEngUnit"
Attr Size = 16
Attr TypeRef = "pwrs:Type-$String16"
EndBody
EndObject
!/**
! Specifies the complete name of the Mode object
! associated to this Pid object. The attribute makes it
! possible to start the object display of the associated
...
...
@@ -52258,24 +52318,46 @@ and no Auto/Man button."
EndBody
EndObject
!/**
! Specifies the hysteresis on MinOut and MaxOut in
! connection with the handling of EndMin/EndMax.
! @image orm_en1-144.gif
! Filtered derivative is saved to the next program cycle.
!*/
Object
EndHys $Attribute 47 18-MAY-2006 15:18:32.65
Body SysBody
18-MAY-2006 15:25:54.52
Attr PgmName = "
EndHys
"
Object
FiltDer $Attribute 48 18-MAY-2006 15:18:37.56
Body SysBody
27-MAR-2014 07:39:57.84
Attr PgmName = "
FiltDer
"
Attr Size = 4
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Filtered derivative is saved to the next program cycle.
! Offset for P / PD-Controller after switching from
! manual to auto mode.
!
!*/
Object FiltDer $Attribute 48 18-MAY-2006 15:18:37.56
Body SysBody 18-MAY-2006 15:25:57.72
Attr PgmName = "FiltDer"
Attr Size = 4
Object PDManOffset $Attribute 54 27-MAR-2014 07:33:39.89
Body SysBody 27-MAR-2014 07:40:16.83
Attr PgmName = "PDManOffset"
Attr Flags = 16778256
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Output that is limited with MinWindup and MaxWindup
!
!*/
Object OutWindup $Attribute 55 27-MAR-2014 07:34:23.42
Body SysBody 27-MAR-2014 07:43:44.08
Attr PgmName = "OutWindup"
Attr Flags = 16778256
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! The absolute part of the output. (contrary to OutWindup)
!*/
Object AbsOut $Attribute 56 27-MAR-2014 07:35:01.12
Body SysBody 27-MAR-2014 07:43:54.26
Attr PgmName = "AbsOut"
Attr Flags = 16778256
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
src/lib/rt/src/rt_plc_pid.c
View file @
95e99d16
...
...
@@ -44,7 +44,6 @@
#include "pwr_baseclasses.h"
#include "rt_plc.h"
#include "rt_plc_timer.h"
#include "rt_plc_pid.h"
/* PLC RUTINER */
...
...
@@ -53,9 +52,13 @@
function: accumulate output change from controller
and convert to Open or Close orders.
2014-02-18 Werner Limit acc to new attribute "MaxWindup"
@aref inc3p Inc3p
*/
void
inc3p_init
(
pwr_sClass_inc3p
*
object
)
void
inc3p_init
(
pwr_sClass_inc3p
*
object
)
{
object
->
Acc
=
0
;
}
...
...
@@ -157,6 +160,13 @@ void inc3p_exec(
}
}
}
/* Limit output 2014-02-18 / Werner */
if
((
object
->
Acc
>
object
->
MaxWindup
)
&&
(
object
->
MaxWindup
>
0
.
0
))
object
->
Acc
=
object
->
MaxWindup
;
if
((
object
->
Acc
<
-
object
->
MaxWindup
)
&&
(
object
->
MaxWindup
>
0
.
0
))
object
->
Acc
=
-
object
->
MaxWindup
;
}
/*_*
...
...
@@ -355,8 +365,12 @@ void mode_exec(
Possible to turn off integration and to force
output to desired value.
Revision: 2011-01-18 / Werner
Error in filtered derivate part corrected.
New Attributes 2014-02-18 / Werner:
WindupMask Config
MinWindup Config
MaxWindup Config
PDManOffset Internal
OutWindup Internal
@aref pid Pid
*/
...
...
@@ -373,6 +387,11 @@ void pid_exec(
#define DALG 8
/* Derivative part exists */
#define DAVV 16
/* Derivative part working on control difference */
#define IWUP 1
/* Windup limitation on I part */
#define BIWUP 2
/* Windup limitation on Bias and I part */
#define BPIWUP 4
/* Windup limitation on Bias PI part */
#define BPIDWUP 8
/* Windup limitation on Bias and PID part (Default, old funcionality */
float
xold
;
/* Local variables */
float
eold
;
float
bfold
;
...
...
@@ -381,6 +400,8 @@ void pid_exec(
float
ut
;
float
dut
;
float
kd
;
float
absut
;
float
gain
;
/* Save old values */
xold
=
object
->
ProcVal
;
...
...
@@ -402,73 +423,93 @@ object->ControlDiff = object->ProcVal - object->SetVal;
ddiff
=
((
object
->
PidAlg
&
DAVV
)
!=
0
)
?
(
object
->
ControlDiff
-
eold
)
/
*
object
->
ScanTime
:
(
object
->
ProcVal
-
xold
)
/
*
object
->
ScanTime
;
if
((
object
->
DerGain
<=
0
.
0
)
||
(
object
->
DerTime
<=
0
))
if
((
(
object
->
DerGain
*
*
object
->
ScanTime
)
>=
object
->
DerTime
)
||
(
object
->
DerTime
<=
0
))
object
->
FiltDer
=
ddiff
;
/* No Filter */
else
{
kd
=
1
.
0
/
(
1
.
0
+
object
->
DerGain
*
*
object
->
ScanTime
/
object
->
DerTime
);
object
->
FiltDer
+=
(
ddiff
-
derold
)
*
(
1
.
0
-
kd
);
}
if
(
object
->
Inverse
==
0
)
gain
=
object
->
Gain
;
else
gain
=
-
object
->
Gain
;
if
(
object
->
Force
)
/* Force */
{
dut
=
object
->
OutVal
;
object
->
OutVal
=
object
->
ForcVal
;
object
->
OutChange
=
object
->
OutVal
-
dut
;
object
->
OutChange
=
object
->
ForcVal
-
object
->
OutVal
;
object
->
OutVal
=
object
->
OutWindup
=
object
->
ForcVal
;
object
->
EndMin
=
FALSE
;
object
->
EndMax
=
FALSE
;
/* Adjust for bumpless transfer to auto */
object
->
PDManOffset
=
object
->
OutVal
-
gain
*
object
->
ControlDiff
-
object
->
BiasGain
*
object
->
Bias
;
if
((
object
->
PidAlg
&
IALG
)
!=
0
)
object
->
AbsOut
=
0
.
0
;
else
object
->
AbsOut
=
object
->
OutVal
;
if
(
object
->
WindupMask
<
BIWUP
)
object
->
OutWindup
-=
object
->
BiasGain
*
object
->
Bias
;
if
(
object
->
WindupMask
<
BPIWUP
)
object
->
OutWindup
-=
gain
*
object
->
ControlDiff
;
object
->
AbsOut
=
object
->
OutVal
-
object
->
OutWindup
;
}
else
/* Auto mode */
{
dut
=
absut
=
0
.
0
;
if
((
object
->
PidAlg
&
IALG
)
!=
0
)
/* Incremental algorithm */
{
/* Integral-part */
if
((
*
object
->
IntOffP
==
FALSE
)
&&
(
object
->
IntTime
>
0
))
dut
=
object
->
ControlDiff
*
*
object
->
ScanTime
/
object
->
IntTime
;
else
dut
=
0
;
if
((
object
->
PidAlg
&
PALG
)
!=
0
)
/* Not pure I-controller */
{
/* Derivative-part */
if
((
object
->
PidAlg
&
DALG
)
!=
0
)
dut
+=
(
object
->
FiltDer
-
derold
)
*
object
->
DerTime
;
if
((
object
->
PidAlg
&
PALG
)
!=
0
)
dut
*=
gain
;
else
gain
=
0
.
0
;
/* Pure I-controller */
/* Bias */
if
(
object
->
WindupMask
>=
BIWUP
)
/* Windup on Bias */
dut
+=
object
->
BiasGain
*
(
object
->
Bias
-
bfold
);
else
absut
=
object
->
BiasGain
*
object
->
Bias
;
/* P-part */
if
(
object
->
WindupMask
>=
BPIWUP
)
/* Windup on P */
dut
+=
((
object
->
PidAlg
&
PAVV
)
!=
0
)
?
object
->
ControlDiff
-
eold
:
object
->
ProcVal
-
xold
;
dut
*=
object
->
Gain
;
gain
*
(
object
->
ControlDiff
-
eold
)
:
gain
*
(
object
->
ProcVal
-
xold
)
;
else
absut
+=
gain
*
object
->
ControlDiff
;
/* Derivative-part */
if
((
object
->
PidAlg
&
DALG
)
!=
0
)
{
if
(
object
->
WindupMask
>=
BPIDWUP
)
/* Windup on D */
dut
+=
gain
*
(
object
->
FiltDer
-
derold
)
*
object
->
DerTime
;
else
absut
+=
gain
*
object
->
FiltDer
*
object
->
DerTime
;
}
if
(
object
->
Inverse
!=
0
)
dut
=
-
dut
;
/* Bias */
dut
+=
object
->
BiasGain
*
(
object
->
Bias
-
bfold
);
/* Limit output */
ut
=
object
->
OutVal
+
dut
;
if
(
object
->
MaxOut
>
object
->
MinOut
)
{
if
(
ut
>
object
->
MaxOut
)
{
ut
=
object
->
MaxOut
;
object
->
EndMin
=
FALSE
;
object
->
OutWindup
+=
dut
;
if
(
object
->
OutWindup
>
object
->
MaxWindup
)
{
object
->
OutWindup
=
object
->
MaxWindup
;
object
->
EndMax
=
TRUE
;
}
else
if
(
ut
<
object
->
MinOut
)
{
ut
=
object
->
MinOut
;
}
else
if
(
object
->
OutWindup
<
object
->
MinWindup
)
{
object
->
OutWindup
=
object
->
MinWindup
;
object
->
EndMin
=
TRUE
;
object
->
EndMax
=
FALSE
;
}
else
{
if
(
object
->
EndMin
&&
(
ut
>=
(
object
->
MinOut
+
object
->
EndHys
)))
object
->
EndMin
=
FALSE
;
if
(
object
->
EndMax
&&
(
ut
<=
(
object
->
MaxOut
-
object
->
EndHys
)))
object
->
EndMax
=
FALSE
;
}
}
ut
=
object
->
OutWindup
+
absut
;
if
(
ut
>
object
->
MaxOut
)
ut
=
object
->
MaxOut
;
else
if
(
ut
<
object
->
MinOut
)
ut
=
object
->
MinOut
;
dut
+=
absut
-
object
->
AbsOut
;
}
else
...
...
@@ -480,39 +521,27 @@ else
if
((
object
->
PidAlg
&
DALG
)
!=
0
)
ut
+=
object
->
FiltDer
*
object
->
DerTime
;
/* Gain */
ut
*=
object
->
Gain
;
if
(
object
->
Inverse
!=
0
)
ut
=
-
ut
;
/* Bias */
ut
+=
object
->
BiasGain
*
object
->
Bias
;
ut
*=
gain
;
/* Bias and Man offset */
if
(
object
->
PDAbsFlag
)
object
->
PDManOffset
=
0
;
ut
+=
object
->
BiasGain
*
object
->
Bias
+
object
->
PDManOffset
;
/* Limit output */
if
(
object
->
MaxOut
>
object
->
MinOut
)
{
if
(
ut
>
object
->
MaxOut
)
{
ut
=
object
->
MaxOut
;
object
->
EndMin
=
FALSE
;
object
->
EndMax
=
TRUE
;
}
else
if
(
ut
<
object
->
MinOut
)
{
ut
=
object
->
MinOut
;
object
->
EndMin
=
TRUE
;
object
->
EndMax
=
FALSE
;
}
else
{
if
(
object
->
EndMin
&&
(
ut
>=
(
object
->
MinOut
+
object
->
EndHys
)))
object
->
EndMin
=
FALSE
;
if
(
object
->
EndMax
&&
(
ut
<=
(
object
->
MaxOut
-
object
->
EndHys
)))
object
->
EndMax
=
FALSE
;
}
if
(
ut
>
object
->
MaxOut
)
ut
=
object
->
MaxOut
;
else
if
(
ut
<
object
->
MinOut
)
ut
=
object
->
MinOut
;
}
dut
=
ut
-
object
->
OutVal
;
absut
=
ut
;
}
/* Output Auto */
object
->
OutChange
=
dut
;
object
->
OutVal
=
ut
;
object
->
AbsOut
=
absut
;
}
}
src/wbl/pwrb/src/pwrb_c_inc3p.wb_load
View file @
95e99d16
...
...
@@ -52,7 +52,8 @@ SObject pwrb:Class
! The input signal OutChange is regarded as a control
! error. This error is transformed into a time by
! multiplication with Gain. The product is added to
! accumulator Acc.
! accumulator Acc. The absolute value of Acc is limited
! to MaxWindup.
!
! If the absolute value of Acc > MinTim either the output
! Open or Close is set. If Acc > MinTim an incremental
...
...
@@ -193,6 +194,18 @@ SObject pwrb:Class
Attr GraphName = "MaxTim"
EndBody
EndObject
!/**
! Maximum windup in seconds
! The absolute value of Acc will never be greater than MaxWindup
! Typically less or equal than running time from open to closed
! Default 30 seconds. Lessor equal to zero means no limitation.
!*/
Object MaxWindup $Intern 19
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "MaxWindup"
EndBody
EndObject
Object OpenP $Intern 8
Body SysBody
Attr Flags |= PWR_MASK_POINTER
...
...
@@ -387,6 +400,7 @@ SObject pwrb:Class
Object Template Inc3P
Body RtBody
Attr Gain = 1.0
Attr MaxWindup = 30.0
EndBody
EndObject
EndObject
...
...
src/wbl/pwrb/src/pwrb_c_mode.wb_load
View file @
95e99d16
...
...
@@ -175,8 +175,6 @@ SObject pwrb:Class
Object SetVal $Output 7
Body SysBody
Attr PgmName = "SetVal"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "SV"
EndBody
...
...
@@ -380,16 +378,26 @@ SObject pwrb:Class
! Mode object display. The values may be changed in the
! more info form of the Mode object.
!*/
Object SetMinShow $Intern 21
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "SetMinShow"
EndBody
EndObject
Object SetMaxShow $Intern 20
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "SetMaxShow"
EndBody
EndObject
Object SetMinShow $Intern 21
!/**
! Specifies the engineering unit of XSetVal / SetVal / SetMinShow /
! SetMaxShow, e.g. kg. Used in the Mode object display.
!*/
Object SetEngUnit $Intern 24
Body SysBody
Attr TypeRef = "pwrs:Type-$
Float32
"
Attr GraphName = "Set
MinShow
"
Attr TypeRef = "pwrs:Type-$
String16
"
Attr GraphName = "Set
EngUnit
"
EndBody
EndObject
!/**
...
...
@@ -398,32 +406,22 @@ SObject pwrb:Class
! object in the Mode display. The values may be changed
! in the more info form of the Mode object.
!*/
Object OutMaxShow $Intern 22
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "OutMaxShow"
EndBody
EndObject
Object OutMinShow $Intern 23
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "OutMinShow"
EndBody
EndObject
!/**
! Specifies the engineering unit of SetMinShow /
! SetMaxShow, e.g. kg. Used in the Mode object display.
! OutEngUnit
!*/
Object SetEngUnit $Intern 24
Object OutMaxShow $Intern 22
Body SysBody
Attr TypeRef = "pwrs:Type-$
String16
"
Attr GraphName = "
SetEngUnit
"
Attr TypeRef = "pwrs:Type-$
Float32
"
Attr GraphName = "
OutMaxShow
"
EndBody
EndObject
!/**
! Specifies the engineering unit of OutMinShow /
! OutMaxShow e.g. %. Used in the Mode object display.
! Specifies the engineering unit of XForcVal / OutVal /
! ForcVal / OutMinShow / OutMaxShow e.g. %.
! Used in the Mode object display.
!*/
Object OutEngUnit $Intern 25
Body SysBody
...
...
src/wbl/pwrb/src/pwrb_c_pid.wb_load
View file @
95e99d16
...
...
@@ -70,10 +70,18 @@ SObject pwrb:Class
! the I-part will give a slope.
! I+P means that the P-part will only be affected by changes on the process value.
!
! When using the P- or PD-algorithm we use an a
a
bsolute algorithm. The output
! When using the P- or PD-algorithm we use an absolute algorithm. The output
! will not be stable away from zero without a control deviation.
! When using algorithms with I-part, all changesof the output are calculated by
! changes of the inputs to the controller. You can still turn off the integration
! If PDAbsFlag is zero, there will be a offset that is calculated when the
! controller is in manual mode (force), so that there is no jump in the output
! when going from manual to auto.
! When using algorithms with I-part, the output is divided in two parts, depending
! on the bitmask WindupMask. The I-part is always calculated and limited in the
! OutWindup, and you can select to include the Bias, the P-part and the D-part also.
! OutWindup is limited to MinWindup and MaxWindup, which sets the signals EndMin and EndMax
! The rest of the output is calculated as an absolute part in AbsOut, that is added to the
! OutWindup, and then limited to MinOutput and MaxOutput.
! You can still turn off the integration
! with an input to the object
!
! The PID-object has two outputs.
...
...
@@ -95,21 +103,32 @@ SObject pwrb:Class
!
! You can use a feedforward signal by the Bias-input, with BiasGain.
!
! The output, OutVal, is limited to the interval { MinOut , MaxOut }. This means
! The output from the controller is divided in two parts, OutWindup and AbsOut.
! The OutWindup contains the I-part and possibly the bias, P and D parts.
! Select by WindupMask between I, BI, BPI and BPID.
! OutWindup, is limited to the interval { MinWindup , MaxWindup }. This means
! that you can loose your stable controlpoint if you have much noise. Especially
! if you use the D-part of the controller. The interval should normally be a bit
! larger than the possible output to the process.
! if you use the D-part of the controller. If you set the flag WindupMask to BIP
! you remove the influence of D from the OutWindup. You can also set it to BI or I to remove the
! influence of P and Bias from the OutWindup
! The total output is also limited to the interval {MinOut , MaxOut }
!
! Example: You have a rather noisy flowcontrol with an output 0-100% as
! speedreference to a pump.
! speedreference to a pump.
WindupMask = BPID. MinWindup = 0, MaxWindup = 100.
! The output varies +- 5% as a result of the noise. At the moment we need 98%
! output as an average to reach the desired setpoint. If we use 100% as Max
Out
! output as an average to reach the desired setpoint. If we use 100% as Max
Windup
! for the controller, the output will be cut all the time, and it will vary
! between 90 and 100% with 95% as an average. We will not reach the setpoint.
! The solution is to allow the output from -10% to 110%, and then limit the
! output outside the controller.
! The solution is to change WindupMask to I or BI. The disturbances will not affect the windup,
! but the output will still be limited to 0-100 %
!
! For a servo valve for position control, you may want to have a slow I-part for leakage control,
! but limited to +- 20 %. WindupMask = I or BI,
! Set MinWindup = -20, Max Windup = + 20, MinOutput = -100, Max Output = +100
! EndMin and EndMax can now be used to give alarm for leakage.
!
! The controller has bumpless transfer between manual and auto, and after forced
! output, but not if you use the P or PD-form.
! output, but not if you use the P or PD-form
with the flag PDAbsFlag
.
!
!
!
...
...
@@ -142,13 +161,14 @@ SObject pwrb:Class
! PID (lower left) adds a short spike at the start, which in this case
! doesn't affect anything.
! MaxOut = 500%
! PID (lower right) is identical with the left, except for Max
Out
= 100%,
! which gives "wrong" result.
! PID (lower right) is identical with the left, except for Max
Windup
= 100%,
!
and WindupMask = BPID,
which gives "wrong" result.
! At the setpoint step, the P-part gives an increase of 30 %, and the
! P-part wants a spike of 90 %. That results in an output of 155%, which
! is cut to 100% because of saturation of the output signal. Then the D-part
! will remove 90 % again, and the controller will restart from 10% output,
! which is not desired.
! Use WindupMask = BPI !!
!
!
! @h1 Examples
...
...
@@ -426,13 +446,13 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Specifies if Out
Val
at this scanning has been limited
! Specifies if Out
Windup
at this scanning has been limited
! against any of the limit values in the interval {
! Min
Out, MaxOut
} or not. If a limitation is done
! Min
Windup, MaxWindup
} or not. If a limitation is done
! against
!
! -- Min
Out
, then EndMin is set TRUE
! -- Max
Out
, then EndMax is set TRUE
! -- Min
Windup
, then EndMin is set TRUE
! -- Max
Windup
, then EndMax is set TRUE
! else they are FALSE.
!
! EndMin /EndMax can only be set in AUTO or CASCADE
...
...
@@ -576,16 +596,60 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! At AUTO and CASCADE control the control signal OutVal
! is supposed to be in the interval { MinOut, MaxOut }.
! Flag to force no offset after manual mode. Will cause an output jump
! when switching from manual to Auto. Not Bumpless transfer!
!*/
Object PDAbsFlag $Intern 49
Body SysBody
Attr TypeRef = "pwrb:Type-Boolean"
Attr GraphName = "PDAbsFlag"
EndBody
EndObject
!/**
! WindupMask
! The possible values are as follows:
!
! 1 -- I Only the I-part is limited in OutWindup
!
! 2 -- BI Bias and I are limited in OutWindup
!
! 4 -- BPI Bias, P and I are limited in OutWindup
!
! 8 -- BPID All parts of the controller are limited in OutWindup
!*/
Object WindupMask $Intern 50
Body SysBody
Attr TypeRef = "pwrb:Type-WindupMaskEnum"
Attr GraphName = "WindupMask"
EndBody
EndObject
!/**
! At AUTO and CASCADE control for controllers with an I-part,
! the control signal OutWindup is supposed to be
! in the interval { MinWindup, MaxWindup }.
! The EndMin /EndMax flags are used to signal if any
! limitation has occurred.
! If Out
Val is greater than MaxOut or less than MinOut
,
! Out
Val
is limited to the value at the end of the
! If Out
Windup is greater than MaxWindup or less than MinWindup
,
! Out
Windup
is limited to the value at the end of the
! interval.
! If MinWindup >= MaxWindup no limitation will occur.
!
! After addition of the absolute output part,
! OutVal is limited to the interval {MinOut , MaxOut }.
! If MinOut >= MaxOut no limitation will occur.
!*/
Object MinWindup $Intern 51
Body SysBody
Attr TypeRef = "pwrb:Type-Float32"
Attr GraphName = "MinWindup"
EndBody
EndObject
Object MaxWindup $Intern 52
Body SysBody
Attr TypeRef = "pwrb:Type-Float32"
Attr GraphName = "MaxWindup"
EndBody
EndObject
Object MinOut $Intern 19
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
...
...
@@ -599,6 +663,73 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Specifies the hysteresis on MinOut and MaxOut in
! connection with the handling of EndMin/EndMax.
! @image orm_en1-144.gif
!*/
Object EndHys $Intern 47
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "EndHys"
EndBody
EndObject
!/**
! The lower respectively upper limit in the graph at
! presentation of ProcVal and SetVal in the Pid object
! display. The values may be changed in the more info
! form of the Pid object.
!*/
Object SetMinShow $Intern 41
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "SetMinShow"
EndBody
EndObject
Object SetMaxShow $Intern 40
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "SetMaxShow"
EndBody
EndObject
!/**
! Specifies the engineering unit of SetVal / SetMinShow /
! SetMaxShow, e.g. meter. Used in the Pid object display.
!*/
Object SetEngUnit $Intern 44
Body SysBody
Attr TypeRef = "pwrs:Type-$String16"
Attr GraphName = "SetEngUnit"
EndBody
EndObject
!/**
! The lower respectively upper limit in the graph at
! presentation of the control signal OutVal in the Pid
! object display. The values may be changed in the more
! info form of the Pid object.
!*/
Object OutMinShow $Intern 43
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "OutMinShow"
EndBody
EndObject
Object OutMaxShow $Intern 42
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "OutMaxShow"
EndBody
EndObject
!/**
! Specifies the engineering unit of OutVal / Force / OutMinShow /
! OutMaxShow, e.g., %. Used in the Pid object display.
!*/
Object OutEngUnit $Intern 45
Body SysBody
Attr TypeRef = "pwrs:Type-$String16"
Attr GraphName = "OutEngUnit"
EndBody
EndObject
!/**
! Program cycle period in seconds, i.e. the sample time.
!*/
Object ScanTime $Intern 21
...
...
@@ -758,97 +889,65 @@ SObject pwrb:Class
Attr GraphName = "MaxBGain"
EndBody
EndObject
Object SetMaxShow $Intern 40
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "SetMaxShow"
EndBody
EndObject
!/**
! The lower respectively upper limit in the graph at
! presentation of ProcVal and SetVal in the Pid object
! display. The values may be changed in the more info
! form of the Pid object.
! Specifies the complete name of the Mode object
! associated to this Pid object. The attribute makes it
! possible to start the object display of the associated
! Mode object from a button in the object display of the
! Pid object.
!*/
Object
SetMinShow $Intern 41
Object
ModeObjDId $Intern 46
Body SysBody
Attr TypeRef = "pwrs:Type-$
Float32
"
Attr GraphName = "
SetMinShow
"
Attr TypeRef = "pwrs:Type-$
Objid
"
Attr GraphName = "
ModeObjDId
"
EndBody
EndObject
!/**
! The lower respectively upper limit in the graph at
! presentation of the control signal OutVal in the Pid
! object display. The values may be changed in the more
! info form of the Pid object.
! Filtered derivative is saved to the next program cycle.
!*/
Object OutMaxShow $Intern 42
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "OutMaxShow"
EndBody
EndObject
Object OutMinShow $Intern 43
Object FiltDer $Intern 48
Body SysBody
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "OutMinShow"
EndBody
EndObject
!/**
! Specifies the engineering unit of SetMinShow /
! SetMaxShow, e.g. meter. Used in the Pid object display.
!*/
Object SetEngUnit $Intern 44
Body SysBody
Attr TypeRef = "pwrs:Type-$String16"
Attr GraphName = "SetEngUnit"
EndBody
EndObject
!/**
! Specifies the engineering unit of OutMinShow /
! OutMaxShow, e.g., %. Used in the in the Pid object
! display.
!*/
Object OutEngUnit $Intern 45
Body SysBody
Attr TypeRef = "pwrs:Type-$String16"
Attr GraphName = "OutEngUnit"
Attr GraphName = "FiltDer"
EndBody
EndObject
!/**
! Specifies the complete name of the Mode object
! associated to this Pid object. The attribute makes it
! possible to start the object display of the associated
! Mode object from a button in the object display of the
! Pid object.
! Offset for PD-controller when switching from manual to auto mode
!*/
Object
ModeObjDId $Intern 46
Object
PDManOffset $Intern 53
Body SysBody
Attr TypeRef = "pwrs:Type-$Objid"
Attr GraphName = "ModeObjDId"
Attr TypeRef = "pwrb:Type-Float32"
Attr GraphName = "PDManOffset"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
EndBody
EndObject
!/**
! Specifies the hysteresis on MinOut and MaxOut in
! connection with the handling of EndMin/EndMax.
! @image orm_en1-144.gif
! Output that is cut off (limited) with MinWindup and MaxWindup
!*/
Object
EndHys $Intern 47
Object
OutWindup $Intern 54
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "EndHys"
Attr TypeRef = "pwrb:Type-Float32"
Attr GraphName = "OutWindup"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
EndBody
EndObject
!/**
!
Filtered derivative is saved to the next program cycle.
!
The absolute part of the output. (Contrary to OutWindup)
!*/
Object
FiltDer $Intern 48
Object
AbsOut $Intern 55
Body SysBody
Attr TypeRef = "pwrb:Type-Float32"
Attr GraphName = "AbsOut"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_INVISIBLE
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "FiltDer"
EndBody
EndObject
EndObject
...
...
@@ -907,6 +1006,8 @@ SObject pwrb:Class
Attr SetMaxShow = 100.0
Attr SetEngUnit = "%"
Attr OutEngUnit = "%"
Attr WindupMask = 4
Attr MaxWindup = 100.0
EndBody
EndObject
EndObject
...
...
src/wbl/pwrb/src/pwrb_sv_se.txt
View file @
95e99d16
...
...
@@ -7509,14 +7509,15 @@ satta under en tid som
@image orm_en1-100.gif
Insignalen OutChange betraktas som ett reglerfel. Detta fel överförs till en tid
genom multiplikation med Gain . Produkten adderas till ackumulatorn Acc .
genom multiplikation med Gain . Produkten adderas till ackumulatorn Acc.
Absolutvärdet av Acc begränsas till MaxWindup.
Om absolut värdet av Acc är större än MinTim sätts någon av utgångarna Open
eller Close till TRUE.
Om Acc > MinTim sätts 'öka' signalen (= Open ) så länge som Acc
=
0 , om, å
Om Acc > MinTim sätts 'öka' signalen (= Open ) så länge som Acc
>
0 , om, å
andra sidan, Acc < - MinTim sätts 'minska' signalen (= Close ) så länge som
Acc
=
0. Vid varje exekvering räknas värdet av Acc ned respektive upp med ett
Acc
<
0. Vid varje exekvering räknas värdet av Acc ned respektive upp med ett
tidsbelopp av ScanTime , beroende på om 'öka' eller 'minska' signalen satts.
För att undvika 'obefogade' styringrepp, som skulle kunna skada ställdon vid
...
...
@@ -7608,6 +7609,12 @@ Ackumulerad styrsignal - ingrepp i form av tid.
Ackumulerad löptid utan ingrepp.
</attr>
<attr>MaxWindup
Absolutvärdet av Acc begränsas till MaxWindupsekunder, för att undvika oändlig
uppvridning vid felsatta parametrar. Negativt eller noll ger ingen begränsning.
Bör vara nära gångtid från helt stängd till helt öppen. Default 30 sek.
</attr>
<attr>TimerFlag
Markerar aktiv timer.
</attr>
...
...
@@ -8922,13 +8929,13 @@ objektets objektbild. Gr
</attr>
<attr>SetEngUnit
Anger ingenjörsenheten för
SetMinShow / SetMaxShow , t.ex kg. Används i
Mode-objektets objektbild.
Anger ingenjörsenheten för
XSetVal / SetVal / SetMinShow / SetMaxShow, t.ex kg.
Används i
Mode-objektets objektbild.
</attr>
<attr>OutEngUnit
Anger ingenjörsenheten för
OutMinShow / OutMaxShow , t.ex %. Används i
Mode-objektets objektbild.
Anger ingenjörsenheten för
XForcVal / OutVal /ForcVal / OutMinShow / OutMaxShow, t.ex %.
Används i
Mode-objektets objektbild.
</attr>
<attr>PidObjDid
...
...
@@ -10361,10 +10368,14 @@ bara genom att det st
Vid P- och PD-algoritm används en absolut algoritm. Utsignalen kan då alltså inte
ligga stabilt skilt från noll utan regleravvikelse, annat än om man använder en
framkopplingssignal.
Vid alla algoritmer med I-del baseras hela tiden förändringar i utsignalen på
förändringar i insignalerna. Man kan fortfarande stänga av integrereringen med
en insignal till objektet.
framkopplingssignal. Om flaggan PDAbsFlag sitter, så beräknas en offset i manuell mod,
så att vi får en stötfri övergång till auto.
Vid alla algoritmer med I-del delas utsignalen upp i två delar ned hjälp av masken WindupMask.
I-delen ingår alltid i OutWindup, medanBias, P-delen och D-delen kan tillhöra antingen OutWindup
eller AbsOut.
OutWindup begränsas av MinWindup och MaxWindup, vilket sätter flaggorna EndMin och EndMax.
Resten av utsignalen lagras i AbsOut, och total utsignal begränsas med MinOut och MaxOut
Man kan även stänga av integrereringen med en insignal till objektet.
Pid-objektet har två utgångar som båda kan användas som styrsignal. Vilken som
används i det enskilda fallet beror på hur regleringen är ordnad:
...
...
@@ -10388,25 +10399,35 @@ s
skulle bli utan filtrering.
En framkopplingssignal, Bias, kan inkluderas i algoritmen genom en ingångssignal
till objektet.
till objektet.
Förstärkning framkoppling anges med BiasGain.
Utvärdet, OutVal, begränsas till intervallet { MinOut, MaxOut }. Det innebär att
Regulatorns utsignal OutVal är uppdelad i två delar, OutWindup och AbsOut.
I-delen innefattas alltid i OutWindup. Med WindupMask kan man styra även Bias,
P-delen och D-delen till OutWindup.
OutWindup, begränsas till intervallet { MinWindup, MaxWindup }. Det innebär att
man kan tappa det stabila läget vid en orolig reglering, speciellt vid inkopplad
D-del.
D-del. Om man sätter flaggan WindupMask till BIP, så tar man bort D-delens inflytande
på OutWindup. Man kan även sätta den till BI eller I för att ta bort P-delen och
Bias från OutWindup.
Den totala utsignalen OutVal begränsas till intervallet { MinOut , MaxOut }.
Exempel: Vi har en ganska orolig flödesreglering (utsignal 0-100 %) och reglerar
nära maxvarvet för pumpen.
Vi behöver styra ut i snitt 98 % för att nå önskat
börvärde. Utsignalen fladdrar ca +- 5 % pga störningar. Om MaxOut är 100 %, så
innebär det att regulatorn bottnar regelbundet. Utsignalen kommer då att svänga
mellan 90 och 100 % med en medelutsignal på ca 95%, och vi når inte önskat
nära maxvarvet för pumpen.
WindupMask = BPID. Vi behöver styra ut i snitt 98 % för
att nå önskat börvärde. Utsignalen fladdrar ca +- 5 % pga störningar.
Om MaxWindup är 100 %, så innebär det att regulatorn bottnar regelbundet. Utsignalen
kommer då att svänga
mellan 90 och 100 % med en medelutsignal på ca 95%, och vi når inte önskat
börvärde.
Lösning: Sätt MinOut och MaxOut till -10 % resp 110 %. Utsignalen kommer att
svänga mellan 93 och 103% med ett medel på 98%, och vi uppnår önskat börvärde.
Utsignalen får sedan begränsas till 0 - 100 % utanför PID-regulatorn.
Lösning: Sätt WindupMask till I eller BI. Störningarna kommer inte att påverka MaxWindup.
För en servoventil med positionsreglering, kan man vilja ha en långsam I-del för läckagekontroll,
begränsad till +- 20 %. Sätt WindupMask till I eller BI.
Sätt MinWindup = -20% och MaxWindup till +20%, MinOutput = -100 %, MaxOutput = 100 %
EndMin och EndMax kan användas för läckagelarm.
Regulatorn har stötfri omkoppling AUTO / MANUAL och efter annan tvångsstyrning av
regulatorn.
Dock ej vid P- eller PD-reglering.
Dock ej vid P- eller PD-reglering
, om man har PDAbsFlag satt
.
EXEMPEL 1
...
...
@@ -10638,8 +10659,8 @@ operat
</attr>
<attr>OutChange
Regulatorns syrsignal baserad på 'incremental form'
.
Regulatorns syrsignal baserad på 'incremental form'
, eller förändring i styrsignalen
vid 'positional form'.
Attributet avser styrsignalsförändringen mellan två konsekutiva exekveringar;
dvs. OutVal t - OutVal t-1 .
</attr>
...
...
@@ -10649,14 +10670,14 @@ Reglerfelet (= ProcVal - SetVal ).
</attr>
<attr>EndMin
Om beräknat värde på Out
Val inte tillhör intervallet { MinOut , MaxOut
} ska
Om beräknat värde på Out
Windup inte tillhör intervallet { MinWindup , MaxWindup
} ska
begränsning ske till motsvarande intervallgräns. Attributet anger om sådan
begränsning skett vid den senaste exekveringen eller ej.
Om begränsning görs mot
-- Min
Out
, ska EndMin sättas TRUE
-- Max
Out
, ska EndMax sättas TRUE
-- Min
Windup
, ska EndMin sättas TRUE
-- Max
Windup
, ska EndMax sättas TRUE
annars är de FALSE.
...
...
@@ -10748,11 +10769,10 @@ V
<attr>MinOut
I driftläge AUTO och CASCADE ska den utställda styrsignlaen OutVal vara i
intervallet { MinOut , MaxOut }. Flaggorna EndMin / EndMax används för att
signalera då begränsning sker.
intervallet { MinOut , MaxOut }.
Om OutVal är större än MaxOut eller mindre än MinOut , begränsas OutVal
till värdet av motsvarande intervallgräns.
Om MinOut = MaxOut sker ingen begränsning.
Om MinOut
>
= MaxOut sker ingen begränsning.
</attr>
<attr>MaxOut
...
...
@@ -10909,6 +10929,45 @@ EndMin / EndMax flaggorna.
Filtrerad derivata sparas till nästa exekevering.
</attr>
<attr>PDAbsFlag
Anger att utsignalen beräknas direkt med regleravvikelsen.
Vid nollvärde beräknas en offset i manuell mod, så att vi får stötfri övergång till auto.
</attr>
<attr>WindupMask
Möjliga värden är:
1 -- I Bara I-delen begränsas i OutWindup
2 -- BI I-delen och Bias begränsas i OutWindup
4 -- BIP Också P-delen begränsas i OutWindup
8 -- BIPD Hela utsignalen, även D-delen begränsas i OutWindup
</attr>
<attr>MinWindup
I driftläge AUTO och CASCADE ska den utställda styrsignalen OutWindup vara i
intervallet { MinWindup , MaxWindup }. Flaggorna EndMin / EndMax används för att
signalera då begränsning sker.
Om OutWindup är större än MaxWindup eller mindre än MinWindup , begränsas OutWindup
till värdet av motsvarande intervallgräns.
Om MinWindup >= MaxWindup sker ingen begränsning.
</attr>
<attr>MaxWindup
Se MinOut
</attr>
<attr>PDManOffset
Offset beräknas i manuell mod, och används vid P och PD-algoritm
för att få stötfri övergång till auto.
</attr>
<attr>OutWindup
Utsignal som begränsas av MinWindup och MaxWindup
</attr>
<attr>AbsOut
Utsignaldel som ligger utanför OutWindup
</attr>
<attr>OpMod
OpMod = MANUAL (=1)
Då Mode-objektets for-utgång blir TRUE tvingas Pid-objekt utgång
...
...
src/wbl/pwrb/src/pwrb_td_windupmaskenum.wb_load
0 → 100644
View file @
95e99d16
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2014 SSAB EMEA AB.
!
! This file is part of Proview.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with Proview. If not, see <http://www.gnu.org/licenses/>
!
! Linking Proview statically or dynamically with other modules is
! making a combined work based on Proview. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! Proview give you permission to, from the build function in the
! Proview Configurator, combine Proview with modules generated by the
! Proview PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of Proview (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_windupmaskenum.wb_load -- Defines the mask type WindupMaskEnum
!
SObject pwrb:Type
!/**
! @Version 1.0
! @Group Types
! Enumeration for PID WindupMask.
!
! @b See also
! @classlink PID pwrb_pid.html
!*/
Object WindupMaskEnum $TypeDef 75
Body SysBody
Attr TypeRef = "pwrs:Type-$Enum"
Attr PgmName = "WindupMaskEnum"
EndBody
!/**
! Integral part only
!*/
Object IWUP $Value
Body SysBody
Attr PgmName = "IWUP"
Attr Text = "I"
Attr Value = 1
EndBody
EndObject
!/**
! Bias and Integral part
!*/
Object BIWUP $Value
Body SysBody
Attr PgmName = "BIWUP"
Attr Text = "BI"
Attr Value = 2
EndBody
EndObject
!/**
! Bias, Integral and Proportional part
!*/
Object BPIWUP $Value
Body SysBody
Attr PgmName = "BPIWUP"
Attr Text = "BPI"
Attr Value = 4
EndBody
EndObject
!/**
! All parts of the controller are limited in OutWindup
!*/
Object BPIDWUP $Value
Body SysBody
Attr PgmName = "BPIDWUP"
Attr Text = "BPID"
Attr Value = 8
EndBody
EndObject
EndObject
EndSObject
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment