Commit 2e608a66 authored by Gino Tosti's avatar Gino Tosti
Browse files

updated two templates to avoid nan and to manage proprerties of string baci

parent b846aa1b
...@@ -253,7 +253,6 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse ...@@ -253,7 +253,6 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
#if ($x.GetSheet["OPC UA Data type"][$idx]).upper()[-1]==']' ## test for arrays #if ($x.GetSheet["OPC UA Data type"][$idx]).upper()[-1]==']' ## test for arrays
#set $type=($x.GetSheet["OPC UA Data type"][$idx].upper()).split("[")[0]+"[]" #set $type=($x.GetSheet["OPC UA Data type"][$idx].upper()).split("[")[0]+"[]"
try { try {
$x.GetSheet["Short name"][$idx] = baciH.createRO${y[$type][0]}Prop("$x.GetSheet["Short name"][$idx]","$x.GetSheet["OPC_UA node"][$idx]"); $x.GetSheet["Short name"][$idx] = baciH.createRO${y[$type][0]}Prop("$x.GetSheet["Short name"][$idx]","$x.GetSheet["OPC_UA node"][$idx]");
} catch (IllegalArgumentException|PropertyInitializationFailed e){ } catch (IllegalArgumentException|PropertyInitializationFailed e){
m_logger.log(Level.SEVERE, "Exception in creating Property:"+"$x.GetSheet["Short name"][$idx]"+":"+e.getMessage()); m_logger.log(Level.SEVERE, "Exception in creating Property:"+"$x.GetSheet["Short name"][$idx]"+":"+e.getMessage());
...@@ -262,7 +261,6 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse ...@@ -262,7 +261,6 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
#set $type=$x.GetSheet["OPC UA Data type"][$idx].upper() #set $type=$x.GetSheet["OPC UA Data type"][$idx].upper()
try { try {
$x.GetSheet["Short name"][$idx] = baciH.createRO${y[$type][0]}Prop("$x.GetSheet["Short name"][$idx]","$x.GetSheet["OPC_UA node"][$idx]"); $x.GetSheet["Short name"][$idx] = baciH.createRO${y[$type][0]}Prop("$x.GetSheet["Short name"][$idx]","$x.GetSheet["OPC_UA node"][$idx]");
#if str($x.GetSheet["Alarm high"][$idx]) !="nan" and str($x.GetSheet["Alarm high"][$idx]).strip() !="NA" and str($x.GetSheet["Alarm high"][$idx]).strip() !="" and $y[$type][1] != "S" #if str($x.GetSheet["Alarm high"][$idx]) !="nan" and str($x.GetSheet["Alarm high"][$idx]).strip() !="NA" and str($x.GetSheet["Alarm high"][$idx]).strip() !="" and $y[$type][1] != "S"
#if str($x.GetSheet["Alarm high"][$idx]) !="nan" and str($x.GetSheet["Alarm high"][$idx]).strip() !="NA" and str($x.GetSheet["Alarm high"][$idx]).strip() !="" and $y[$type][1] != "S" #if str($x.GetSheet["Alarm high"][$idx]) !="nan" and str($x.GetSheet["Alarm high"][$idx]).strip() !="NA" and str($x.GetSheet["Alarm high"][$idx]).strip() !="" and $y[$type][1] != "S"
baciH.addValueListener("$x.GetSheet["Short name"][$idx]",$x.GetSheet["Sampling Interval (s)"][$idx],$x.GetSheet["Sampling Interval (s)"][$idx]); baciH.addValueListener("$x.GetSheet["Short name"][$idx]",$x.GetSheet["Sampling Interval (s)"][$idx],$x.GetSheet["Sampling Interval (s)"][$idx]);
...@@ -276,7 +274,7 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse ...@@ -276,7 +274,7 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
try { try {
$x.GetSheet["Short name"][$idx] = baciH.createRO${y[$type][0]}Prop("$x.GetSheet["Short name"][$idx]","$x.GetSheet["OPC_UA node"][$idx]"); $x.GetSheet["Short name"][$idx] = baciH.createRO${y[$type][0]}Prop("$x.GetSheet["Short name"][$idx]","$x.GetSheet["OPC_UA node"][$idx]");
#if str($x.GetSheet["Alarm high"][$idx]) !="nan" and str($x.GetSheet["Alarm high"][$idx]).strip() !="NA" and str($x.GetSheet["Alarm high"][$idx]).strip() !="" and $y[$type][1] != "S" #if str($x.GetSheet["Alarm high"][$idx]) !="nan" and str($x.GetSheet["Alarm high"][$idx]).strip() !="NA" and str($x.GetSheet["Alarm high"][$idx]).strip() !="" and $y[$type][1] != "S"
#if str($x.GetSheet["Alarm high"][$idx]) !="nan" and str($x.GetSheet["Alarm high"][$idx]).strip() !="NA" and str($x.GetSheet["Alarm high"][$idx]).strip() !="" and $y[$type][1] != "S" #if str($x.GetSheet["Alarm low"][$idx]) !="nan" and str($x.GetSheet["Alarm low"][$idx]).strip() !="NA" and str($x.GetSheet["Alarm low"][$idx]).strip() !="" and $y[$type][1] != "S"
baciH.addValueListener("$x.GetSheet["Short name"][$idx]",$x.GetSheet["Sampling Interval (s)"][$idx],$x.GetSheet["Sampling Interval (s)"][$idx]); baciH.addValueListener("$x.GetSheet["Short name"][$idx]",$x.GetSheet["Sampling Interval (s)"][$idx],$x.GetSheet["Sampling Interval (s)"][$idx]);
#end if #end if
#end if #end if
...@@ -288,7 +286,7 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse ...@@ -288,7 +286,7 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
try { try {
$x.GetSheet["Short name"][$idx] = baciH.createRO${y[$type][0]}Prop("$x.GetSheet["Short name"][$idx]","$x.GetSheet["OPC_UA node"][$idx]"); $x.GetSheet["Short name"][$idx] = baciH.createRO${y[$type][0]}Prop("$x.GetSheet["Short name"][$idx]","$x.GetSheet["OPC_UA node"][$idx]");
#if str($x.GetSheet["Alarm high"][$idx]) !="nan" and str($x.GetSheet["Alarm high"][$idx]).strip() !="NA" and str($x.GetSheet["Alarm high"][$idx]).strip() !="" and $y[$type][1] != "S" #if str($x.GetSheet["Alarm high"][$idx]) !="nan" and str($x.GetSheet["Alarm high"][$idx]).strip() !="NA" and str($x.GetSheet["Alarm high"][$idx]).strip() !="" and $y[$type][1] != "S"
#if str($x.GetSheet["Alarm high"][$idx]) !="nan" and str($x.GetSheet["Alarm high"][$idx]).strip() !="NA" and str($x.GetSheet["Alarm high"][$idx]).strip() !="" and $y[$type][1] != "S" #if str($x.GetSheet["Alarm low"][$idx]) !="nan" and str($x.GetSheet["Alarm low"][$idx]).strip() !="NA" and str($x.GetSheet["Alarm low"][$idx]).strip() !="" and $y[$type][1] != "S"
baciH.addValueListener("$x.GetSheet["Short name"][$idx]",$x.GetSheet["Sampling Interval (s)"][$idx],$x.GetSheet["Sampling Interval (s)"][$idx]); baciH.addValueListener("$x.GetSheet["Short name"][$idx]",$x.GetSheet["Sampling Interval (s)"][$idx],$x.GetSheet["Sampling Interval (s)"][$idx]);
#end if #end if
#end if #end if
...@@ -300,7 +298,7 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse ...@@ -300,7 +298,7 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
try { try {
$x.GetSheet["Short name"][$idx] = baciH.createRO${y[$type][0]}Prop("$x.GetSheet["Short name"][$idx]","$x.GetSheet["OPC_UA node"][$idx]"); $x.GetSheet["Short name"][$idx] = baciH.createRO${y[$type][0]}Prop("$x.GetSheet["Short name"][$idx]","$x.GetSheet["OPC_UA node"][$idx]");
#if str($x.GetSheet["Alarm high"][$idx]) !="nan" and str($x.GetSheet["Alarm high"][$idx]).strip() !="NA" and str($x.GetSheet["Alarm high"][$idx]).strip() !="" and $y[$type][1] != "S" #if str($x.GetSheet["Alarm high"][$idx]) !="nan" and str($x.GetSheet["Alarm high"][$idx]).strip() !="NA" and str($x.GetSheet["Alarm high"][$idx]).strip() !="" and $y[$type][1] != "S"
#if str($x.GetSheet["Alarm high"][$idx]) !="nan" and str($x.GetSheet["Alarm high"][$idx]).strip() !="NA" and str($x.GetSheet["Alarm high"][$idx]).strip() !="" and $y[$type][1] != "S" #if str($x.GetSheet["Alarm low"][$idx]) !="nan" and str($x.GetSheet["Alarm low"][$idx]).strip() !="NA" and str($x.GetSheet["Alarm low"][$idx]).strip() !="" and $y[$type][1] != "S"
baciH.addValueListener("$x.GetSheet["Short name"][$idx]",$x.GetSheet["Sampling Interval (s)"][$idx],$x.GetSheet["Sampling Interval (s)"][$idx]); baciH.addValueListener("$x.GetSheet["Short name"][$idx]",$x.GetSheet["Sampling Interval (s)"][$idx],$x.GetSheet["Sampling Interval (s)"][$idx]);
#end if #end if
#end if #end if
...@@ -334,8 +332,7 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse ...@@ -334,8 +332,7 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
} }
#else if ($x.SetSheet["OPC UA Data type"][$idx]).upper()=='UINT32' #else if ($x.SetSheet["OPC UA Data type"][$idx]).upper()=='UINT32'
#set $type=$x.SetSheet["OPC UA Data type"][$idx].upper() #set $type=$x.SetSheet["OPC UA Data type"][$idx].upper()
try{ try{
$x.SetSheet["Short name"][$idx] = baci.HcreateRW${y[$type][0]}Prop("$x.SetSheet["Short name"][$idx]","$x.SetSheet["OPC_UA node"][$idx]"); $x.SetSheet["Short name"][$idx] = baci.HcreateRW${y[$type][0]}Prop("$x.SetSheet["Short name"][$idx]","$x.SetSheet["OPC_UA node"][$idx]");
} catch (IllegalArgumentException|PropertyInitializationFailed e){ } catch (IllegalArgumentException|PropertyInitializationFailed e){
m_logger.log(Level.SEVERE, "Exception in creating Property:"+"$x.SetSheet["Short name"][$idx]"+":"+e.getMessage()); m_logger.log(Level.SEVERE, "Exception in creating Property:"+"$x.SetSheet["Short name"][$idx]"+":"+e.getMessage());
...@@ -439,11 +436,12 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse ...@@ -439,11 +436,12 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
public void ${x.SetSheet["Name of command"][$idx]}($($y[$type][4]) arg0) throws IllegalParameterErrorEx,INACTErrorEx { public void ${x.SetSheet["Name of command"][$idx]}($($y[$type][4]) arg0) throws IllegalParameterErrorEx,INACTErrorEx {
#if str($x.SetSheet["Alarm high"][$idx]) !="nan" and str($x.SetSheet["Alarm high"][$idx]).strip() !="NA" and str($x.SetSheet["Alarm high"][$idx]).strip() !="" and $y[$type][1] != "S" and str($x.SetSheet["Alarm low"][$idx]).strip() !="nan" and str($x.SetSheet["Alarm low"][$idx]).strip() !="NA" and str($x.SetSheet["Alarm low"][$idx]).strip() !="" and $y[$type][1] != "S" #if str($x.SetSheet["Alarm high"][$idx]) !="nan" and str($x.SetSheet["Alarm high"][$idx]).strip() !="NA" and str($x.SetSheet["Alarm high"][$idx]).strip() !="" and $y[$type][1] != "S" and str($x.SetSheet["Alarm low"][$idx]).strip() !="nan" and str($x.SetSheet["Alarm low"][$idx]).strip() !="NA" and str($x.SetSheet["Alarm low"][$idx]).strip() !="" and $y[$type][1] != "S"
#if $type[0]=="I" or $type[0]=="U" #if $type[0]=="I" or $type[0]=="U"
$y[$type][4] minval=str($x.SetSheet["Alarm low"][$idx]).split(".")[0];
$y[$type][4] maxval=str($x.SetSheet["Alarm high"][$idx]).split(".")[0]; $($y[$type][4]) minval = ${str($x.SetSheet["Alarm low"][$idx]).split(".")[0]};
$($y[$type][4]) maxval = ${str($x.SetSheet["Alarm high"][$idx]).split(".")[0]};
#else #else
$y[$type][4] minval=$x.SetSheet["Alarm low"][$idx]; $($y[$type][4]) minval = ${str($x.SetSheet["Alarm low"][$idx])};
$y[$type][4] maxval=$x.SetSheet["Alarm high"][$idx]; $($y[$type][4]) maxval = ${str($x.SetSheet["Alarm high"][$idx])};
#end if #end if
if (arg0>=minval && arg0<=maxval){ if (arg0>=minval && arg0<=maxval){
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
min_timer_trig="0.0" min_timer_trig="0.0"
default_timer_trig="0" default_timer_trig="0"
#end if #end if
#if $y[$type][1] != 's' #if $y[$type][1].upper() != 'S'
min_delta_trig="1" min_delta_trig="1"
min_step="1" min_step="1"
#end if #end if
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
units="" units=""
#end if #end if
min_timer_trig="0" min_timer_trig="0"
#if $y[$type][1] != "S" #if $y[$type][1].upper() != "S"
min_delta_trig="0" min_delta_trig="0"
min_step="1" min_step="1"
#end if #end if
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
units="" units=""
## #end if ## #end if
min_timer_trig="0" min_timer_trig="0"
#if $y[$x.ModeSheet["OPC UA Data type"][$idx].upper()][1] != 's' #if $y[$x.ModeSheet["OPC UA Data type"][$idx].upper()][1] != 'S'
min_delta_trig="0" min_delta_trig="0"
min_step="1" min_step="1"
#end if #end if
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
units="" units=""
## #end if ## #end if
min_timer_trig="0" min_timer_trig="0"
#if $y[$x.CmdSheet["OPC UA Data type"][$idx].upper()][1] != 's' #if $y[$x.CmdSheet["OPC UA Data type"][$idx].upper()][1] != 'S'
min_delta_trig="0" min_delta_trig="0"
min_step="1" min_step="1"
#end if #end if
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment