Hello,
we tried to adapt the example 'Creating a Data Logger' from the 'SmartServer 2.0 Programmer's Reference', in order to create an 'Analog Function Block'. But something is going wrong with the output data point.
After creating the 'Analog Fn Block', we can find it in the 'iLON App' tree on the SmartServer's web page. The output data point is there too. But its 'Icon' is set to 'Dp_In_Out' instead of 'Out', and the 'General' view is available, but not the 'Driver' view. So whether the 'General' or 'Driver' is selected, we always see the 'Data Point Property', but never the 'Lon Data Point Property'. (If we add the data point manually on the web page, it works fine.)
Here's the listing in VB.NET:
Dim xSelect As New SmartServer.E_xSelect()
xSelect.xSelect =
"//Item[@xsi:type=""LON_Fb_Cfg""][contains(UCPTname,""Analog Fn Block"")][UCPThidden = ""1""]"Dim ItemColl As SmartServer.Item_Coll = SmartServer._iLON.List(xSelect)
ItemColl.xSelect =
"//Item[@xsi:type=""LON_Fb_Cfg""]"Dim ItemCfgColl__1 As SmartServer.Item_CfgColl = SmartServer._iLON.Get(ItemColl)
'Create LON_Fb_Cfg item
ItemCfgColl__1.Item(0).UCPThidden = 0
ItemCfgColl__1.Item(0).UCPTname =
"Net/LON/iLON App/Analog Fn Block[0]_OR"Dim ItemColl_SetReturn As SmartServer.Item_Coll = SmartServer._iLON.Set(ItemCfgColl__1)
'create new Data Logger from existing oneDim myAnalogFB As SmartServer.UFPTanalogFunctionBlock_Cfg = New SmartServer.UFPTanalogFunctionBlock_Cfg()
myAnalogFB.UCPTname =
"Net/LON/iLON App/Analog Fn Block[0]_OR"
myAnalogFB.UCPTannotation =
"#8000010128000000[4].UFPTanalogFunctionBlock"
myAnalogFB.UCPTuri =
"8000010128000000[4].UFPTanalogFunctionBlock_Cfg.htm"myAnalogFB.UCPTcompFunction = New SmartServer.E_LonString()
myAnalogFB.UCPTcompFunction.Value =
"FN_GE"
myAnalogFB.UCPTcompFunction.LonFormat =
"UCPTcompFunction"myAnalogFB.UCPTtrueThreshold = New SmartServer.E_LonString()
myAnalogFB.UCPTtrueThreshold.Value =
"1"
myAnalogFB.UCPTtrueThreshold.LonFormat =
"UNVT_float"myAnalogFB.UCPToutputFunction = New SmartServer.E_LonString()
myAnalogFB.UCPToutputFunction.Value =
"FN_OR"
myAnalogFB.UCPToutputFunction.LonFormat =
"UCPToutputFunction"myAnalogFB.SCPTminRnge = New SmartServer.E_LonString()
myAnalogFB.SCPTminRnge.Value =
"0"
myAnalogFB.SCPTminRnge.LonFormat =
"UNVT_float"myAnalogFB.SCPTmaxRnge = New SmartServer.E_LonString()
myAnalogFB.SCPTmaxRnge.Value =
"0"
myAnalogFB.SCPTmaxRnge.LonFormat =
"UNVT_float"myAnalogFB.SCPTovrBehave = New SmartServer.E_LonString()
myAnalogFB.SCPTovrBehave.Value =
"OV_RETAIN"
myAnalogFB.SCPTovrBehave.LonFormat =
"SCPTovrBehave"
myAnalogFB.UCPTpollOnResetDelay = 0
myAnalogFB.UCPTcalculationInterval = 0
myAnalogFB.UCPTmajorityValue = 100
'create DP reference array containing input and output DPs of new Analog FBmyAnalogFB.DataPoint = New SmartServer.E_DpRef(2) {}
'specify Output DPDim dataPointRef1 As New SmartServer.UFPTanalogFunctionBlock_DpRef()
dataPointRef1.UCPTname =
"Net/LON/iLON App/Analog Fn Block[0]_OR/Output"
dataPointRef1.dpType =
"Output"
dataPointRef1.UCPTpollRate = 0
dataPointRef1.UCPTpollRateSpecified =
True
dataPointRef1.discrim = SMARTConfigurator.SmartServer.DpRef_eDiscriminator.dir_out
dataPointRef1.discrimSpecified =
True
'specify Input 1Dim dataPointRef2 As New SmartServer.UFPTanalogFunctionBlock_DpRef()
dataPointRef2.UCPTname =
"Net/LON/iLON App/Digital Output 2/nviClaValue_2"
dataPointRef2.UCPTpollRate = 0
dataPointRef2.UCPTpollRateSpecified =
True
dataPointRef2.dpType =
"Input"
dataPointRef2.discrim = SMARTConfigurator.SmartServer.DpRef_eDiscriminator.dir_in
dataPointRef2.discrimSpecified =
True
'specify Input 2Dim dataPointRef3 As New SmartServer.UFPTanalogFunctionBlock_DpRef()
dataPointRef3.UCPTname =
"Net/LON/iLON App/Digital Output 1/nviClaValue_1"
dataPointRef3.UCPTpollRate = 0
dataPointRef3.UCPTpollRateSpecified =
True
dataPointRef3.dpType =
"Input"
dataPointRef3.discrim = SMARTConfigurator.SmartServer.DpRef_eDiscriminator.dir_in
dataPointRef3.discrimSpecified =
True
myAnalogFB.DataPoint(0) = dataPointRef1
myAnalogFB.DataPoint(1) = dataPointRef2
myAnalogFB.DataPoint(2) = dataPointRef3
'call Set functionDim itemCfgColl__2 As New SmartServer.Item_CfgColl()itemCfgColl__2.Item = New SmartServer.Item_Cfg(0) {}
itemCfgColl__2.Item(0) = myAnalogFB
Dim ItemColl_Set_DataLogger_Return As SmartServer.Item_Coll = SmartServer._iLON.Set(itemCfgColl__2)
Can somebody tell us what we may be doing wrong? (Our SmartServer Software Version: 4.02.054)
Thanks and best regards,
Daniel