Michael Thomas Flanagan's Java Scientific Library

Transducer Class:      Control Theory Transducer

     

Last update: 27 April 2012                                                                                                                              Main Page of Michael Thomas Flanagan's Java Scientific Library

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

The Transducer is treated as a first order process characterized by a gain and a time constant (response time).
Methods incorporating a Laplace transform of the first derivative assume a quiescent state before the input at zero time.

import directive: import flanagan.control.Transducer;

SUMMARY OF CONSTRUCTORS AND METHODS

METHODS FOUND ONLY IN THE SUBCLASS Transducer

Constructors   public Transducer()
  public Transducer(double gain)
  public Transducer(double gain, double timeConstant)
First Order Constants Set the gain and time constant public void setCoeff(double gain, double timeConstant)
public void setGain(double gain)
public void setTimeConstant(double timeConstant)
Get the gain and time constant public double getGain()
public double getTimeConstant()

METHODS INHERITED FROM THE SUPERCLASS BlackBox

Some of these methods may be overridden.

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



CONSTRUCTORS

public Transducer()
public Transducer(double gain)
public Transducer(double gain, double timeConstant)
Usage:                      Transducer trans = new Transducer();
This constructor creates a new instance of Transducer with the gain initialized to unity and the time constant initialized to zero.

Usage:                      Transducer trans = new Transducer(gain);
This constructor creates a new instance of Transducer with the gain initialized to value of the argument gain and the time constant initialized to zero.

Usage:                      Transducer trans = new Transducer(gain, timeConstant);
This constructor creates a new instance of Transducer with the gain initialized to the value of the argument gain and the time constant initialized to the value of the argument timeConstant.




TRANSDUCER CONSTANTS

SET THE CONSTANTS
public void setCoeff(double gain, double timeConstant)
Usage:                      trans.setCoeff(gain, timeConstant);
Resets the gain to gain and the time constant to timeConstant.

public void setGain(double gain)
Usage:                      trans.setA(aConst);
Resets the gain to gain.

public void setTimeConstant(double timeConstant)
Usage:                      trans.setTimeConstant(timeConstant);
Resets the time constant to timeConstant.





GET THE CONSTANTS
public double getA()
Usage:                      gain = trans.getGain();
Returns the value of the gain.

public double getTimeConstant()
Usage:                      timeConst = trans.getTimeConstant();
Returns the value of the time constant.





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

Usage:                      output = trans.getOutputT(time, input);
Returns the output for a given sampled input and time. The sampling period, deltaT, is calculated using the previous sampling time. This method overrides the BlackBox method getOutputT().



OTHER CLASSES USED BY THIS CLASS

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

This page was prepared by Dr Michael Thomas Flanagan