0% found this document useful (0 votes)
4 views6 pages

MinPosCodeExpl

The document outlines three options for implementing a PID control loop with a minimum position constraint. Option 1 integrates the PIDLoop function within the Maximum function, while Option 2 keeps them separate, calculating the position before applying the minimum. The third option introduces a public variable for the minimum position, allowing external adjustments to the minimum value used in the control logic.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views6 pages

MinPosCodeExpl

The document outlines three options for implementing a PID control loop with a minimum position constraint. Option 1 integrates the PIDLoop function within the Maximum function, while Option 2 keeps them separate, calculating the position before applying the minimum. The third option introduces a public variable for the minimum position, allowing external adjustments to the minimum value used in the control logic.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Minimum Position – Option 1

‘PIDLoop function embedded in the Maximum function

Numeric Input OaTmp, RaTmp, MaTmp, SaTmpSpt, DprIntlk

Numeric Output DprPos,

Function PIDLoop

Numeric LastErr, LastInt

DateTime LastTime

ControlOff:

DprPos = 0

LastInt = 0

LastTime = Date

if DprIntlk = On then

if OaTmp <= (RaTmp - 2) then

goto FreeCooling

Else
goto RecirculateMode

endif

endif

FreeCooling:

‘DprPos = PIDLoop(MaTmp,SaTmpSpt,0.10,0.000,0,0.5,1,LastErr, LastInt, LastTime) * 100 (no MinPos)

DprPos = Maximum(PIDLoop(MaTmp,SaTmpSpt,0.10,0.000,0,0.5,1,LastErr, LastInt, LastTime) * 100, 25)

if OaTmp >= RaTmp then goto RecirculateMode

if DprIntlk = Off then goto ControlOff

RecirculateMode:

DprPos = 25

LastInt = 0

LastErr = 0

LastTime = Date

if OaTmp <= (RaTmp - 2) then goto FreeCooling

if DprIntlk = Off then goto ControlOff


Min Pos – Option 2
‘PIDLoop function remains on a separate line.

‘Minimum position is determined by a separate Maximum function.

Numeric Input OaTmp,RaTmp,MaTmp,SaTmpSpt,DprIntlk

Numeric Output DprPos, DprPosCalc

Function PIDLoop

Numeric LastErr, LastInt

DateTime LastTime

ControlOff:

DprPos = 0

LastInt = 0

LastTime = Date

if DprIntlk = On then

if OaTmp <= (RaTmp - 2) then

goto FreeCooling
Else

goto RecirculateMode

endif

endif

FreeCooling:

DprPosCalc = PIDLoop(MaTmp,SaTmpSpt,0.10,0.000,0,0.5,1,LastErr, LastInt, LastTime) * 100

DprPos = Maximum(DprPosCalc, 25)

if OaTmp >= RaTmp then goto RecirculateMode

if DprIntlk = Off then goto ControlOff

RecirculateMode:

DprPos = 25

LastInt = 0

LastErr = 0

LastTime = Date

if OaTmp <= (RaTmp - 2) then goto FreeCooling

if DprIntlk = Off then goto ControlOff


Min Pos – Public Variable Green = Need to Adjust
‘Code for allowing Minimum position value to be changed outside the program

‘Employs a Numeric Public variable

Numeric Input OaTmp,RaTmp,MaTmp,SaTmpSpt,DprIntlk

Numeric Output DprPos, DprPosCalc

Function PIDLoop

Numeric LastErr, LastInt

DateTime LastTime

Numeric Public MinDprPos

ControlOff:

DprPos = 0

LastInt = 0

LastTime = Date

if DprIntlk = On then

if OaTmp <= (RaTmp - 2) then

goto FreeCooling
Else

goto RecirculateMode

endif

endif

FreeCooling:

DprPosCalc = PIDLoop(MaTmp,SaTmpSpt,0.10,0.000,0,0.5,1,LastErr, LastInt, LastTime) * 100

DprPos = Maximum(DprPosCalc, MinDprPos)

if OaTmp >= RaTmp then goto RecirculateMode

if DprIntlk = Off then goto ControlOff

RecirculateMode:

DprPos = MinDprPos

LastInt = 0

LastErr = 0

LastTime = Date

if OaTmp <= (RaTmp - 2) then goto FreeCooling

if DprIntlk = Off then goto ControlOff

You might also like