Back

Topic

[KB627]How to configure mapping using Application Architect

Tags: AA, Application Architect, Architect

12 years ago
By LM
Options
Print
Applies to:

PcVue version 10.0 SP1 onwards.


Summary:

How to map equipment variables with the Application Architect by calculating properties on condition. The appropriate syntax is explained in this article.


Details:

The syntax:

 Name
 Description
 Usage
 Result

 if

 Returns a value based on a condition 

 if(3 % 2 = 1, ‘value is true’, ‘value is false’)  

 ‘value is true’ 

 An example:

Word Modbus TCP/IP frames length are limited to 125.
We need to supervise 60 valves, each valve requiring 10 words.
5 Word frames are created (120 words each).
So Valve1 should be on frame1, Valve13 should be on frame2…

  • 1 <= Valve number <= 12 to Frame 1
  • 13 <= Valve number<= 24 to Frame 2
  • 25 <= Valve number <= 36 to Frame  3
  • 37 <= Valve number <= 48 to Frame 4
  • 49 <= Valve number <= 60 to Frame 5

 To do that with Application Architect:

  1. First we need to allow recursive property in project settings (so you can use a calculated parameter in another calculated parameter):
    Allow_recursive_property
  2. Creation of parameters
    1. pValve to specify the valve number. Data type is int and default value is 1.
      pValveNumber
    2. pFrameIndex to calculate frame index. Data type is Int. pFrameIndexFormula: =Truncate(if(Params(“pValveNumber”)%12=0, Params(“pValveNumber”)/12, Params(“pValveNumber”)/12)+1)

    3. pFrameName to calculate frame name
      pFrameName
       
  3. Creation of the template Valve

    1. Parameter affectation
      Parameter_affectation
    2. Configuration of a register
      Offset =Truncate(if(Params(“pValveNumber”)%12=0, 120-20, (Params(“pValveNumber”)%12-1)*20))

    3.  Configuration of another register…
      Imagine we add a new register for the valve, then we just have to copy/paste the first one and add +2 in the offset expression:
      Speed_configurationOffset = Truncate(if(Params(“pValveNumber”)%12=0, 120-20, (Params(“pValveNumber”)%12-1)*20))+2 

  4.  A possible result when instantiating
    Instance_result
    Just set the pValveNumber input parameter and all the adresses will be calculated.

  5. Trick!
    If the end of the template instance is equal to the number of the valve then there is no need to input the value again.
    Just change the type of the pValveNumber to be an expression:
    Trick_parameter
    Formula =StrRight(TemplateInstance.Name,2) 

Created on: 11 Feb 2013 Last update: 13 May 2024