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
Loading
Loading
Loading
Loading
+9 −11
Original line number Diff line number Diff line
@@ -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
#set $type=($x.GetSheet["OPC UA Data type"][$idx].upper()).split("[")[0]+"[]"
        	try {
		       
			$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){
			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
#set $type=$x.GetSheet["OPC UA Data type"][$idx].upper()
		try {
			$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"
			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
		try {
			$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 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]);
  #end if
 #end if
@@ -288,7 +286,7 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
		try {
			$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 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]);
  #end if
 #end if
@@ -300,7 +298,7 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
		try {
			$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 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]);
  #end if
 #end if
@@ -335,7 +333,6 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
#else if ($x.SetSheet["OPC UA Data type"][$idx]).upper()=='UINT32'
#set $type=$x.SetSheet["OPC UA Data type"][$idx].upper()
		try{		
				
			$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){
			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
	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 $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
		$y[$type][4] minval=$x.SetSheet["Alarm low"][$idx];
		$y[$type][4] maxval=$x.SetSheet["Alarm high"][$idx];
		$($y[$type][4]) minval = ${str($x.SetSheet["Alarm low"][$idx])};
		$($y[$type][4]) maxval = ${str($x.SetSheet["Alarm high"][$idx])};
#end if

		if (arg0>=minval && arg0<=maxval){
+4 −4
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@
	min_timer_trig="0.0"
	default_timer_trig="0"
#end if
#if $y[$type][1] != 's'
#if $y[$type][1].upper() != 'S'
        min_delta_trig="1"
        min_step="1"
#end if
@@ -108,7 +108,7 @@
	units=""
#end if
        min_timer_trig="0"
    #if $y[$type][1] != "S"
    #if $y[$type][1].upper() != "S"
        min_delta_trig="0"
        min_step="1"
    #end if
@@ -131,7 +131,7 @@
        units=""
 ## #end if
        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_step="1"
    #end if
@@ -156,7 +156,7 @@
        units=""
 ## #end if
        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_step="1"
    #end if