Commit 21a3f6b8 authored by Gino Tosti's avatar Gino Tosti
Browse files

cleaning

parent 53113748
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -4,17 +4,17 @@ yum install libXScrnSaver

as user:

python -m pip install --upgrade pip  setuptools wheel
pip install --upgrade --user pip  setuptools wheel

python -m  pip install Cheetah3
pip install --user Cheetah3

python -m  pip install xlrd==2.0.1
pip install --user xlrd==2.0.1

python -m  pip install openpyxl
pip install --user openpyxl

python -m pip install pandas (it could be already installed)
pip install --user pandas (it could be already installed)

python -m pip install pysimplegui
pip install --user pysimplegui

Install pyGen:

@@ -29,7 +29,7 @@ To test the generator from command line (this allow to create multiple devices c

$>cd $PYGEN/test

$>python genDevice.py -f <your ICD file .xls/xlsx> -p astrima -m tcs
$>python genDevice.py -f <your ICD file .xls/xlsx> -p astri -m tcs

To test the generator with the GUI (only single device component generation is supported)

+8 −5
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ module $module {


    // GET commands

#if $x.GetSheet["NRows"]>=1
  #for $idx in $range(0,$x.GetSheet["NRows"])
    // $x.GetSheet["Description"][$idx].replace('\n', '')
    #if ($x.GetSheet["OPC UA Data type"][$idx]).upper()[-1]==']' ## test for arrays
@@ -67,9 +67,10 @@ typedef sequence<$y[$type][5]> $($typename)Seq; ## idl typedef
${y[$type][5]} $x.GetSheet["Name of command"][$idx] (out ACS::Time timestamp) raises (TCSControlExceptions::OPCUAErrorEx, TCSControlExceptions::INACTErrorEx);                
    #end if
  #end for
 #end if

    // SET commands

#if $x.SetSheet["NRows"]>=1
  #for $idx in $range(0,$x.SetSheet["NRows"])
    // $x.SetSheet["Description"][$idx].replace('\n', '')
    #if ($x.SetSheet["OPC UA Data type"][$idx]).upper()[-1]==']' ## test for arrays
@@ -86,25 +87,27 @@ ${y[$type][5]} G${x.SetSheet["Name of command"][$idx][1:]}(out ACS::Time timesta
               TCSControlExceptions::IllegalParameterErrorEx);
    #end if
  #end for
  #end if

    // MODE commands

  #if $x.ModeSheet["NRows"]>=1
  #for $idx in $range(0,$x.ModeSheet["NRows"])
    // $x.ModeSheet["Description"][$idx].replace('\n', '')
    void ${x.ModeSheet["Name of command"][$idx]}() raises (TCSControlExceptions::INACTErrorEx,
               TCSControlExceptions::IllegalParameterErrorEx);

  #end for
  #end if

    // CMD commands

  #if $x.CmdSheet["NRows"]>=1
  #for $idx in $range(0,$x.CmdSheet["NRows"])
    // $x.CmdSheet["Description"][$idx].replace('\n', '')
    void ${x.CmdSheet["Name of command"][$idx]}() raises (TCSControlExceptions::INACTErrorEx,
               TCSControlExceptions::IllegalParameterErrorEx);

  #end for
  
  #end if
    };
};
\#endif
+25 −8
Original line number Diff line number Diff line
@@ -67,11 +67,11 @@ import alma.acs.container.ContainerServices;
import alma.maciErrType.wrappers.AcsJComponentCleanUpEx;

import ${prefix}.${module}.${Assembly}BaseOperations;
import ${prefix}.${module}.TCSHardwareDeviceImpl.TCSHardwareDeviceImpl;
import ${prefix}.${module}.TCSHardwareDeviceImpl.PropErrorListener;
import ${prefix}.${module}.TCSHardwareDeviceImpl.ConnectionListener;
import ${prefix}.${module}.TCSHardwareDeviceImpl.baciHelper;
import ${prefix}.${module}.TCSHardwareDevicePackage.tcshwState;
import ${prefix}.tcs.TCSHardwareDeviceImpl.TCSHardwareDeviceImpl;
import ${prefix}.tcs.TCSHardwareDeviceImpl.PropErrorListener;
import ${prefix}.tcs.TCSHardwareDeviceImpl.ConnectionListener;
import ${prefix}.tcs.TCSHardwareDeviceImpl.baciHelper;
import ${prefix}.tcs.TCSHardwareDevicePackage.tcshwState;
import ${prefix}.TCSControlExceptions.INACTErrorEx;
import ${prefix}.TCSControlExceptions.OPCUAErrorEx;
import ${prefix}.TCSControlExceptions.IllegalParameterErrorEx;
@@ -248,6 +248,7 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
     
    private void createDataPoints() throws  IllegalArgumentException,PropertyInitializationFailed, ServiceException, StatusException, StatusException, IOException, OnChangeNotSupportedException{
#silent L=[]
#if ($x.GetSheet["NRows"] >=1)
#for $idx in $range(0,$x.GetSheet["NRows"])
#silent L.append($x.GetSheet["Short name"][$idx])
#if ($x.GetSheet["OPC UA Data type"][$idx]).upper()[-1]==']' ## test for arrays
@@ -307,6 +308,9 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
		}	
