Point.RawValue (property, read/write)

Syntax

Point.RawValue[(index)]

Description

Same as Point.Value except bypasses Engineering Units conversion if configured for the point. Will return into any type subject to some restrictions. All numeric types may be returned into any other numeric type and into string types. String and BitString types can only be returned into string types. If the variable being returned into does not have a type, the variable will be changed to the appropriate type, based on the point type.

Comments

The option base determines if the first element of an array point will be zero or one. If you do not explicitly set the option base, all arrays in Basic start at 0. If you set it to 1, all arrays in Basic start at 1. See the example below.

Important: .RawValue does not return the underlying numerical value for an enumerated point.

If you want to obtain the underlying numerical value,

  1. Define a point with the .ID field set to <point_id>.$RAW_VALUE.

  2. Reference the .value field of this point.

 

Parameter

Description

 

index

Integer. (optional) The array element to access. Range depends on the option base setting.

Example 1

' Increment the points raw value by one.

sub main()

   Dim MyPoint as new Point         ' Declare the point object

   MyPoint.Id = "TANK_LEVEL"        ' Set the Id

   MyPoint.Get                      ' Read the point

   x = MyPoint.RawValue             ' Return the raw value

   MyPoint.RawValue = x + 1         ' Set the raw value

   MyPoint.Set                      ' Write the value.

End sub

' Find the maximum raw value in the array.

Option base 1                 ' Arrays start at one.

Sub main()

   Dim MyPoint as new Point     ' Declare point object

   MyPoint.Id ="ARRAY_POINT"   ' Set the Point Id

   MyPoint.Get                  ' Get the value of the point

   max = MyPoint.RawValue(1)     ' Get first value (option base = 1)

   for I = 2 to MyPoint.Elements ' Loop through all elements

      if MyPoint.RawValue(I) > max then max = MyPoint.RawValue(I)

   next I

end sub

' Set all elements of the array to 10

option base 0                 ' Arrays start at 0 (default)

sub main()

   Dim MyPoint as new Point    ' Declare the object

   MyPoint.Id ="ARRAY_POINT"  ' Set the Id

   ' Loop through all elements.   Since arrays are set to start

   ' at 0, the index of the last element is one less than the

   ' count of the elements.

   for I = 0 to MyPoint.Elements - 1

      MyPoint.RawValue(I) = 10   ' Set the raw value

   next I

   ' Values are not written to CIMPLICITY until this

   ' set is executed.

   MyPoint.Set                  ' Write the point

end sub

Example 2

'Access both the enumerated text and the underlying numerical 'value for a point.

Sub Main()

    Dim p1 As New point

    Dim p2 As New point

    'get the enumerated value

    p1.id ="ENUMERATEDPOINT"

    p1.get

    trace "enumerated text for " & p1.id & " is " & p1.value

    'get the underlying numerical value

    p2.id ="ENUMERATEDPOINT.$RAW_VALUE"

    p2.get

    'yes, we really mean p1.id, with p2.value!!!

    trace "underlying numeric value for " & p1.id & " Is " & p2.value

End Sub

Note

Point.Value (property, read/write)

More information

CIMPLICITY Extensions to Basic