Commit 6369a721 authored by Gino Tosti's avatar Gino Tosti
Browse files

added support for array corrected

parent dd3e2bb7
...@@ -105,11 +105,11 @@ class genFromTemplates: ...@@ -105,11 +105,11 @@ class genFromTemplates:
self.nameSpace = {'Author': "Gino Tosti", "Date":today.strftime("%y/%m/%d"), self.nameSpace = {'Author': "Gino Tosti", "Date":today.strftime("%y/%m/%d"),
'Description':wbook.MainSheet["Description"][0],'Component Name':wbook.MainSheet["Component Name"][0], 'Description':wbook.MainSheet["Description"][0],'Component Name':wbook.MainSheet["Component Name"][0],
'URL':wbook.MainSheet["OPC UA address"][0],'prefix':prefix,'module':module, 'URL':wbook.MainSheet["OPC UA address"][0],'prefix':prefix,'module':module,
'Assembly': wbook.MainSheet["Assembly"][0], 'x': wbook,'y':datatype} 'Assembly': wbook.MainSheet["Component Name"][0], 'x': wbook,'y':datatype}
self.nameSpacePy = {'Author': "Gino Tosti", "Date":today.strftime("%y/%m/%d"), self.nameSpacePy = {'Author': "Gino Tosti", "Date":today.strftime("%y/%m/%d"),
'Description':wbook.MainSheet["Description"][0], 'Description':wbook.MainSheet["Description"][0],
'Filename': self.genFileNoGUI[11], 'Filename': self.genFileNoGUI[11],
'Assembly': wbook.MainSheet['Assembly'][0], 'Assembly': wbook.MainSheet['Component Name'][0],
'x': wbook.GetSheet,'y':wbook.SetSheet,'z':wbook.MainSheet,'c':wbook.CmdSheet,'m':wbook.ModeSheet} 'x': wbook.GetSheet,'y':wbook.SetSheet,'z':wbook.MainSheet,'c':wbook.CmdSheet,'m':wbook.ModeSheet}
self._dirs={} self._dirs={}
self.__dirs() self.__dirs()
......
...@@ -413,7 +413,7 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse ...@@ -413,7 +413,7 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
#set $type=($x.SetSheet["OPC UA Data type"][$idx].upper()).split("[")[0]+"[]" #set $type=($x.SetSheet["OPC UA Data type"][$idx].upper()).split("[")[0]+"[]"
@Override @Override
public $($y[$type][4])$([]) G${x.SetSheet["Name of command"][$idx][1:]}(LongHolder arg0) { public $($y[$type][4])$([]) G${x.SetSheet["Name of command"][$idx][1:]}(LongHolder arg0) {
$($y[$type][4])$([]) val baciH.get$(($y[$type][4]).capitalize())ArrayValSync(${x.SetSheet["Short name"][$idx]},arg0); $($y[$type][4])$([]) val=baciH.get$(($y[$type][4]).capitalize())ArrayValSync(${x.SetSheet["Short name"][$idx]},arg0);
return val; return val;
} }
...@@ -437,26 +437,24 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse ...@@ -437,26 +437,24 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
} }
@Override @Override
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" #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] maxval=str($x.SetSheet["Alarm high"][$idx]).split(".")[0];
#else
$y[$type][4] maxval=$x.SetSheet["Alarm high"][$idx];
#end if
#end if
#if 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] 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=$x.SetSheet["Alarm low"][$idx];
$y[$type][4] maxval=$x.SetSheet["Alarm high"][$idx];
#end if #end if
#end if
if (arg0>=minval && arg0<=maxval){ if (arg0>=minval && arg0<=maxval){
baciH.set$(($y[$type][4]).capitalize())ValSync(${x.SetSheet["Short name"][$idx]},arg0); baciH.set$(($y[$type][4]).capitalize())ValSync(${x.SetSheet["Short name"][$idx]},arg0);
} else { } else {
m_logger.log(Level.SEVERE, "Value outside range for:"+"$x.SetSheet["Short name"][$idx]"); m_logger.log(Level.SEVERE, "Value outside range for:"+"$x.SetSheet["Short name"][$idx]");
throw new IllegalParameterErrorEx(); throw new IllegalParameterErrorEx();
} }
#else
baciH.set$(($y[$type][4]).capitalize())ValSync(${x.SetSheet["Short name"][$idx]},arg0);
#end if
} }
#end if #end if
......
...@@ -46,8 +46,8 @@ if __name__ =="__main__": ...@@ -46,8 +46,8 @@ if __name__ =="__main__":
if len(assembly)>1 : if len(assembly)>1 :
print ("the Assembly:"+assembly[0]+" includes more than one device\n",devs) print ("the Assembly:"+assembly[0]+" includes more than one device\n",devs)
for dev in devs: for dev in devs:
print("working On device:", dev)
query="`Device Name` =="+ "'"+dev+"'" query="`Device Name` =="+ "'"+dev+"'"
print("working On:", query)
main=(wb.book.parse("Main")).query(query) main=(wb.book.parse("Main")).query(query)
get=(wb.book.parse("GET")).query(query) get=(wb.book.parse("GET")).query(query)
sett=(wb.book.parse("SET")).query(query) sett=(wb.book.parse("SET")).query(query)
...@@ -76,6 +76,7 @@ if __name__ =="__main__": ...@@ -76,6 +76,7 @@ if __name__ =="__main__":
print ("ERROR executing: ",command) print ("ERROR executing: ",command)
os.chdir(pwd) os.chdir(pwd)
else: else:
print ("the Assembly:"+assembly[0]+" includes one device\n",devs)
mygen=genFromTemplates(options.bookfile,options.prefix,options.module,options.basedir) mygen=genFromTemplates(options.bookfile,options.prefix,options.module,options.basedir)
mygen.generateFileInDir() mygen.generateFileInDir()
if options.install : if options.install :
......
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