beautypg.com

Echelon i.LON SmartServer 2.0 User Manual

Page 384

background image

i.LON SmartServer 2.0 Programmer’s Reference

21-32


Dim

SmartServer

As

iLON_SoapCalls =

New

iLON_SoapCalls

SmartServer.BindClientToSmartServer()

Try


' -------------- CREATING A DATA LOGGER --------------

'Create an xSelect object and then specify the filter to be used

Dim

xSelect

As

New

iLON_SmartServer.E_xSelect()

xSelect.xSelect =

"//Item[@xsi:type=""LON_Fb_Cfg""][contains(UCPTname,""Data Logger"")][UCPThidden = ""1""]"

'Create an ItemColl that stores objects returned by List()function that takes an xSelect object

Dim

ItemColl

As

iLON_SmartServer.Item_Coll = SmartServer._iLON.List(xSelect)


'Create an ItemCfgColl that stores the objects to be returned by a Get() function that takes

'the ItemColl returned by the List()

ItemColl.xSelect =

"//Item[@xsi:type=""LON_Fb_Cfg""]"

Dim

ItemCfgColl__1

As

iLON_SmartServer.Item_CfgColl = SmartServer._iLON.Get(ItemColl)


'check that there are obejcts in the ItemCfgColl

If

ItemCfgColl__1.UCPTfaultCount > 0

Then

PrintGetError(ItemCfgColl__1)

Else

'Create LON_Fb_Cfg item

ItemCfgColl__1.Item(0).UCPThidden = 0
ItemCfgColl__1.Item(0).UCPTname =

"Net/LON/iLON App/myDataLogger"

Dim

ItemColl_SetReturn

As

iLON_SmartServer.Item_Coll =

SmartServer._iLON.Set(ItemCfgColl__1)


'create new Data Logger from existing one

Dim

myDataLogger

As

iLON_SmartServer.UFPTdataLogger_Cfg =

New

iLON_SmartServer.UFPTdataLogger_Cfg()

myDataLogger.UCPTname =

"Net/LON/iLON App/myDataLogger"

myDataLogger.UCPTannotation =

"#8000010128000000[4].UFPTdataLogger"

myDataLogger.UCPTlogFileName =

"Net/LON/iLON App/myDataLogger.csv"

myDataLogger.UCPTlogSize = 100
myDataLogger.UCPTlogLevelAlarm = 50

myDataLogger.UCPTlogType =

New

iLON_SmartServer.E_LonString()

myDataLogger.UCPTlogType.Value =

"LT_HISTORICAL"

myDataLogger.UCPTlogType.LonFormat =

"UCPTlogType"

myDataLogger.UCPTlogFormat =

New

iLON_SmartServer.E_LonString()

myDataLogger.UCPTlogFormat.Value =

"LF_TEXT"

myDataLogger.UCPTlogFormat.LonFormat =

"UCPTlogFormat"

'create DP reference array to store data points by new Data Logger

myDataLogger.DataPoint =

New

iLON_SmartServer.E_DpRef(1) {}


'speficy data points to be logged by new Data Logger

Dim

dataPointRef1

As

New

iLON_SmartServer.UFPTdataLogger_DpRef()

dataPointRef1.UCPTname =

"Net/LON/iLON App/Digital Output 2/nviClaValue_2"

dataPointRef1.UCPTformatDescription =

"#0000000000000000[0].SNVT_switch"

dataPointRef1.UCPTpollRate = 60
dataPointRef1.dpType =

"Input"

Dim

dataPointRef2

As

New

iLON_SmartServer.UFPTdataLogger_DpRef()

dataPointRef2.UCPTname =

"Net/LON/iLON App/Digital Output 1/nviClaValue_1"

dataPointRef2.UCPTformatDescription =

"#0000000000000000[0].SNVT_switch"

dataPointRef2.UCPTpollRate = 60
dataPointRef2.dpType =

"Input"

'store data points in DP reference array

myDataLogger.DataPoint(0) = dataPointRef1