-
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 () |
Returns state control object with dynamic sampling time | |
newStControl () |
Returns state control object with static sampling time | |
noStControl () |
Returns invalid state control object |
Class methods | Out | Description |
---|---|---|
:dumpItem () |
Dumps state control to the chat area by number identifier | |
:dumpItem () |
Dumps state control to the chat area by string identifier | |
:dumpItem (,) |
Dumps state control by number identifier in the specified area by first argument | |
:dumpItem (,) |
Dumps state control by string identifier in the specified area by first argument | |
:getBias () |
Returns state control output signal bias | |
:getControl () |
Returns state control automated control output signal value | |
:getControlTerm () |
Returns state control automated control term signals as vector or array | |
:getControlTerm () |
Returns state control automated control term signals as vector or array | |
:getControlTermD () |
Returns state control derivative automated control term signal | |
:getControlTermI () |
Returns state control integral automated control term signal | |
:getControlTermP () |
Returns state control proportional automated control term signal | |
:getCopy () |
Returns state control object copy instance | |
:getCopy () |
Returns state control object copy instance with static sampling time | |
:getErrorDelta () |
Returns state control process error delta | |
:getErrorNow () |
Returns state control process current error | |
:getErrorPast () |
Returns state control process passed error | |
:getGain () |
Returns state control proportional term gain, integral term gain and derivative term gain | |
:getGain () |
Returns state control proportional term gain, integral term gain and derivative term gain | |
:getGainD () |
Returns state control derivative term gain | |
:getGainI () |
Returns state control integral term gain | |
:getGainID () |
Returns state control integral term gain and derivative term gain | |
:getGainID () |
Returns state control integral term gain and derivative term gain | |
:getGainP () |
Returns state control proportional term gain | |
:getGainPD () |
Returns state control proportional term gain and derivative term gain | |
:getGainPD () |
Returns state control proportional term gain and derivative term gain | |
:getGainPI () |
Returns state control proportional term gain and integral term gain | |
:getGainPI () |
Returns state control proportional term gain and integral term gain | |
:getManual () |
Returns state control manual control signal value | |
:getPower () |
Returns state control proportional term power, integral term power and derivative term power | |
:getPower () |
Returns state control proportional term power, integral term power and derivative term power | |
:getPowerD () |
Returns state control derivative term power | |
:getPowerI () |
Returns state control integral term power | |
:getPowerID () |
Returns state control integral term power and derivative term power | |
:getPowerID () |
Returns state control integral term power and derivative term power | |
:getPowerP () |
Returns state control proportional term power | |
:getPowerPD () |
Returns state control proportional term power and derivative term power | |
:getPowerPD () |
Returns state control proportional term power and derivative term power | |
:getPowerPI () |
Returns state control proportional term power and integral term power | |
:getPowerPI () |
Returns state control proportional term power and integral term power | |
:getTimeBench () |
Returns state control process benchmark time | |
:getTimeDelta () |
Returns state control dynamic process time delta | |
:getTimeNow () |
Returns state control process current time | |
:getTimePast () |
Returns state control process passed time | |
:getTimeRatio () |
Returns state control process time ratio | |
:getTimeSample () |
Returns state control static process time delta | |
:getType () |
Returns state control control type | |
:getWindup () |
Returns state control windup lower bound and windup upper bound | |
:getWindup () |
Returns state control windup lower bound and windup upper bound | |
:getWindupMax () |
Returns state control windup upper bound | |
:getWindupMin () |
Returns state control windup lower bound | |
:isActive () |
Checks state control activated working flag | |
:isCombined () |
Checks state control combined flag spreading proportional term gain across others | |
:isDerivative () |
Checks state control derivative enabled flag | |
:isIntegral () |
Checks state control integral enabled flag | |
:isInverted () |
Checks state control inverted feedback flag of the reference and set-point | |
:isManual () |
Checks state control manual control signal flag | |
:isZeroCross () |
Checks state control integral zero crossing flag | |
:remGain () |
Removes state control proportional term gain, integral term gain and derivative term gain | |
:remGainD () |
Removes state control derivative term gain | |
:remGainI () |
Removes state control integral term gain | |
:remGainID () |
Removes state control integral term gain and derivative term gain | |
:remGainP () |
Removes state control proportional term gain | |
:remGainPD () |
Removes state control proportional term gain and derivative term gain | |
:remGainPI () |
Removes state control proportional term gain and integral term gain | |
:remTimeSample () |
Removes state control static process time delta | |
:remWindup () |
Removes state control windup lower bound and windup upper bound | |
:remWindupMax () |
Removes state control windup upper bound | |
:remWindupMin () |
Removes state control windup lower bound | |
:resState () |
Resets state control automated internal parameters | |
:setBias () |
Updates state control control bias | |
:setGain (,,) |
Updates state control proportional term gain, integral term gain and derivative term gain | |
:setGain () |
Updates state control proportional term gain, integral term gain and derivative term gain | |
:setGain () |
Updates state control proportional term gain, integral term gain and derivative term gain | |
:setGainD () |
Updates state control derivative term gain | |
:setGainI () |
Updates state control integral term gain | |
:setGainID (,) |
Updates state control integral term gain and derivative term gain | |
:setGainID () |
Updates state control integral term gain and derivative term gain | |
:setGainID () |
Updates state control derivative term gain and derivative term gain | |
:setGainP () |
Updates state control proportional term gain | |
:setGainPD (,) |
Updates state control proportional term gain and derivative term gain | |
:setGainPD () |
Updates state control proportional term gain and derivative term gain | |
:setGainPD () |
Updates state control proportional term gain and derivative term gain | |
:setGainPI (,) |
Updates state control proportional term gain and integral term gain | |
:setGainPI () |
Updates state control proportional term gain and integral term gain | |
:setGainPI () |
Updates state control proportional term gain and integral term gain | |
:setIsActive () |
Updates state control activated working flag | |
:setIsCombined () |
Updates combined flag spreading proportional term gain across others | |
:setIsDerivative () |
Updates derivative enabled flag | |
:setIsIntegral () |
Updates integral enabled flag | |
:setIsInverted () |
Updates state control inverted feedback flag of the reference and set-point | |
:setIsManual () |
Updates state control manual control signal value | |
:setIsZeroCross () |
Updates state control integral zero crossing flag | |
:setManual () |
Updates state control manual control value | |
:setPower (,,) |
Updates state control proportional term power, integral term power and derivative term power | |
:setPower () |
Updates state control proportional term power, integral term power and derivative term power | |
:setPower () |
Updates state control proportional term power, integral term power and derivative term power | |
:setPowerD () |
Updates state control derivative term power | |
:setPowerI () |
Updates state control integral term power | |
:setPowerID (,) |
Updates state control integral term power and derivative term power | |
:setPowerID () |
Updates state control integral term power and derivative term power | |
:setPowerID () |
Updates state control derivative term power and derivative term power | |
:setPowerP () |
Updates state control proportional term power | |
:setPowerPD (,) |
Updates state control proportional term power and derivative term power | |
:setPowerPD () |
Updates state control proportional term power and derivative term power | |
:setPowerPD () |
Updates state control proportional term power and derivative term power | |
:setPowerPI (,) |
Updates state control proportional term power and integral term power | |
:setPowerPI () |
Updates state control proportional term power and integral term power | |
:setPowerPI () |
Updates state control proportional term power and integral term power | |
:setState (,) |
Works state control automated internal parameters | |
:setTimeSample () |
Updates state control static process time delta | |
:setWindup (,) |
Updates state control windup lower bound and windup upper bound | |
:setWindup () |
Updates state control windup lower bound and windup upper bound | |
:setWindup () |
Updates state control windup lower bound and windup upper bound | |
:setWindupMax () |
Updates state control windup upper bound | |
:setWindupMin () |
Updates state control windup lower bound | |
:tuneAH (,,) |
Tunes the state control using the Astrom-Hagglund method (AH ) |
|
:tuneAutoZN (,) |
Tunes the state control using the Ziegler-Nichols auto-oscillation method (ZN ) |
|
:tuneAutoZN (,,) |
Tunes the state control using the Ziegler-Nichols auto-oscillation method with overshot option (ZN ) by type: classic , pessen , sovers , novers
|
|
:tuneIAE (,,) |
Tunes the state control using the integral absolute error method (IAE ) |
|
:tuneISE (,,) |
Tunes the state control using the integral square error method (ISE ) |
|
:tuneITAE (,,) |
Tunes the state control using the integral of time-weighted absolute error method (ITAE ) |
|
:tuneOverCHRLR (,,) |
Tunes the state control using the Chien-Hrones-Reswick method (CHR ) load rejection 20% overshot |
|
:tuneOverCHRSP (,,) |
Tunes the state control using the Chien-Hrones-Reswick method (CHR ) set point track 20% overshot |
|
:tuneProcCC (,,) |
Tunes the state control using the Choen-Coon method (CC ) |
|
:tuneProcCHRLR (,,) |
Tunes the state control using the Chien-Hrones-Reswick method (CHR ) load rejection |
|
:tuneProcCHRSP (,,) |
Tunes the state control using the Chien-Hrones-Reswick method (CHR ) set point track |
|
:tuneProcZN (,,) |
Tunes the state control using the Ziegler-Nichols plant process method (ZN ) |
Icon | Internal | External | Description |
---|---|---|---|
a |
angle |
Angle class |
|
b |
bone |
Bone class |
|
c |
complex |
Complex number |
|
e |
entity |
Entity class |
|
xm2 |
matrix2 |
Matrix 2x2 |
|
m |
matrix |
Matrix 3x3 |
|
xm4 |
matrix4 |
Matrix 4x4 |
|
n |
number |
Number |
|
q |
quaternion |
Quaternion |
|
r |
array |
Array |
|
s |
string |
String class |
|
t |
table |
Table |
|
xv2 |
vector2 |
Vector 2D class |
|
v |
vector |
Vector 3D class |
|
xv4 |
vector4 |
Vactor 4D class |
|
xrd |
ranger |
Ranger data class |
|
xwl |
wirelink |
Wire link class |
|
xft |
ftrace |
Flash tracer class |
|
xsc |
stcontrol |
State controller class |
|
xxx |
void |
Void data type |