g.mccormick
Lifetime Supporting Member
In my project, I have created a UDT for VFD driven motor. The UDT has elements of .SpdCmd, .ManSpdCmd, .MinLim, .MaxLim among others. The idea being that depending on state, the .SpdCmd is either set to the output of a PID loop, or just directly to the value of .ManSpdCmd (manual). The Min and MaxLim elements allow the setting of minimum and maximum outputs (ex. 25%min and 88%max).
The question is should I just limit the .SpdCmd between the min and max. IE.
(Excuse the pseudo code)
If MyMotor.SpdCmd < MyMotor.MinLim then
MyMotor.SpdCmd = MyMotor.MinLim
Or should I instead scale the .SpdCmd. ( I already have an AOI that I built for scaling)..IE:
If MyMotor.Automode then
LAD_SCALE( In=PID.CV,
InMin=0,
InMax=100,
OutMin= MyMotor.MinLim,
OutMax = MyMotor.MaxLim,
Output= MyMotor.SpdCmd)
if NOT MyMotor.Automode then
LAD_SCALE( In=MyMotor.ManSpdCmd,
InMin=0,
InMax=100,
OutMin= MyMotor.MinLim,
OutMax = MyMotor.MaxLim,
Output= MyMotor.SpdCmd)
Honestly the only issue I see with simply scaling the .SpdCmd is that if doing manual manipulation, if someone types in 25%, the spd cmd will not be set to 25% but will instead be scaled.
The 3rd option would be to scale in auto, and write directly (bypass all min and max limits) in manual. This may actually be the best option since manual is only intended to be used in actual manual usage (ie. I'm standing there and typing in a command I want to run for some reason).
The question is should I just limit the .SpdCmd between the min and max. IE.
(Excuse the pseudo code)
If MyMotor.SpdCmd < MyMotor.MinLim then
MyMotor.SpdCmd = MyMotor.MinLim
Or should I instead scale the .SpdCmd. ( I already have an AOI that I built for scaling)..IE:
If MyMotor.Automode then
LAD_SCALE( In=PID.CV,
InMin=0,
InMax=100,
OutMin= MyMotor.MinLim,
OutMax = MyMotor.MaxLim,
Output= MyMotor.SpdCmd)
if NOT MyMotor.Automode then
LAD_SCALE( In=MyMotor.ManSpdCmd,
InMin=0,
InMax=100,
OutMin= MyMotor.MinLim,
OutMax = MyMotor.MaxLim,
Output= MyMotor.SpdCmd)
Honestly the only issue I see with simply scaling the .SpdCmd is that if doing manual manipulation, if someone types in 25%, the spd cmd will not be set to 25% but will instead be scaled.
The 3rd option would be to scale in auto, and write directly (bypass all min and max limits) in manual. This may actually be the best option since manual is only intended to be used in actual manual usage (ie. I'm standing there and typing in a command I want to run for some reason).