#end if
#end for
#end if

#if ($x.SetSheet["NRows"] >=1)
#for $idx in $range(0,$x.SetSheet["NRows"])
#silent L.append($x.SetSheet["Short name"][$idx])
#if ($x.SetSheet["OPC UA Data type"][$idx]).upper()[-1]==']' ## test for arrays
@@ -346,6 +350,9 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
		}	
#end if	
#end for
#end if

#if ($x.ModeSheet["NRows"] >=1)
#for $idx in $range(0,$x.ModeSheet["NRows"])
#set $name=($x.ModeSheet["OPC_UA node"][$idx].split(";")[1]).split("=")[1].replace(".","_")
#if not $name in L
@@ -365,6 +372,9 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
#silent L.append($name)
#end if
#end for
#end if

#if ($x.CmdSheet["NRows"] >=1)
#for $idx in $range(0,$x.CmdSheet["NRows"])
#set $name=($x.CmdSheet["OPC_UA node"][$idx].split(";")[1]).split("=")[1].replace(".","_")
#if not $name in L
@@ -384,10 +394,11 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
#silent L.append($name)
#end if
#end for
#end if		
    }
#silent L=[]


#if $x.GetSheet["NRows"]>=1
#for $idx in $range(0,$x.GetSheet["NRows"])
#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]+"[]"
@@ -412,7 +423,8 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
	}
#end if
#end for

#end if
#if $x.SetSheet["NRows"]>=1
#for $idx in $range(0,$x.SetSheet["NRows"])
#if ($x.SetSheet["OPC UA Data type"][$idx]).upper()[-1]==']' ## test for arrays
  #set $type=($x.SetSheet["OPC UA Data type"][$idx].upper()).split("[")[0]+"[]"
@@ -465,6 +477,8 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
	}
#end if
#end for
#end if 
#if $x.ModeSheet["NRows"]>=1
#for $idx in $range(0,$x.ModeSheet["NRows"])
#set $name=($x.ModeSheet["OPC_UA node"][$idx].split(";")[1]).split("=")[1].replace(".","_")
#set $type=$x.ModeSheet["OPC UA Data type"][$idx].upper()
@@ -482,7 +496,9 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
		baciH.set$(($y[$type][4]).capitalize())ValSync(${name},$value);	
	}
#end for
#end if

#if $x.CmdSheet["NRows"]>=1
#for $idx in $range(0,$x.CmdSheet["NRows"])
#set $name=($x.CmdSheet["OPC_UA node"][$idx].split(";")[1]).split("=")[1].replace(".","_")
#set $type=$x.CmdSheet["OPC UA Data type"][$idx].upper()
@@ -500,6 +516,7 @@ public class ${Assembly}BaseImpl extends TCSHardwareDeviceImpl implements ${Asse
		baciH.set$(($y[$type][4]).capitalize())ValSync(${name},$value);		
	}
#end for
#end if

	private String loadFromCDB(String cdbKey) throws NoSuchCharacteristic {
	    String s = characteristicModelImpl.getString(cdbKey);
+1 −1
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@
        archive_max_int="0"
        archive_suppress="true"
        default_value="0"
        format="%%${y[$x.CmdSheet["OPC UA Data type"][$idx].upper()][1]}"
        format="%${y[$x.CmdSheet["OPC UA Data type"][$idx].upper()][1]}"
        description="$x.CmdSheet["Description"][$idx]"
 ## #if $x.CmdSheet["Unit"][$idx] !="" and $x.CmdSheet["Unit"][$idx] !="NA" and str($x.CmdSheet["Unit"][$idx]) !="nan"
 ##       units="$x.CmdSheet["Unit"][$idx]"
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@

module $module
{
    interface $Assembly: tcs::${Assembly}Base
    interface $Assembly: $module::${Assembly}Base
    {
    };
};
Loading