Michael Thomas Flanagan's Java Scientific Library

SecondOrder Class:      Control Theory Second Order Process

     

Last update: 18 January 2011                                                                                                                               Main Page of Michael Thomas Flanagan's Java Scientific Library

This class contains the constructor to create an instance of a Second Order Process and the methods to use this in both continuous time and discrete control simulations.
This is a subclass of the superclass BlackBox

The Second Order Process may be described by the Equation 1:

where i(t) is the input to the controller, o(t) is the output and a, b , c and d are constants.
A quiescent system is assumed in performing s-transfoms. The s-domain transfer function, G(s), obtained from Equation 1 may be expressed as Equation2:

An alternative representation of G(s) is the standard form shown in Equation 3:

Methods incorporating a Laplace transform of the first or second derivative assume a quiescent state before the input at zero time.

import directive: import flanagan.control.SecondOrder;

SUMMARY OF CONSTRUCTORS AND METHODS

METHODS FOUND ONLY IN THE SUBCLASS SecondOrder

Constructors   public SecondOrder()
  public SecondOrder(double aConst, double bConst, double cConst)
Second Order Constants Set the a, b c and d constants public void setCoeff(double aConst, double bConst, double cConst, double dConst)
public void setA(double aConst)
public void setB(double bConst)
public void setC(double cConst)
public void setC(double dConst)
Get the a, b c and d constants public double getA()
public double getB()
public double getC()
public double getD()
Standard form Set the zeta, omega and k constants public void setStandardForm(double zeta, double omega, double kConst)
public void setZet(double zeta)
public void setOmegaN(double omegan)
public void setK(double kConst)
Get the zeta, omega and k constants public double getZeta()
public double getOmegaN()
public double getKconst()
Get the attenuation public double getAttenuation()

METHODS INHERITED FROM THE SUPERCLASS BlackBox

