Hello all,
I felt it necessary to make known the proper method of mapping properties in PowerPID to fields in the Plant Project Database tables. For the most part this is a straight forward exercise using the Bentley Class Editor and load in the mapping database after loading the OpenPlant_PID schema however for newly added properties the process may not be so clear.
In my example I will add a new property to the EQUIPMENT class. I have added this on the EQUIPMENT Class so the property will propagate down to all derived classes. This property will be MATCODE. I have also added a field with the same name to the EQUIP table in the Plant Project Database. You would probably think that the property should be mapped at the EQUIPMENT class level to the EQUIP table MATCODE field but this is not the case.
Basically the equipment you place is not of the EQUIPMENT class (it is derived from it but not the actual class of the equipment placed). When you synchronize to the database the property will not update the EQUIP table. In order to properly update the table you need to map the property on the lower level classes. For example - If you map the MATCODE property at the PUMP class level (a derived class of EQUIPMENT) then all pumps will properly synchronize and pass the MATCODE property value to the MATCODE database field. Again, mapping the MATCODE property on the VESSEL class will allow all lower level vessel classes to properly pass the MATCODE property value to the MATCODE field in the EQUIP table.
With a little testing you will find what level is required for the proper mapping of property to database field, This should act as a guide in this process.
Following is information that explains in more detail the mapping process. (Thanks to Steve Morrow in Bentley Development. His link to this in the wiki is located in responses to this blog post below.)
Class <-> Tag Type Mapping
Classes used to store mapping definitions are defined in PlantProjectSchema.01.03_Autoplant_PIW.01.03.mapping.xml. These Classes have direct mappings to Class definitions in OpenPlant_PID.01.03.ecschema.xml.
These mapping definitions contain a corresponding APPID Tag Type:
TANK AT_EQTNK
EQUIPMENT AT_EQUIP
PUMP AT_EQPMP
VALVE AT_HVALVE
INSTRUMENT AT_INST_
Rule
A Tag Type can only be defined once in the mapping file.
The following duplicate tag type would not be allowed:
GATE_VALVE AT_HVALVE
Column <-> Property Mapping
Column names defined in the Project Database are mapped to EC Properties per EC Class type.
If a new property mapping is needed for an PUMP class, the mapping must be added to the PUMP class in PlantProjectSchema.01.03_Autoplant_PIW.01.03.mapping.xml.
Rules
The Database Column must be defined on the APPID table name in the DatabaseSchema section in PlantProjectSchema.01.03_Autoplant_PIW.01.03.mapping.xml
The Database Column type must match the EC Property type (String = String, Double= Number)
Example
A new mapping is needed for a PUMP. Both are defined as Strings
Database Column MY_DBCODE
ECProperty MY_ECCODE
<Class name="PUMP" state="Active" schema="OpenPlant_PID.01.03">
<Property name=" MY_ECCODE " state="Active">
<Column name="EQUIP. MY_DBCODE " />
</Property>
<Table name="EQUIP">
<Column name=" MY_DBCODE " nullable="False">
<Type dbType="StringFixedLength" maxLength="10" />
</Column>
When a Pump is placed, the data is written to the database with a Tag Type of AT_EQPMP.
Common Mistake
Using the above Example, In Step 2 the EQUIPMENT class is modified instead of the PUMP class. When a CENTRIFUGAL_PUMP is placed in OPPID, the MY_DBCODE column will not be populated.
This is because
Exception
If the PUMP class is removed from PlantProjectSchema.01.03_Autoplant_PIW.01.03.mapping.xml, the Pump will be written to the Database but with a Tag Type of AT_EQUIP. This scenario would work because
Hope this helps,
Tony DeRosa
Bentley Plant
Please see this WIKI post for more info
communities.bentley.com/.../5986.aspx
Got it. Thanks Tony!
Songrui