Skip to content

StControl

Deyan Dobromirov edited this page Feb 6, 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 zero, positive or negative 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 and so on needed for aero-propeller systems. Negative powers will be treated as error square root ( 1/E^P when p = 2 ). The user can put even fractional powers P to each term. 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 control bias
image:getControl(image) image Returns state control automated control signal signal
image:getControlTerm(image) image Returns state control automated control term signal
image:getControlTerm(image) image Returns state control automated control term signal
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:getErrorOld(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:getTimeOld(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:getWindupD(image) image Returns state control windup lower bound
image:getWindupU(image) image Returns state control windup upper 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:isIntegrating(image) image Checks 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 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:remWindupD(image) image Removes state control windup lower bound
image:remWindupU(image) image Removes state control windup upper 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:setIsIntegrating(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: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:setWindupD(image) image Updates state control windup lower bound
image:setWindupU(image) image Updates state control windup upper 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)
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)
Clone this wiki locally