Reading the formatspec object – Echelon LNS User Manual

Page 256

Advertising
background image

LNS Programmer's Guide

242

resource file. See Chapter 6 for more detailed information on program IDs and scope

selectors.

The

FormatSpec

object contains a

Scope

property, a

ProgramId

property, an

Index

property, a

FormatName

property, and a

FormatType

property. To use these properties

to change the base type of a monitor point or data point, follow these steps:

1. Access

the

FormatSpec

object for the monitor point or data point whose

base type you want to change.

Dim MyFormatSpec as LcaFormatSpec
Set MyFormatSpec = MyNvMonitorPoint.FormatSpec

2. Set

the

Scope

and

ProgramId

properties to reference the device resource

files containing the definition of the base type you want to use.

MyFormatSpec.Scope =

lcaResourceScopeMfg

MyFormatSpec.ProgramId = “8000010000000000”

3. Set

the

Index

property if you want to identify the new type by its index

value within the resource file. Or, set the

FormatType

and

FormatName

properties if you want to identify the type by its name. Note that the

FormatType

property must be set to

lcaFormatTypeNamed

if you want

to identify the type by its name.

MyFormatSpec.FormatType = lcaFormatTypeNamed
MyFormatSpec.FormatName = “UNVT_color”

NOTE: If you pass an invalid type name to the FormatName property,

and then pass the FormatSpec object back to a data point or monitor
point, no exception will be thrown, although the FormatSpec object will

not reference a valid type. The LNS Object Server will use the previous
setting of the FormatName property to determine the data point or

monitor point’s type. You should note that if you read the FormatSpec

object in this situation, the FormatName property will still return the

invalid type name.

4. The

FormatSpec object is not passed by reference. So, you must pass the

modified

FormatSpec

object back to the data point or monitor point for

the changes made in steps 2 and 3 to take effect.

Set MyNvMonitorPoint.FormatSpec = MyFormatSpec

Reading the FormatSpec Object

The

FormatSpec

object contains several properties you can use to determine how the

data stored in your data points or monitor points will be displayed. For example, you can
use the UnitsAdder and UnitsMultiplier properties to determine how the scaled

value of the data point or monitor point will be unit-converted for display as a formatted
value when your application reads the FormattedValue property. These factors can also

be used to determine how the formatted value units differ from the base units associated

with the data point type.

Table 9.5 introduces the other properties of the

FormatSpec

object. These properties are

read-only, and are set based on the type the FormatSpec object represents. See the LNS

Object Server Online Reference for more detailed information on these properties.

Advertising