VariableAndUnits

VariableAndUnits

Class Functions

New

MyVariable = VARIABLEANDUNITS.New (Tag, Value, UnitsDesc, Index, SIUnitDesc, UnitsMultiplier, Prompt)

Tag STRING

Unique Identifier

Value REAL

Initial value

UnitsDesc VECTOR of STRING

VECTOR containing the descriptive names of each unit

Index INDEX

Initial selection of the unit

SIUnitDesc STRING STRING containing the SI unit for this variable
UnitsMultiplier VECTOR of REAL

VECTOR containing the multiplier to calculate SI units from the non-SI units

Prompt STRING Used by setup to prompt operator input

Example Inputs

Tag = “EXPTDURATION”

Value = 10.0

UnitsDesc = VectorNew(4)

UnitsDesc[0] = “seconds”

UnitsDesc[1] = “minutes”

UnitsDesc[2] = “hours”

UnitsDesc[3] = “days”

Index = 1

SIUnitDesc = “s”

UnitsMultiplier = VectorNew(4)

UnitsMultplier[0] = 1.0

UnitsMultplier[0] = 60.0

UnitsMultplier[0] = 3600.0

UnitsMultplier[0] = 86400.0

Prompt = “Experiment Duration”

Instance Functions

Printl

VariableAndUnits.Printl (Tag)

Tag STRING

Optional. Used to print a different tag than the one used in the call to .New

The output for the Printl will look like

Tag<tab>VARIABLEANDUNITS<tab>Value<tab>Count<tab>UnitsDesc1<tab>..UnitsDesc[Count- 1]<tab>Index<tab>SIUnitsDesc<tab>UnitsMultiplier1<tab>..UnitsMultiplier[Count -1]<tab>Prompt

Using Example Inputs the output would look like:

EXPTDURATION<tab>10.0<tab>4<tab>seconds<tab>minutes<tab>hours<tab>days<tab>1<tab>s<tab>1.0<tab>60.0<tab>3600.0<tab>86400.0<tab>Experiment Duration

Value

Value = VariableAndUnits.Value()

Value REAL

The current non-SI value of the VariableAndUnits object

Using Example Inputs the Value would equal 10.0

SIValue

SIValue = VariableAndUnits.SIValue()

SIValue REAL

The current SI value of the VariableAndUnits object

Using Example Inputs the SIValue would equal 600.0

SetValue

VariableAndUnits.SetValue(Value)

Value REAL

New non-SI value of the VariableAndUnits object

SetIndex

VariableAndUnits.SetIndex(Index)

Index INDEX

New Index of the VariableAndUnits object

Index

Index= VariableAndUnits.Index()

Index INDEX

The current Index of the VariableAndUnits object

Using Example Inputs the Index would equal 1.

Units

Units= VariableAndUnits.Units()

Units VECTOR

A Vector of STRING containing the different units specified during the call to .New

Using Example Inputs the Units would be a vector of 4 containing:

Units[0] = “seconds”

Units[1] = “minutes”

Units[2] = “hours”

Units[3] = “days”

Multipliers

Multipliers = VariableAndUnits.Multipliers()

Multipliers VECTOR

A Vector of REAL containing the different unit multipliers that are used to make the SI units

Using Example Inputs the Multipliers would be a vector of 4 containing:

Multipliers[0] = 1.0

Multipliers [1] = 60.0

Multipliers [2] = 3600.0

Multipliers [3] = 86400.0

SIUnits

SIUnits= VariableAndUnits.SIUnits()

SIUnits STRING

A string containing the SI Units of the object

Using Example Inputs the SIUnits would equal “s”.