Skip to content

StControl

Deyan Dobromirov edited this page Feb 19, 2020 · 45 revisions

What does this extension include?

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.

What is this thing designed for?

The StControl class consists of fast performing controller object-oriented instance that is designed to be @persistand 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.

What console variables can be used to setup it

wire_expression2_stcontrol_enst > Contains flag that enables status output messages
wire_expression2_stcontrol_dprn > Stores the default status output messages streaming destination

How to create an instance then?

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(...).

Do you have an example by any chance?

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.

Can you show me the methods of the class?

The description of the API is provided in the table below.

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