-
Notifications
You must be signed in to change notification settings - Fork 1
StControl
State controller OOP class that creates LQ-PID controllers with static or
dynamic sampling time. They are used generally for every kind of
automatic control that is needed in Wiremod. Supports a bunch of general
tuning methods, I studied at the university and can be
initialized as a relay, linear or power controller. The error E
with power
P
can be any real number. When zero, the output is calculated as relay,
when equal to 1
, we have the classic PID controller when the power
is 2
the error has quadratic relation E^2
, 3
, for cubic E^3
and so on needed for aero-propeller systems. Negative powers will be treated as error
square root E^(-2) = 1/E^2
. The user can apply even fractional powers P
on each term.
The fractional powers can be treated as the numerator is taken as the power and the
denominator as a root. However, there is no difference in which operation will be applied first
as you have E^(2/5) = sqr5(E^2) = sqr5(E)^2
. It has a lot of possibilities. The only limits is your imagination.
The StControl
class consists of fast performing controller object-oriented
instance that is designed to be @persist
and initialized in expression
first() || dupefinished()
. That way you create the controller instance once
and you can use it as many times as you need, without creating a new one.
wire_expression2_stcontrol_enst > Contains flag that enables status output messages
wire_expression2_stcontrol_dprn > Stores the default status output messages streaming destination
You can create a controller object by calling one of the dedicated creators newStControl
below
either with an argument of sampling time to make the sampling time static or without
a parameter to make it take the value dynamically as some other thing may slow down the E2.
Then you must activate the instance setIsActive(1)
to enable it to calculate the control signal,
apply the current state values setState
and retrieve the control signal afterwards by calling
getControl(...)
.
The internal type of the class is xsc
and internal expression type stcontrol
, so to create
an instance you can take a look at the example.
The description of the API is provided in the table below.
Instance creator | Out | Description |
---|---|---|
newStControl () |
Creates state controller object with dynamic sampling time | |
newStControl () |
Creates state controller object with static sampling time | |
noStControl () |
Returns state controller invalid object |
Class methods | Out | Description |
---|---|---|
:dmpInfo () |
Dumps state controller to the chat area by number identifier | |
:dmpInfo () |
Dumps state controller to the chat area by string identifier | |
:dmpInfo (,) |
Dumps state controller by number identifier in the specified area by first argument | |
:dmpInfo (,) |
Dumps state controller by string identifier in the specified area by first argument | |
:dumpItem () |
Dumps state controller to the chat area by number identifier | |
:dumpItem () |
Dumps state controller to the chat area by string identifier | |
:dumpItem (,) |
Dumps state controller by number identifier in the specified area by first argument | |
:dumpItem (,) |
Dumps state controller by string identifier in the specified area by first argument | |
:getBias () |
Returns state controller output signal bias | |
:getControl () |
Returns state controller automated control output signal value | |
:getControlTerm () |
Returns state controller automated control term signals as vector or array | |
:getControlTerm () |
Returns state controller automated control term signals as vector or array | |
:getControlTermD () |
Returns state controller derivative automated control term signal | |
:getControlTermI () |
Returns state controller integral automated control term signal | |
:getControlTermP () |
Returns state controller proportional automated control term signal | |
:getCopy () |
Returns state controller object copy instance | |
:getCopy () |
Returns state controller object copy instance with static sampling time | |
:getErrorDelta () |
Returns state controller process error delta | |
:getErrorNow () |
Returns state controller process current error | |
:getErrorPast () |
Returns state controller process passed error | |
:getGain () |
Returns state controller proportional, integral and derivative term gains | |
:getGain () |
Returns state controller proportional, integral and derivative term gains | |
:getGainD () |
Returns state controller derivative term gain | |
:getGainI () |
Returns state controller integral term gain | |
:getGainID () |
Returns state controller integral and derivative term gain | |
:getGainID () |
Returns state controller integral and derivative term gain | |
:getGainP () |
Returns state controller proportional term gain | |
:getGainPD () |
Returns state controller proportional and derivative term gain | |
:getGainPD () |
Returns state controller proportional and derivative term gain | |
:getGainPI () |
Returns state controller proportional and integral term gain | |
:getGainPI () |
Returns state controller proportional and integral term gain | |
:getManual () |
Returns state controller manual control signal value | |
:getPower () |
Returns state controller proportional, integral and derivative term power | |
:getPower () |
Returns state controller proportional, integral and derivative term power | |
:getPowerD () |
Returns state controller derivative term power | |
:getPowerI () |
Returns state controller integral term power | |
:getPowerID () |
Returns state controller integral and derivative term power | |
:getPowerID () |
Returns state controller integral and derivative term power | |
:getPowerP () |
Returns state controller proportional term power | |
:getPowerPD () |
Returns state controller proportional and derivative term power | |
:getPowerPD () |
Returns state controller proportional and derivative term power | |
:getPowerPI () |
Returns state controller proportional and integral term power | |
:getPowerPI () |
Returns state controller proportional and integral term power | |
:getTimeBench () |
Returns state controller dynamic process benchmark time | |
:getTimeDelta () |
Returns state controller dynamic process time delta | |
:getTimeNow () |
Returns state controller dynamic process current time | |
:getTimePast () |
Returns state controller dynamic process passed time | |
:getTimeRatio () |
Returns state controller dynamic process time ratio | |
:getTimeSample () |
Returns state controller static process time delta | |
:getType () |
Returns state controller control type | |
:getWindup () |
Returns state controller windup lower and upper bound | |
:getWindup () |
Returns state controller windup lower and upper bound | |
:getWindupMax () |
Returns state controller windup upper bound | |
:getWindupMin () |
Returns state controller windup lower bound | |
:getZeroCross () |
Checks state controller integral zero crossing margin | |
:isActive () |
Checks state controller activated working flag | |
:isCombined () |
Checks state controller combined flag spreading proportional term gain across others | |
:isDerivative () |
Checks state controller derivative enabled flag | |
:isIntegral () |
Checks state controller integral enabled flag | |
:isInverted () |
Checks state controller inverted feedback flag of the reference and set-point | |
:isManual () |
Checks state controller manual control signal flag | |
:isZeroCross () |
Checks state controller integral zero crossing flag | |
:remGain () |
Removes state controller proportional, integral and derivative term gains | |
:remGainD () |
Removes state controller derivative term gain | |
:remGainI () |
Removes state controller integral term gain | |
:remGainID () |
Removes state controller integral and derivative term gains | |
:remGainP () |
Removes state controller proportional term gain | |
:remGainPD () |
Removes state controller proportional and derivative term gains | |
:remGainPI () |
Removes state controller proportional and integral term gains | |
:remTimeSample () |
Removes state controller static process time delta | |
:remWindup () |
Removes state controller windup lower and upper bound | |
:remWindupMax () |
Removes state controller windup upper bound | |
:remWindupMin () |
Removes state controller windup lower bound | |
:resState () |
Resets state controller automated internal parameters | |
:setBias () |
Updates state controller output signal bias | |
:setGain (,,) |
Updates state controller proportional, integral and derivative term gains | |
:setGain () |
Updates state controller proportional, integral and derivative term gains | |
:setGain () |
Updates state controller proportional, integral and derivative term gains | |
:setGainD () |
Updates state controller derivative term gain | |
:setGainI () |
Updates state controller integral term gain | |
:setGainID (,) |
Updates state controller integral and derivative term gains | |
:setGainID () |
Updates state controller integral and derivative term gains | |
:setGainID () |
Updates state controller integral and derivative term gains | |
:setGainP () |
Updates state controller proportional term gain | |
:setGainPD (,) |
Updates state controller proportional and derivative term gains | |
:setGainPD () |
Updates state controller proportional and derivative term gains | |
:setGainPD () |
Updates state controller proportional and derivative term gains | |
:setGainPI (,) |
Updates state controller proportional and integral term gains | |
:setGainPI () |
Updates state controller proportional and integral term gains | |
:setGainPI () |
Updates state controller proportional and integral term gains | |
:setIsActive () |
Updates state controller activated working flag | |
:setIsCombined () |
Updates state controller combined flag spreading proportional term gain across others | |
:setIsDerivative () |
Updates state controller derivative enabled flag | |
:setIsIntegral () |
Updates state controller integral enabled flag | |
:setIsInverted () |
Updates state controller inverted feedback flag of the reference and set-point | |
:setIsManual () |
Updates state controller manual control signal flag | |
:setIsZeroCross () |
Updates state controller integral zero crossing flag | |
:setManual () |
Updates state controller manual control signal value | |
:setPower (,,) |
Updates state controller proportional, integral and derivative term powers | |
:setPower () |
Updates state controller proportional, integral and derivative term powers | |
:setPower () |
Updates state controller proportional, integral and derivative term powers | |
:setPowerD () |
Updates state controller derivative term power | |
:setPowerI () |
Updates state controller integral term power | |
:setPowerID (,) |
Updates state controller integral and derivative term powers | |
:setPowerID () |
Updates state controller integral and derivative term powers | |
:setPowerID () |
Updates state controller integral and derivative term powers | |
:setPowerP () |
Updates state controller proportional term power | |
:setPowerPD (,) |
Updates state controller proportional and derivative term powers | |
:setPowerPD () |
Updates state controller proportional and derivative term powers | |
:setPowerPD () |
Updates state controller proportional and derivative term powers | |
:setPowerPI (,) |
Updates state controller proportional and integral term powers | |
:setPowerPI () |
Updates state controller proportional and integral term powers | |
:setPowerPI () |
Updates state controller proportional and integral term powers | |
:setState (,) |
Updates state controller automated internal parameters | |
:setTimeSample () |
Updates state controller static process time delta | |
:setWindup (,) |
Updates state controller windup lower and upper bound | |
:setWindup () |
Updates state controller windup lower and upper bound | |
:setWindup () |
Updates state controller windup lower and upper bound | |
:setWindupMax () |
Updates state controller windup upper bound | |
:setWindupMin () |
Updates state controller windup lower bound | |
:setZeroCross () |
Updates state controller integral zero crossing margin | |
:tuneAutoTL (,) |
Tunes state controller using the method (TL ) Tyreus-Luyben auto oscillation
|
|
:tuneAutoZN (,) |
Tunes state controller using the method (ZN ) Ziegler-Nichols auto oscillation
|
|
:tuneAutoZN (,,) |
Tunes state controller using the method (ZN ) Ziegler-Nichols auto oscillation extended by type: classic , pessen , sovers , novers
|
|
:tuneOverCHRLR (,,) |
Tunes state controller using the method (CHR ) Chien-Hrones-Reswick load rejection 20% overshot |
|
:tuneOverCHRSP (,,) |
Tunes state controller using the method (CHR ) Chien-Hrones-Reswick set point track 20% overshot |
|
:tuneProcAH (,,) |
Tunes state controller using the method (AH ) Astrom-Hagglund |
|
:tuneProcCC (,,) |
Tunes state controller using the method (CC ) Choen-Coon
|
|
:tuneProcCHRLR (,,) |
Tunes state controller using the method (CHR ) Chien-Hrones-Reswick load rejection |
|
:tuneProcCHRSP (,,) |
Tunes state controller using the method (CHR ) Chien-Hrones-Reswick set point track |
|
:tuneProcIAE (,,) |
Tunes state controller using the method (IAE ) Integral absolute error
|
|
:tuneProcISE (,,) |
Tunes state controller using the method (ISE ) Integral square error
|
|
:tuneProcITAE (,,) |
Tunes state controller using the method (ITAE ) Integral of time-weighted absolute error
|
|
:tuneProcZN (,,,) |
Tunes state controller using the method (ZNM ) Ziegler-Nichols plant process
|