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