Control Architect Help Documentation
×
Menu
Index

Control Binding expressions

 
 

Building expressions to convert parameter values

 
In order to perform a Control conversion task, you must define the conversions or transformation of Parameter values from a source to a target.  Where you are converting or importing data from an Instrument database or migrating from one control platform to another there will always be certain Parameter values that will require converting to fit the data to the target Control System platform.  
 
 
        // Binded to Source Control Property Value [PVEUHI]
        public System.Double Source_AIChannelA_PVEXEUHI;
       
        // Converted Target Control Property
        private System.Double _AIChannelA_PVEXEUHI;
        [PropertyBinderAttribute("PVEUHI", "AIChannelA.PVEXEUHI")]
        [PropertyRoundingAttribute("SubString(_PVFORMAT, 2, 1, 1)", true)]
        [PropertyDefaultValueAttribute("102.9")]
        public System.Double AIChannelA_PVEXEUHI
        {
            get
            {
                // TODO: modify this get() accessor method to accomplish
                // Source Control Property value conversion
                return Source_AIChannelA_PVEXEUHI;
            }
            set
            {
                _AIChannelA_PVEXEUHI = value;
            }
        }
 
 
 
        // Binded to Source Control Property Value [PVEUHI]
        public System.Double Source_AIChannelA_PVEXEUHI;
       
        // Converted Target Control Property
        private System.Double _AIChannelA_PVEXEUHI;
        [PropertyBinderAttribute("PVEUHI", "AIChannelA.PVEXEUHI")]
        [PropertyRoundingAttribute("SubString(_PVFORMAT, 2, 1, 1)", true)]
        [PropertyDefaultValueAttribute("102.9")]
        public System.Double AIChannelA_PVEXEUHI
        {
            get
            {
                // TODO: modify this get() accessor method to accomplish
                // Source Control Property value conversion
                // Notes: We use a string property to read the enumeration value of PVRNGOP.
                // Note the use of variable names prefixed with the '_' character.  You can use a SourceProperty
                //   reference by prefixing its name with the '_' character.
                // Note that we use ToUpper() method to compare both values in upper case to eliminate having
                //   to worry about case sensitivity.
                return _PVRNGOP.ToUpper() == "NONE"?
((_PVEUHI - _PVEULO) * 0.0689) + _PVEUHI
: ((_PVEUHI - _PVEULO) * 0.029) + _PVEUHI;
            }
            set
            {
                _AIChannelA_PVEXEUHI = value;
            }
        }
 

Constants

 
return -(Source_DACA_PVEUHI - Source_DACA_PVEULO) * $<C_FF_PVEXEHI>$;
 
Constants used within script code must be enclosed within '$' characters.
 
 

Special Constants

 
 
 

Searching and Replacing Parameter Values

 
You can search and replace Parameter values by specifying the value of BLOCK.<PARAMETER> for the Target Control Property.  You define this special Target Property in your Control Property Template as in the example below, which then allows you to select it for the Target Control Property in a Control Binding:
 
When searching and replacing Parameter values you will define a column in your Excel DataSource such as "TextSearch" that is used to specify the Parameter value to search for.  The DefaultValueIfEmpty attribute for your Control Binding is used to specify the replacement value.  When this type of Control Binding usage is detected during generation of a Data Collection task all Parameter values for all Control Modules and their embedded blocks will be searched for the value specified in the Excel Data Source.
 
You can specify optional attributes in the Parameter name format:
 
Excel DataSource:
 
Control Property Template:
 
Control Binding Template:
 
 

Searching and Replacing Parameter Connection References

 
You can search and replace Parameter Connection references by specifying the value of BLOCK.<CONNECTION> for the Target Control Property.  You define this special Target Property in your Control Property Template as in the example above, which then allows you to select it for the Target Control Property in a Control Binding:
 
When searching and replacing Parameter Connection references you will define a column in your Excel DataSource such as "Find" that is used to specify the Parameter Connection reference to search for.  The DefaultValueIfEmpty attribute for your Control Binding is used to specify the replacement Connection reference value.  When this type of Control Binding usage is detected during generation of a Data Collection task all Control Module Parameter Connection references and expressions will be searched for the reference specified in the Control Binding Source property that defines the Excel Data Source column to use.  In the example above the Control Binding source property is bound to the Excel Data Source column named Find.  In the example above the replacement value is specified in the Control Binding DefaultValueIfEmpty attribute.
 
Parameter references are searched in the following elements:
 
You can specify optional attributes in the Connection name format:
 
You can choose to find and replace using the wildcard character * in the format CMname.*:
 
You can choose to find and replace multiple values by separating search and find values with the '|' pipe character:
 
 
 

Block Functions

 
You can also execute custom functions such as deleting an embedded Function Block in a PKS Control Module.  See Control Binding Functions.
 

Tips & Tricks

 
 
     // Binded to Source Control Property Value [DACA_EUDESC]
        public System.String Source_DACA_EUDESC;
       
        // Converted Target Control Property
        private System.String _DACA_EUDESC;
        [PropertyBinderAttribute("DACA.EUDESC", "DACA.EUDESC")]
        [PropertyRoundingAttribute("2", false)]
        [PropertyDefaultValueAttribute("")]
        public System.String DACA_EUDESC
        {
            get
            {
                // If the EUDESC value in the Excel DataSource is empty, then just return
     // the existing Entity Parameter value, which will result in no detection
     // of changes.
     if (string.IsNullOrWhiteSpace(Source_DACA_EUDESC)) return _DACA_EUDESC;
                return Source_DACA_EUDESC;
            }
            set
            {
                _DACA_EUDESC = value;
            }
        }