java.lang.Object
research.ch.cern.unicos.cpc.utilities.siemens.S7Functions

public class S7Functions extends Object
Class containing functions for Siemens Step 7
Author:
Ivan Prieto Barreiro
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static LinkedHashSet<research.ch.cern.unicos.utilities.IDeviceInstance>
    Function for getting the Fast Interlock HashSet of objects of the DeviceType specified
    static String
    getTargetDeviceInformationParam(String parameterName, String typeName)
    Get the value of an attribute defined in the TargetDeviceInformation family from the Device type definition.
    static void
    Initialize the value of the internal member isLargeApplication.
    static boolean
    isFastInterlock(research.ch.cern.unicos.utilities.IDeviceInstance deviceInstance)
    Function for checkin if a particular instance is fast interlock
    static boolean
    Get the value of the class member isLargeApplication @see initialize()
    static String
    This function provides the symbol name of the DB for a given instance name (e.g.
    static String
    s7db_id(String name, boolean isDBSimpleRequested)
    This function provides the symbol name of the DB for a given instance name (e.g.
    static String
    s7db_id(String name, String deviceTypes)
    This function provides the symbol name of the DB for a given instance name (e.g.
    static String
    s7db_id(String name, String deviceTypes, boolean isDBSimpleRequested)
    This function provides the symbol name of the DB for a given instance name (e.g.
    static String
    s7db_id(research.ch.cern.unicos.utilities.IDeviceInstance instance, boolean isDBSimpleRequested)
    This function provides the symbol name of the DB for a given instance name (e.g.
    static String
    s7db_id(research.ch.cern.unicos.utilities.IInstancesFacade theUnicosProject, String name)
    This function provides the symbol name of the DB for a given instance name (e.g.
    static String
    s7db_id(research.ch.cern.unicos.utilities.IInstancesFacade theUnicosProject, String name, boolean isDBSimpleRequested)
    This function provides the symbol name of the DB for a given instance name (e.g.
    static String
    s7db_id(research.ch.cern.unicos.utilities.IInstancesFacade theUnicosProject, String name, String deviceTypes)
    This function provides the symbol name of the DB for a given instance name (e.g.
    static String
    s7db_id(research.ch.cern.unicos.utilities.IInstancesFacade theUnicosProject, String name, String deviceTypes, boolean isDBSimpleRequested)
    This function provides the symbol name of the DB for a given instance name (e.g.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • S7Functions

      public S7Functions()
  • Method Details

    • initialize

      public static void initialize()
      Initialize the value of the internal member isLargeApplication. The value is taken from the UnicosApplication.xml file, parameter: SiemensPLC:SiemensSpecificParameters:GeneralConfiguration:LargeApplication. The method must be called once for each application generation before calling any of the s7dbid(...) class methods.
    • get_instances_FI

      public static LinkedHashSet<research.ch.cern.unicos.utilities.IDeviceInstance> get_instances_FI(String deviceType)
      Function for getting the Fast Interlock HashSet of objects of the DeviceType specified
      Parameters:
      deviceType - Device Type which fast interlock objects are returned
      Returns:
      The fast interlock instances in order
    • isFastInterlock

      public static boolean isFastInterlock(research.ch.cern.unicos.utilities.IDeviceInstance deviceInstance)
      Function for checkin if a particular instance is fast interlock
      Parameters:
      deviceInstance - The instance to be checked
      Returns:
    • s7db_id

      public static String s7db_id(research.ch.cern.unicos.utilities.IInstancesFacade theUnicosProject, String name, String deviceTypes) throws Exception
      This function provides the symbol name of the DB for a given instance name (e.g. s7db_id(specFile, AIRinstance1Name, "AnalogInputReal") returns DB_AIR_All.AIR_SET). Calling this method is equivalent to: s7db_id(IInstancesFacade, String, String, boolean) with the boolean parameter equal to false.

      Example:

       FeedbackOn = instance.getAttributeData("FEDeviceEnvironmentInputs:Feedback On")
       if FeedbackOn != "":
           s7db_id_result=self.thePlugin.s7db_id(self.theUnicosProject, FeedbackOn, "DigitalInput")
           self.thePlugin.writeInstanceInfo('''$Name$.HFOn:='''+s7db_id_result+FeedbackOn+'''.PosSt;''')
       

      Parameters:
      theUnicosProject - Java representation of the UNICOS specifications file.
      name - Is the name of the instance that we want to process
      deviceTypes - Device type list (comma separated)
      Throws:
      Exception
    • s7db_id

      public static String s7db_id(String name, String deviceTypes) throws Exception
      This function provides the symbol name of the DB for a given instance name (e.g. s7db_id(AIRinstance1Name, "AnalogInputReal") returns DB_AIR_All.AIR_SET). The function will use the same specs. file used in the application to search for the specified instance. Calling this method is equivalent to: s7db_id(IInstancesFacade, String, String, boolean) with the boolean parameter equal to false.

      Example:

       FeedbackOn = instance.getAttributeData("FEDeviceEnvironmentInputs:Feedback On")
       if FeedbackOn != "":
           s7db_id_result=self.thePlugin.s7db_id(FeedbackOn, "DigitalInput")
           self.thePlugin.writeInstanceInfo('''$Name$.HFOn:='''+s7db_id_result+FeedbackOn+'''.PosSt;''')
       

      Parameters:
      name - Is the name of the instance that we want to process
      deviceTypes - Device type list (comma separated)
      Throws:
      Exception
    • s7db_id

      public static String s7db_id(research.ch.cern.unicos.utilities.IInstancesFacade theUnicosProject, String name, String deviceTypes, boolean isDBSimpleRequested) throws Exception
      This function provides the symbol name of the DB for a given instance name (e.g. s7db_id(specFile, AIRinstance1Name,"AnalogInputReal", false) returns DB_AIR_All.AIR_SET).

      Note:

      • If the flag isDBSimpleRequested is TRUE, and
      • If the specified instance is an AnalogInputReal or a DigitalInput device
      Then, the returned String will be DB_<RepresentationName>_All_S.<RepresentationName>_SET.

      Example:

       FeedbackOn = instance.getAttributeData("FEDeviceEnvironmentInputs:Feedback On")
       if FeedbackOn != "":
           s7db_id_result=self.thePlugin.s7db_id(self.theUnicosProject, FeedbackOn, "DigitalInput", false)
           self.thePlugin.writeInstanceInfo('''$Name$.HFOn:='''+s7db_id_result+FeedbackOn+'''.PosSt;''')
       
      Parameters:
      theUnicosProject - Java representation of the UNICOS specifications file.
      name - Is the name of the instance that we want to process
      deviceTypes - Device type list (comma separated)
      isDBSimpleRequested - TRUE if the DB Simple is requested.
      Throws:
      Exception
    • s7db_id

      public static String s7db_id(String name, String deviceTypes, boolean isDBSimpleRequested) throws Exception
      This function provides the symbol name of the DB for a given instance name (e.g. s7db_id(AIRinstance1Name,"AnalogInputReal", false) returns DB_AIR_All.AIR_SET). The function will use the same specs. file used in the application to search for the specified instance.

      Note:

      • If the flag isDBSimpleRequested is TRUE, and
      • If the specified instance is an AnalogInputReal or a DigitalInput device
      Then, the returned String will be DB_<RepresentationName>_All_S.<RepresentationName>_SET.

      Example:

       FeedbackOn = instance.getAttributeData("FEDeviceEnvironmentInputs:Feedback On")
       if FeedbackOn != "":
           s7db_id_result=self.thePlugin.s7db_id(FeedbackOn, "DigitalInput", false)
           self.thePlugin.writeInstanceInfo('''$Name$.HFOn:='''+s7db_id_result+FeedbackOn+'''.PosSt;''')
       

      Parameters:
      name - Is the name of the instance that we want to process
      deviceTypes - Device type list (comma separated)
      isDBSimpleRequested - TRUE if the DB Simple is requested.
      Throws:
      Exception
    • s7db_id

      public static String s7db_id(research.ch.cern.unicos.utilities.IInstancesFacade theUnicosProject, String name) throws Exception
      This function provides the symbol name of the DB for a given instance name (e.g. s7db_id(specFile, AIRinstance1Name) returns DB_AIR_All.AIR_SET). Calling this method is equivalent to calling: s7db_id(IInstancesFacade, String, boolean) with the boolean parameter equal to false.

      Example:

       FeedbackOn = instance.getAttributeData("FEDeviceEnvironmentInputs:Feedback On")
       if FeedbackOn != "":
           s7db_id_result=self.thePlugin.s7db_id(self.theUnicosProject, FeedbackOn)
           self.thePlugin.writeInstanceInfo('''$Name$.HFOn:='''+s7db_id_result+FeedbackOn+'''.PosSt;''')
       

      Parameters:
      theUnicosProject - Java representation of the UNICOS specifications file.
      name - Is the name of the instance that we want to process
      Throws:
      Exception
    • s7db_id

      public static String s7db_id(String name) throws Exception
      This function provides the symbol name of the DB for a given instance name (e.g. s7db_id(specFile, AIRinstance1Name) returns DB_AIR_All.AIR_SET). The function will use the same specs. file used in the application to search for the specified instance. Calling this method is equivalent to calling: s7db_id(IInstancesFacade, String, boolean) with the boolean parameter equal to false.

      Example:

       FeedbackOn = instance.getAttributeData("FEDeviceEnvironmentInputs:Feedback On")
       if FeedbackOn != "":
           s7db_id_result=self.thePlugin.s7db_id(FeedbackOn)
           self.thePlugin.writeInstanceInfo('''$Name$.HFOn:='''+s7db_id_result+FeedbackOn+'''.PosSt;''')
       

      Parameters:
      name - Is the name of the instance that we want to process
      Throws:
      Exception
    • s7db_id

      public static String s7db_id(research.ch.cern.unicos.utilities.IInstancesFacade theUnicosProject, String name, boolean isDBSimpleRequested) throws Exception
      This function provides the symbol name of the DB for a given instance name (e.g. s7db_id(specFile, AIRinstance1Name, false) returns DB_AIR_All.AIR_SET).

      Note::

      • If the flag isDBSimpleRequested is TRUE, and
      • If the specified instance is an AnalogInputReal or a DigitalInput device
      Then, the returned String will be DB_<RepresentationName>_All_S.<RepresentationName>_SET.

      Example:

       FeedbackOn = instance.getAttributeData("FEDeviceEnvironmentInputs:Feedback On")
       if FeedbackOn != "":
           s7db_id_result=self.thePlugin.s7db_id(self.theUnicosProject, FeedbackOn, false)
           self.thePlugin.writeInstanceInfo('''$Name$.HFOn:='''+s7db_id_result+FeedbackOn+'''.PosSt;''')
       

      Parameters:
      theUnicosProject - Java representation of the UNICOS specifications file.
      name - Is the name of the instance that we want to process
      isDBSimpleRequested - TRUE if the DB Simple is requested.
      Throws:
      Exception
    • s7db_id

      public static String s7db_id(String name, boolean isDBSimpleRequested) throws Exception
      This function provides the symbol name of the DB for a given instance name (e.g. s7db_id(specFile, AIRinstance1Name, false) returns DB_AIR_All.AIR_SET). The function will use the same specs. file used in the application to search for the specified instance.

      Note:

      • If the flag isDBSimpleRequested is TRUE, and
      • If the specified instance is an AnalogInputReal or a DigitalInput device
      Then, the returned String will be DB_<RepresentationName>_All_S.<RepresentationName>_SET.

      Example:

       FeedbackOn = instance.getAttributeData("FEDeviceEnvironmentInputs:Feedback On")
       if FeedbackOn != "":
           s7db_id_result=self.thePlugin.s7db_id(self.theUnicosProject, FeedbackOn, false)
           self.thePlugin.writeInstanceInfo('''$Name$.HFOn:='''+s7db_id_result+FeedbackOn+'''.PosSt;''')
       

      Parameters:
      name - Is the name of the instance that we want to process
      isDBSimpleRequested - TRUE if the DB Simple is requested.
      Throws:
      Exception
    • s7db_id

      public static String s7db_id(research.ch.cern.unicos.utilities.IDeviceInstance instance, boolean isDBSimpleRequested) throws Exception
      This function provides the symbol name of the DB for a given instance name (e.g. s7db_id(Instance1Name, false) returns DB_AIR_All.AIR_SET).

      Note:

      • If the flag isDBSimpleRequested is TRUE, and
      • If the specified instance is an AnalogInputReal or a DigitalInput device
      Then, the returned String will be DB_<RepresentationName>_All_S.<RepresentationName>_SET.

      Parameters:
      instance - The device instance.
      isDBSimpleRequested - TRUE if the DB Simple is requested.
      Throws:
      Exception
    • isLargeApplication

      public static boolean isLargeApplication() throws research.ch.cern.unicos.plugins.interfaces.GenerationException
      Get the value of the class member isLargeApplication @see initialize()
      Returns:
      The value of the class member 'isLargeApplication' obtained in the method initialize().
      Throws:
      research.ch.cern.unicos.plugins.interfaces.GenerationException
    • getTargetDeviceInformationParam

      public static String getTargetDeviceInformationParam(String parameterName, String typeName)
      Get the value of an attribute defined in the TargetDeviceInformation family from the Device type definition.
      Parameters:
      parameterName - Name of the parameter in the TargetDeviceInformation family.
      typeName - Device type name.