Deep Copy   public SecondOrder copy()
Overridden
public Object clone()
Overridden
s-domain transfer function Get the numerator degree public int getSnumerDeg()
Not overridden
Get the numerator polynomial public ComplexPoly getSnumer()
Not overridden
Get the denominator degree public int getSdenomDeg()
Not overridden
Get the denominator polynomial public ComplexPoly getSdenom()
Not overridden
Get the s-values of the poles publicComplex[ ] getPolesS()
Not overridden
Get the s-values of the zeros publicComplex[ ] getZerosS()
Overridden
Plot poles and zeros public void plotPolesZeroS()
Not overridden
Set the value of the Laplace s variable public void setS(Complex sValue)
Not overridden
public void setS(double sReal, double sImag)
Not overridden
public void setS(double sImag)
Not overridden
Get the Laplace s value public Complex getS()
Not overridden
Evaluate transfer function public Complex evalTransFunctS()
Not overridden
public Complex evalTransFunctS(Complex sValue)
Not overridden
public Complex evalTransFunctS(double freq)
Not overridden
Evaluate transfer function magnitude public double evalMagTransFunctS()
Not overridden
public double evalMagTransFunctS(Complex sValue)
Not overridden
public double evalMagTransFunctS(double freq)
Not overridden
Evaluate transfer function phase public double evalPhaseTransFunctS()
Not overridden
public double evalPhaseTransFunctS(Complex sValue)
Not overridden
public double evalPhaseTransFunctS(double freq)
Not overridden
Bode plots (magnitude and phase) public void plotBode(double lowFreq, double highFreq,)
Not overridden
Inverse Laplace Transform public static Complex[ ] [ ] inverseTransform(ComplexPoly numer, ComplexPoly Not overridden
public static Complex timeTerm(double time, Complex coeff, Complex constant, Complex power)
Not overridden
Set the input in the s-domain public void setInputS(Complex input)
Not overridden
Get the input in the s-domain public Complex getInputS()
Not overridden
Get the output in the s-domain public Complex getOutputS()
Overridden
public Complex getOutputS(Complex sValue, Complex input)
Overridden
Dead Time
(transportation time)
Set the dead time public void setDeadtime(double deadTime)
Not overridden
public void setDeadtime(double deadTime, double padeOrder)
Not overridden
Get the dead time public double getDeadtime()
Not overridden
Set the Pade order public void setPadeOrder(double padeorder)
Not overridden
Get the Pade order public void setPadeOrder(double padeorder)
Not overridden
Continuous time domain
(uses the s-domain transfer function)
Plot step input transient public void stepInput(double finaltime)
Overridden
public void stepInput(double mag, double finaltime)
Overridden
Plot ramp input transient public void rampInput(double finaltime)
Overridden
public void rampInput(double mag, double finaltime)
Overridden
public void rampInput(int order, double finaltime)
Overridden
public void rampInput(double mag, int order, double finaltime)
Overridden
z-domain transfer function Map s-transfer function into the z-domain public void zTransform()
Overridden
public void zTransform(double deltaT)
Overridden
Get the numerator degree public int getZnumerDeg()
Not overridden
Get the numerator polynomial public ComplexPoly getZnumer()
Not overridden
Get the denominator degree public int getZdenomDeg()
Not overridden
Get the denominator polynomial public ComplexPoly getZdenom()
Not overridden
Get the z-values of the poles publicComplex[ ] getPolesZ()
Not overridden
Get the z-values of the zeros publicComplex[ ] getZerosZ()
Not overridden
Plot poles and zeros public void plotPolesZeroZ()
Not overridden
Set the value of the z variable public void setZ(Complex zValue)
Not overridden
public void setZ(double zReal, double zImag)
Not overridden
Get the z value public Complex getZ()
Not overridden
Evaluate transfer function public Complex evalTransFunctZ()
Not overridden
public Complex evalTransFunctZ(Complex zValue)
Not overridden
Evaluate transfer function magnitude public double evalMagTransFunctZ()
Not overridden
public double evalMagTransFunctZ(Complex zValue)
Not overridden
Evaluate transfer function phase public double evalPhaseTransFunctZ()
Not overridden
public double evalPhaseTransFunctZ(Complex zValue)
Not overridden
Sampled signal Set the sampling length public void setSampleLdength(int samplelength)
Not overridden
Get the sampling length public int getSampleLength()
Not overridden
Set the sampling period public void setDeltaT(double deltaT)
Not overridden
Get the sampling period public double getDeltaT()
Not overridden
Set the sampling frequency public void setSampFreq(double sfreq)
Not overridden
Get the sampling frequency public double getSampFreq()
Not overridden
Set the sampled input and time public void setInputT(double time, double input)
Not overridden
Get the current value of the time public double getCurrentTime()
Not overridden
Get the array of times public double[] getTime()
Not overridden
Get the current value of the input public double getCurrentInputT()
Not overridden
Get the array of the inputs public double[] getInputT()
Not overridden
Calculate the current value of the output public double calcOutputT()
Not overridden
public double calcOutputT(double time, double input) Not overridden
Get the current value of the output public double getCurrentOutputT()
Not overridden
Get the array of the outputs public double getOutputT()
Not overridden
Set numerical integration method public void setIntegrateMethod(int integMethod)
Not overridden
public void setIntegrateMethod(String integMethodOpt)
Not overridden
Get numerical integration method public int getIntegrateMethod()
Not overridden
General methods Reset all inputs, outputs and times to zero public void resetZero()
Not overridden
Set the name of the black box public void setName(String name)
Not overridden
Get the name of the black box public String getName()
Not overridden



CONSTRUCTORS

public SecondOrder()
public SecondOrder(double aConst, double bConst, double cConst)
Usage:                      SecondOrder so = new SecondOrder();
This constructor creates a new instance of SecondOrder with the constants a, b, b and d in Equation 1 (above) initialised to unity.
Usage:                      SecondOrder so = new SecondOrder(aConts, bConst, cConst);
This constructor creates a new instance of SecondOrder with the constants a, b, b and d in Equation 1 (above) initialised to the doubles passed in the argument list, e.g. to aConst, bConst, cConst and dConst in the above usage. If the constant c is positive it also calculates and sets the values of the damping ratio, Standard frequency and gain constant (see Equation 3 above).



SECOND ORDER PROCESS CONSTANTS

SET THE a, b, c and d CONSTANTS
public void setCoeff(double aConst, double bConst, double cConst)
Usage:                      so.setcoeff(aConts, bConst, cConst, dConst);
Resets the constants a, b, c and d in Equation 1 (above) initialised to the doubles passed in the argument list, e.g. to aConst, bConst, cConst and dConst in the above usage. If the constant c is positive it also calculates and sets the values of the damping ratio, Standard frequency and gain constant (see Equation 3 above).

public void setA(double aConst)
Usage:                      so.setA(aConst);
Resets the constant a in Equation 1 (above) to the value in the double passed in the argument list, e.g. to aConst in the above usage. If the constant c is positive it also calculates and sets the values of the damping ratio, Standard frequency and gain constant (see Equation 3 above).

public void setB(double bConst)
Usage:                      so.setB(bConst);
Resets the constant b in Equation 1 (above) to the value in the double passed in the argument list, e.g. to bConst in the above usage. If the constant c is positive it also calculates and sets the values of the damping ratio, Standard frequency and gain constant (see Equation 3 above).

public void setC(double cConst)
Usage:                      so.setC(cConst);
Resets the constant c in Equation 1 (above) to the value in the double passed in the argument list, e.g. to cConst in the above usage. If the constant c is positive it also calculates and sets the values of the damping ratio, Standard frequency and gain constant (see Equation 3 above).

public void setD(double dConst)
Usage:                      so.setD(dConst);
Resets the constant d in Equation 1 (above) to the value in the double passed in the argument list, e.g. to dConst in the above usage. If the constant c is positive it also calculates and sets the values of the damping ratio, Standard frequency and gain constant (see Equation 3 above).



GET THE a, b, c and d CONSTANTS
public double getA()
Usage:                      aConst = so.getA();
Returns the constant a in Equation 1 (above).

public double getB()
Usage:                      bConst = so.getB();
Returns the constant b in Equation 1 (above).

public double getC()
Usage:                      cConst = so.getC();
Returns the constant c in Equation 1 (above).

public double getD()
Usage:                      dConst = so.getD();
Returns the constant d in Equation 1 (above).



SECOND ORDER STANDARD FORM

SET zeta, omega and k CONSTANTS
public void setStandardForm(double zeta, double omegaN, double kConst)
Usage:                      so.setStandardForm(zeta, omegaN, kConst);
Sets the damping ratio, Standard frequency and gain constant, in Equation 3

to the doubles passed in the argument list, e.g. zeta, omegaN, kConst in the above usage. It also calculates and sets the values of the constants a, b, c and d (see Equation 1 above).

public void setZeta(double zeta)
Usage:                      so.setZeta(zeta);
Sets the damping ratio in Equation 3 (above) to the value in the double passed in the argument list, e.g. to zeta in the above usage. It also calculates and sets the values of the constants a, b, c and d (see Equation 1 above).

public void setOmegaN(double omegaN)
Usage:                      so.setOmegaN(omegaN);
Sets the Standard frequency in Equation 3 (above) to the value in the double passed in the argument list, e.g. to omegaN in the above usage. It also calculates and sets the values of the constants a, b, c and d (see Equation 1 above).

public void setK(double kConst)
Usage:                      so.setK(kConst);
Sets the gain constant in Equation 3 (above) to the value in the double passed in the argument list, e.g. to kConst in the above usage. It also calculates and sets the values of the constants a, b, c and d (see Equation 1 above).



GET THE zeta, omega and k CONSTANTS
public double getZeta()
Usage:                      zeta = so.getZeta();
Returns the damping ratio in Equation 3


public double getOmegaN()
Usage:                      omegaN = so.getOmegaN();
Returns the damping ratio in Equation 3.

public double getKconst()
Usage:                      kConst = so.kConst();
Returns the gain constant in Equation 3.





GET THE ATTENUATION
public double getAttenuation()
Usage:                      zeta = so.getAttenuation();
Returns the attenuation, , i.e. the product of the Standard frequency and the damping ratio in Equation 3




CALCULATE THE OUTPUT IN THE SAMPLED TIME DOMAIN
public double calcOutputT()
public double calcOutputT(double time, double input)
Usage:                      output = so.getOutputT();
Calculates and stores the output for the current stored sampled input and time.

Usage:                      output = so.getOutputT(time, input);
Returns the output for a given sampled input and time.



OTHER CLASSES USED BY THIS CLASS

This class is a subclass of BlackBox which uses the following classes in this library:
SecondOrder also calls directly:

This page was prepared by Dr Michael Thomas Flanagan