Michael Thomas Flanagan's Java Scientific Library

DtoA Class:      Modelling a Digital to Analogue Converter (DAC) for Control Theory Simulations

     

Last update: 8 November 2009                                                                                                                              Main Page of Michael Thomas Flanagan's Java Scientific Library

This class contains the constructor to create an instance of a Digital to Analogue Converter and the methods to use this in control simulations.
An instance may be created that:
i.   simulates a digital to analogue converter (DAC) of a given bit length and reference voltage. Three input types area allowed: or

ii.   simply acts as a marker of a digital to analogue conversion in which the output equals the input voltage with no checks on the value. This can be useful in some control loop simulations.

This class is a subclass of the superclass BlackBox thus allowing easy use with classes such as OpenPath and ClosedLoop. Though many of the Blackbox methods are of limited relevance they will function. The s-domain transfer function will appear as the output voltage divided by the voltage equivalent of the input modified by any dead-time that may have been set.

import directive: import flanagan.control.DtoA;

SUMMARY OF CONSTRUCTORS AND METHODS

Constructors   public DtoA(int nBits, double vRef)
  public DtoA()
Set Input
  public void setInput(String input)
public void setInput(int[ ] input)
public void setInput(long input)
public void setInput(double input)
Get input values
Binary input public String getBinaryInput()
public int[ ] getBinaryArray()
Decimal input public long getDecimalInput()
Output
Get voltage output public double getOutput()
Return reference voltage
as voltage public double getVref()
as decimal (binary) public long getMaximumDecimal()
Settings
True DAC option public boolean getTrueDtoAoption()
Dead Time
(transportation time)
[inherited from BlackBox]
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)
See BlackBox for the remaining inherited methods



CONSTRUCTORS

public DtoA(int nBits, double vRef)
public DtoA()
Usage:                      DtoA dac = new DtoA(nBits, vRef);
This constructor creates a new instance of DtoA that simulates an n bit digital to analogue converter (DAC) of reference voltage, vRef. The number of bits, n, is passed to the constructor as the int variable, nBits.

public DtoA()
Usage:                      DtoA dac = new DtoA();
This constructor simply acts as a marker to be used in OpenPath and ClosedLoop to indicate the presence of an DAC. In this case there is no simulation of an DAC and the output is equal to the input plus any delay set.



SET THE INPUT

public void setInput(String input)
public void setInput(int[ ] input)
public void setInput(long input)
public void setInput(double input)
Usage:                      dac.setInput(input);
The method by which the input is entered.
The input may be represenred as:

GET THE INPUT VALUES

BINARY INPUT
public String getBinaryInput()
public int[ ] getBinaryArray()
Usage:                      binaryIn = dac.getBinaryInput();
Returns a String containing a binary representation of the input of the simulated DAC in a two's complement with a one bit sign extension format.

Usage:                      binaryArray = dac.getBinaryArray();
Returns an int array containing a binary representation of the intput of the simulated DAC in a two's complement with a one bit sign extension format. The least significant bit (LSB) is the zeroth array element.

DECIMAL INPUT
public long getDecimalInput()
Usage:                      decimalIn = dac.getDecimalInput();
Returns a decimal representation of the binary input of the simulated DAC.



OUTPUT

public double getOutput()
Usage:                      output = dac.getOutput();
Returns the output voltage, as a double, in volts



REFERENCE VOLTAGE

RETURN VALUE AS A VOLTAGE
public double getVref()
Usage:                      vRef = dac.getVref();
Returns the reference voltage as a voltage.

RETURN VALUE AS A BINARY (DECIMAL REPRESENTATION)
public double getMaximumDecimal()
Usage:                      vDec = dac.getMaximumDecimal();
Returns the reference voltage as the decimal representation of the maximum binary number that the DAC can output.



SETTINGS

TRUE DAC OPTION
public boolean getTrueDtoAoption()
Usage:                      option = dac.getTrueDtoAoption();


OTHER CLASSES USED BY THIS CLASS

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


This page was prepared by Dr Michael Thomas Flanagan