Doc - Bentley Communities

OPPID PSPID Conversion Setup and
Schema Mapping
Document Type: TechNote
Product(s): OpenPlant PowerPID
Version(s): Selectseries 4+
Original Author: Steve Morrow
1. Introduction
The purpose of this document is to guide the user to create a mapping from existing systems
(referred to as Source from now on) like PSPID to OPPID (target system). As source could have
the data in any format (dgn, jsm, etc), therefore we want to design an extensible system that
could import/convert the file to OPPID native formats.
2. Providers List
A provider is an encapsulated unit that has all the information required to convert from any
source to a target system. There could be many providers, hence the name providers list. This list
contains provider name, assembly, mapping schema and a prompt mode. This providers list will
be contained in an xml file at the following path:
*\PowerPID\Bentley\PowerPID\assemblies\Bmf\Bentley.ConversionServices.xml
<ConversionServices>
<Extension
Name="PSPID Conversion"
AssemblyPath="Bentley.Plant.ModelingFramework.Conversion.Pspid.dll"
ConversionCLRClass="Bentley.Plant.ModelingFramework.Conversion.Pspid.PspidConversionP
rovider"
CreateLog="true"
ShowLogOnFinish="true"
CreateBackUp="true"
PromptMode="true"></Extension>
<Extension
Name="AutoPLANT PID Conversion"
AssemblyPath="Bentley.Plant.ModelingFramework.Conversion.AutoPLANTpid.dll"
The dll provider location:
The schema mappings location:
*\PowerPID\Bentley\PowerPID\assemblies\Bmf\
*\Projects\<workspace>\data\resource\
3. Configuration files
For each conversion provider, there is a corresponding configuration file of the following format:
<?xml version="1.0" encoding="utf-8" ?>
<ConfigurationVariables>
<Extension Mapping="PSPid_ansi_Conversion"
PSPID_HOME ="C:\Conversion\PSPID\"
PIDLOCAL_CFG="pidlocal.cfg"
PIDAPPL_CFG="pidappl.cfg"
WORKSPACE="ansi">
</Extension>
</ConfigurationVariables>
Each configuration MUST contain the Mapping variable. This variable points to an xml schema
that contains classes from the legacy document to be converted. Each class in this schema has a
corresponding class name from the OpenPlant P&ID schema.
Other variables may be required to run the conversion processes are also located in this file. Its is
up to that particular provider to read and disseminate these values.
In the example above PlantSpace P&ID variable are required for the PlantSpace conversion to
work correctly.
If the WORKSPACE variable is empty a dialog will be displayed for workspace selection. These
workspaces are determined by the pcf files in the PSPID_HOME folder.
4. Schema Mappings
As mentioned above, mapping schemas will be located in the “*\projects\<workspace>\Data\
Conversion\” folder and each provider has its own mapping schema specified in the main
providers list file. A schema mapping has two major parts: class mappings and property
mappings.
The main class (Conversion Class Mapping) can have many subclasses which signify the
mappings from different formats i.e., from jsm and dgn in the case above.
4.1. JSM classes
The JSM classes are first level of extracting for PSPID documents. These are the general classes
“EQUIP, INSTRUMENT, PID_VALVE, …) These classes will contain a generic mapping plus
a relationship mapping.
Relationship mapping is add with the “Relationship mapping attribute”
This attribute contains:
 The OPPID relationship name: (RUN_HAS_IN_RUN)
 The JSM relationship name: (MEMBERS). This key name is used to retrieve the
“JSM class names” to use in the relationship
 JSM class names: (HVALVE,PID_VALVE,…) is a collection whose members
are used in the relationships. These values are stored in the JSM
relationship(MEMBERS)..
Other classes that have relationship custom attributes: EQUIP*, FITTING_REDUCER,
LINE_CONNECTOR, INST_LOOP.
4.2. PSPID Classes
The specific classes are located under the DGN_CLASS_MAPPING. These classes will have
specific OPPID target class mapping.
These classes will contain a custom attribute which will contain the OPPID class name and the
property mapping class name. Each class must have a “Class Mapping Attribute” attached. This
custom attribute contains:
 The OPPID target name (equip_pump_centrifugal). This class will be created and
is located in the project schema (OPPowerPID_Imperial, OPPowerPID_ISO,…)
 Property Mapping class: This contains the name of the class that will have the
OPPID and PSPID property mappings
 Alternate OPPID Class: This is an alternate class name used with the JSM
PID_VALVE general class. The PID_VALVE class contains all inline valves
(Control and regular). To distinguish these values, the PID_VALVE class has the
“Control valve class indicator” custom attributes. This contains two properties:
one for the field to query and the field value. If the field value stored in the PSPID
data equals the value in the custom attribute (CONTROL), then the component
uses the alternate class name.


Alternate Relationship class. This value overrides the JSM relationship name
Inrun flag. This value is stored on the JSM class and is used to Use to determine if
a component is in an pipe run, such as a valve, control valve, fitting,…)
4.3. Property mapping
The property mapping class name contains the source and target properties. These are the
properties in which the content will be transferred.
5. Examples
1. Open the schema mapping in Class Editor
2. Right-click on ‘Dgn Conversion Class Mapping’ and click on ‘Add Derived Class’
3. A new class will be created. Specify its name and description.
4. Right-click on the newly added class in the left pane and click on ‘Custom Attributes …’.
A dialog would pop-up. Select ‘CLASS_MAPPING_ATTRIBUTE’, add it to ‘Existing
Custom Attributes’ and click OK.
5. Specify the ‘Target Class Name’ in the newly added custom attribute and click on the
‘Save’ button. This ends a simple class mapping from a source to target. Property
mappings are described below
6. Right-click on ‘Conversion Property Mappings’ and click on ‘Add Derived Class’.
Specify the name and description of the newly added class
7. Right-click on this class and select
‘Custom Attributes…’. Select
‘PROPERTY_MAPPING_ATTRIBUTE’, add it to ‘Existing Custom Attributes’ and
click OK.
8. Specify the ‘SOURCE_PROPERTY’, ‘TARGET_PROPERTY’ and click on the ‘Save’
button. Once this property mapping array is complete, it can be specified in the class
mapping custom attribute so that it can be used during conversion.