beautypg.com

1 creating a data logger – Echelon i.LON SmartServer 2.0 User Manual

Page 383

background image

i.LON SmartServer 2.0 Programmer’s Reference

21-31

Next

Dim

ItemWriteDpValues

As

ILON_SmartServer.Item_Coll = SmartServer._iLON.Write(ItemDataColl)

'check that there are obejcts in the ItemWriteDpValues

If

(ItemWriteDpValues.UCPTfaultCount > 0)

Then

Console.Out.WriteLine(

"you've got errors"

)


Else

Console.Out.WriteLine(vbNewLine +

"Reading Updated Data Point Values"

+ vbNewLine)

For

j

As

Integer

= 0

To

ItemWriteDpValues.Item.Length - 1


' we allocate a Item-Data array object to read DP values, which should all be 100.0 1

Dim

dpItems

As

iLON_SmartServer.Dp_Data = ItemWriteDpValues.Item(j)

Console.Out.WriteLine(dpItems.UCPTname +

" = "

+ dpItems.UCPTvalue(0).Value)


Next

End

If

End

If

Console.ReadLine()

Finally

SmartServer.CloseBindingToSmartServer()

End Try

End

Sub

End

Module

21.2.2

Creating and Reading a Data Logger in Visual Basic. NET

The following VB console example creates a data logger and then reads the data recorded by it. You
can execute this code after you have referenced and inherited from the SmartServer WSDL as
described in section 20.1, and instantiated and initialized the Web service client as described in section
20.2.

21.2.2.1 Creating a Data Logger

This VB console example creates a new data logger from an existing uninstantiated (hidden) data
logger on the SmartServer, specifies the type, format, and size of the new data logger, and then
specifies that the data logger record both of the SmartServer’s digital relay outputs every minute (the
Net/LON/iLON App/Digital Output 1/nviClaValue_1 and Net/LON/iLON App/Digital Output
2/nviClaValue_2 data points).

For more information on the data logger properties set in this example, see section 5.3.2, Using the
Get Function on a Data Logger
.

Module

DataLogModule


Private

Sub

PrintGetError(

ByVal

ItemCfgColl

As

iLON_SmartServer.Item_CfgColl)

' print out error and exit

Console.Out.WriteLine(

"An error occurred:"

)

For

j

As

Integer

= 0

To

ItemCfgColl.Item.Length - 1

If

ItemCfgColl.Item(j).fault

IsNot

Nothing

Then

Console.Out.WriteLine(((

"Item: "

& ItemCfgColl.Item(j).UCPTname &

", fault code: "

) +

ItemCfgColl.Item(j).fault.faultcode.Value

&

", fault string: "

) +

ItemCfgColl.Item(j).fault.faultstring)

End

If

Next

End

Sub

Public

Sub

Main()