# ReportAdapter for SmartPlant® P&ID

**ReportAdapter for SmartPlant® P&ID** is designed to extract data from Intergraph SmartPlant® P&ID (SPPID) into a local project database in Microsoft Access format.

## Installation

Supported operating systems:

-   Microsoft Windows XP
-   Microsoft Windows Server 2003
-   Microsoft Windows Vista
-   Microsoft Windows 7 or later
-   Intergraph SmartPlant P&ID 4.3 or later

## Graphical User Interface (GUI)

### Invoking ReportAdapter for SmartPlant® P&ID

You can launch the utility by clicking **ReportAdapter for SmartPlant® P&ID** from the programme menu, as shown below:

![](./media/ReportAdapterForSmartPlantPID_image9.png)

The following screen will appear:

![](./media/ReportAdapterForSmartPlantPID_image10.png)

### Loading a Plant

The software automatically connects to the active plant. This is displayed in the **Plant** field and can be changed using the **Change active plant...** button.

From the **Open plant structure** dialogue, you can select another plant at the active site. To access plants at other sites, use the **Site server...** button.

![](./media/ReportAdapterForSmartPlantPID_image11.png)

Before loading the plant data, specify the **Output Access file** using the **Browse...** button.

### Extracting Data

Click the **Extract** button to begin extraction from the selected plant. Various extraction options are available: **All**, **Selected drawings**, **Associated data**, and **Extract drawing files**.

#### General Extraction Settings

##### All

The **All** option extracts all plant data without requiring further configuration.

##### Selected Drawings

The **Selected drawings** option opens a dialogue where you can select the drawings you require.

A list of available drawings from the active project will appear. Tick the desired drawings and click **OK** to begin the extraction.

![](./media/ReportAdapterForSmartPlantPID_image12.png)
![](./media/ReportAdapterForSmartPlantPID_image13.png)

In Connected Workshare projects, drawings that belong to satellite configurations are displayed in red to inform you of their status.

##### Associated Data

The **Associated data** option opens a dialogue where you can define the data you wish to extract using SQL statements.

![](./media/ReportAdapterForSmartPlantPID_image14.png)

For example, the statement above will extract only pipe runs whose tags begin with "05". Similarly, you can extract pipe runs with a specific FluidSystem (such as "Water") or Nominal Diameter (such as "100 mm").

You can also use this interface to search for data—for example, to locate a specific Sequence Number used in the plant. Simply enter your search term in the yellow bar without performing an extraction:

![](./media/ReportAdapterForSmartPlantPID_image15.png)

##### Revision

The **Revision** option allows you to extract frozen data (only available for revisions with an associated version). The dialogue lets you choose between "Last Revision" data or data from a specific revision:

![](./media/ReportAdapterForSmartPlantPID_image16.png)

##### Extract Drawing Files

The **Extract drawing files** option copies drawing files to a folder named "igr" at the same location as the mdb file and renames them with the ".igr" extension.

>  Please ensure the SmartSketch version is compatible with your version of SmartPlant P&ID; otherwise, the highlight function in **UniversalReporter** will not work.

#### Settings Related to the from/to Calculation

The following options can be used when extracting the from/to
information:

![](./media/ReportAdapterForSmartPlantPID_image17.png)

- **Only equipment tag:** Reports only equipment tags (no nozzle tags)

- **No branches:** Does not report branch connections

- **Use component description if no tag:** Reports the Piping Component Description attribute if the component tag is empty and the component is an "EndComponent"

In addition to these settings the following changes were implemented:

##### TEMA Heat Exchangers

![](./media/ReportAdapterForSmartPlantPID_image18.png)
If the front and rear sections do not have an item tag defined, the shell item tag is also extracted as From/To information for pipe runs connected to those sections.

In the example above, all runs connected to parts of the heat exchanger will have "W-170" as the from or to information.

##### Equipment with no Tag

For equipment with no tag, you can use a variable to specify which attribute should be used as from/to information (such as "Name" or "Description").

To do this, edit the PID ReportAdapter ini file:

```
..\Program Files(x86)\CAXperts\PID ReportAdapter\PID ReportAdapter.ini
```

```
[FROM_TO]
Equipment_NoTag=Name
```

#### Keep Original Tables During Extraction

If you wish to retain the original tables created during extraction, you can configure a setting in the **PID ReportAdapter** ini file to prevent their deletion:

```
[Settings]
Pid_Delete_TempTables=0
```

If you add this parameter and set it to 0, the tables will not be deleted, and tables such as t_equipment and t_piperun will remain available in the mdb file.

If you set it to 1, the tables will be deleted. This is the default behaviour if you do not include the parameter in the ini file.

#### Attributes on Drawing Objects

A setting has been implemented that activates a checkbox for drawing extraction:

![](./media/ReportAdapterForSmartPlantPID_image19.png)

```
[Settings]
DrawingAttributes=1
```

If you add this parameter and set it to 1, the checkbox "Add attributes" becomes available in the **PID ReportAdapter** interface.

If you tick this box before extraction, PID properties will be copied to the elements in the SmartSketch file (visible in the SmartSketch properties window).

![](./media/ReportAdapterForSmartPlantPID_image20.png)

>This operation may take several minutes per drawing. For large datasets, we recommend running it in batch mode.

### Additional SQL Statements 

#### Create Additional SQL Statements

You can define SQL statements using **Tools → Additional SQL statements** to extend standard output tables with user-defined attributes or perform other tasks (such as creating additional tables or queries). These will be executed automatically after the extraction is complete.

Enter your additional SQL statements in the **Additional SQL statements to be processed after extraction** field. Please use the following examples as a guide:

```
SQL1=ALTER TABLE Equipment ADD COLUMN [MyAttribute] VARCHAR(255)
SQL2=UPDATE [Equipment] SET [MyAttribute] = 'Test'
```

![](./media/ReportAdapterForSmartPlantPID_image21.png)

You can use any tables that will be created during extraction. If you need additional tables, copy them to the template.mdb database (located in the application folder) before running the extraction.

#### Use Query Builder

The included query builder can help you create SQL statements. To add a new statement, click the **Add** button, then select one of the **Available SQL query templates**. Clicking **Add query** or double-clicking a template will insert it at the cursor position or replace your selected text.

The **Available SQL query templates** look like:

```
UPDATE [%TABLE1%] SET [%TABLE1%].[%COLUMN1%]=
```

When you use a template, the %TABLE1% and %COLUMN1% placeholders will be populated with the table and column names you select.

>The ```%TABLE1%``` and ```%COLUMN1%``` fields are populated from the Access database defined for extraction output, which includes tables from Template.mdb. These fields are only available after you have performed the extraction at least once.

If you tick the **Show hidden tables** option, you can select all database tables for your query. If left unticked, only tables displayed in **UniversalReporter** are available; internally created tables remain hidden.

#### Create New SQL Query Template

User defined **SQL query templates** can be created. To add a new
template, click the **Add** button and enter the template name.

![](./media/ReportAdapterForSmartPlantPID_image23.png)

Fill in the text of SQL statement and the placeholders for **Tables and columns to be used by query** textboxes by using the ```%TABLE1%``` and ```%COLUMN1%``` buttons.

User defined templates can be deleted or modified using the **Remove** or **Edit** buttons.

>The SQL text boxes support syntax highlighting for improved readability.

### Add Manual Extract Info

Under **Tools - Settings**, you can configure whether to enter additional information to store with the extracted data. Additional information can only be added before extraction if **Add manual extract info** is ticked.

If **Keep last values** is ticked, the **Information** window will be populated with the values previously used for the selected plant.If **Keep last values** is ticked, the **Information** window will be populated with the values previously used for the selected plant.

![](./media/ReportAdapterForSmartPlantPID_image24.png)

If **Add manual extract info** is enabled, an additional window will appear before extraction, where you can enter information such as revision numbers or descriptions. This information is stored in the output database and can be retrieved in **UniversalReporter** or **ApplicationReporter**.

Use the **Days valid** field to specify how long the extracted data will remain valid. After this period, **UniversalReporter** or **ApplicationReporter** will display a warning when the database is opened.

>**Days valid** must be a positive number or left empty. All other fields are text fields with a maximum of 255 characters.

![](./media/ReportAdapterForSmartPlantPID_image25.png)

### Configure Attributes

#### General Functions

Select **Tools → Attribute configuration...** to open the **Attribute configuration** dialogue.

![](./media/ReportAdapterForSmartPlantPID_image26.png)

The following window will appear.

![](./media/ReportAdapterForSmartPlantPID_image27.png)

This dialogue allows you to define which attributes will be extracted.

Currently, you can add attributes for six object types: Inlinecomp_prun, Eqp_Nozzle, Plantitems, Instruments, ItemNotes, OPCs, and Drawings.

Additional attributes (which are not available in SmartPlant P&ID but are created during extraction) appear in blue. For example, "End_2_ConnectedPiperunID" in the screenshot above.

The numbers shown on the right side of the tables indicate the total number of available attributes (left panel) and the number of selected attributes (right panel).

Expand the tables and select the required attributes. You can transfer attributes between panels using the > and < buttons.

The attribute configuration is saved in the folder %APPDATA%\CAXperts\PID ReportAdapter\ with the filename PlantName.ini. You can also save the attribute configuration for backup purposes or for use in batch mode extraction:

![](./media/ReportAdapterForSmartPlantPID_image28.png)

Attribute configuration specialties:

#### ParentPlantGroup and UnitCode

For SPEM Hierarchies such as Plant\Area\Unit, you can extract Parent PlantGroup information and UnitCode information:

![](./media/ReportAdapterForSmartPlantPID_image29.png)

This allows you to filter easily by Area, for example. This option is available for all objects except ItemNotes and OPCs.

#### PipingPoint Attributes Including ConnectedPiperunID

For piping connection points 1 to 4, you can extract attributes such as nominal diameter, description, and the SP_ID of the connected pipe run. This information can be used to create reports that display which pipe run connects to the second side of a pressure-reducing valve, for example.

![](./media/ReportAdapterForSmartPlantPID_image30.png)

The result in **UniversalReporter** will look like this:

![](./media/ReportAdapterForSmartPlantPID_image31.png)

#### CaseProcess SI Values (also other properties SI values)

The SI values can also be selected for extraction.

![](./media/ReportAdapterForSmartPlantPID_image32.png)

#### Filename and Quantity

If you select "Filename" at the "PlantItem" object level, the symbol name will also be extracted, allowing you to see how many times a symbol appears on a drawing.

If you select "Quantity" (available at all object levels), each extracted object will be assigned a quantity of "1". In **UniversalReporter**, you can then create a "Sum_of_quantity" field to identify the total number of items (such as valves).

![](./media/ReportAdapterForSmartPlantPID_image33.png)

#### Connectivity Attributes for the Relations "Equipment to PipeRun" and "Instruments to PipeRuns or Equipments"

Even though not visible in the attribute configuration interface the following two attributes are extracted:

- **Nozzle_ConnectedPipeRunID** for the Eqp_Nozzle table.

- **Instrument_ConnectedItemID** for the Instruments table.

You can use these attributes to create reports that list the pipe runs connected to specific equipment (starting from the equipment object level) or to identify instrument connections (which may be to pipe runs or equipment nozzles).

**Example for the Equipment_PipeRun Relation**:

![](./media/ReportAdapterForSmartPlantPID_image34.png)
![](./media/ReportAdapterForSmartPlantPID_image35.png)

![](./media/ReportAdapterForSmartPlantPID_image36.png)

**Example for the Instrument Connection Report**:

There are multiple ways to connect instruments to nozzles or piperuns.

The following connection types (involving piping components positioned between the connected pipe run or equipment nozzle and the instrument) have been modified in PID ReportAdapter:

- **A**: The instrument connects to a valve placed on a branch of the main pipe run. The branch is returned as the connected object.

- **B**: The instrument connects to a valve that connects to a nozzle (with pipe run type "Conn to process/Supply"). The nozzle is returned as the connected object.

- **C**: The instrument connects to a valve linked to a nozzle via a "ZeroLength" pipe run. The nozzle is returned as the connected object.

- **D**: The instrument connects to a valve placed on a pipe run that connects to a nozzle. The pipe run has a special linetype. The nozzle is returned as the connected object (in the example below, the linetype is "Components only").

You can define the pipe run type in the ```.\PID ReportAdapter.ini``` file using the following setting:

```
[Instr_Conn]
Nozzle_Pruntype = "Components only"
```

![](./media/ReportAdapterForSmartPlantPID_image37.png)
![](./media/ReportAdapterForSmartPlantPID_image38.png)

Details for C and D:

![](./media/ReportAdapterForSmartPlantPID_image39.png)

Result:

![](./media/ReportAdapterForSmartPlantPID_image40.png)

#### Disconnected Piperuns Having the Same ItemTag

If you select "NotConnectedRuns" under the "InlineComp_Prun" object level in "Others", the software will calculate the number of disconnected pipe runs with the same tag in your extracted dataset.

![](./media/ReportAdapterForSmartPlantPID_image41.png)

![](./media/ReportAdapterForSmartPlantPID_image42.png)

The function checks if runs are graphically connected within a drawing. Across drawings, it checks whether pipe runs are connected via OPCs. Any result greater than 0 indicates duplicate pipe run tags that are not graphically connected.

>Please note that extracting disconnected runs may take some time with larger datasets.

#### Identify Number of LineNumberLabels Placed on a Piperun

For all pipe runs except instrument runs and zero-length pipe runs, if you select the "NumberofLabels" attribute and define the label name(s) in the plant-specific ini file, the software will calculate how many labels are placed on each pipe run during extraction.

In the ini file (```.\UserProfile\Appdata\Roaming\CAXperts\PID ReportAdapter\<PlantName>.ini```), add the relative path for the line labels you wish to check:

![](./media/ReportAdapterForSmartPlantPID_image43.png)

To check multiple labels, separate them with a semicolon, as shown in the example below:

```
Piping=\Piping\Labels - Piping Segments\Line Number.sym;\Piping\Labels - Piping Segments\Line Number_old.sym
```

Review any result that is not 1 (0 means no label is placed; >1 means more than one label is placed on the same run).

![](./media/ReportAdapterForSmartPlantPID_image44.png)

#### Identify the "Parent" Relationship Between Components

By using the "SP_PartOfId" attribute (available in the PlantItem area for all components), you can now extract relationships between actuators and valves, equipment components and equipment, and so on.

![](./media/ReportAdapterForSmartPlantPID_image45.png)

![](./media/ReportAdapterForSmartPlantPID_image46.png)

#### Number of Versions and Number of Auxiliary Graphic Files for Drawings

By using the NoOfAuxGraphic and NoOfVersions attributes (available in the drawing area), this information is calculated during extraction and is available as a field in **UniversalReporter/QualityAssuranceModule**.

![](./media/ReportAdapterForSmartPlantPID_image47.png)

#### Drawing Revision Information

You can select attributes from t_revision for extraction. Additionally, you can select "LastRevision" to display the latest revision of a drawing, and "VersionAssociated" to show whether a version is associated with that revision.

![](./media/ReportAdapterForSmartPlantPID_image48.png)

#### SymbolName and Coordinates

The Symbol table has been added to the extraction interface, allowing you to select fields from the symbol table, including the calculated field "Name", which refers to the symbol name (for example, "Gate Valve").

![](./media/ReportAdapterForSmartPlantPID_image49.png)

#### Parameter for all Plant Loops

To extract plant loops that do not have associated instruments, define the following parameter in the plant-specific ini file (```%Appdata%\CAXperts\PID ReportAdapter``` folder):

```
[General]
AllLoops=1
```

#### MultiRep for Equipment

A new attribute called "MultiRep" has been added to the Equipment_Nozzle attribute configuration (in the "Others" area):

![](./media/ReportAdapterForSmartPlantPID_image50.png)

This is calculated during extraction and displays "True" for MultiRepresentation equipment and "False" for other equipment.

#### As-Built Information

A new plant attribute called "Asbuilt-name" has been added to the _Info table, making it available in **UniversalReporter** as a parameter for report template creation. This is calculated during extraction and displays the name of the As-Built plant when data is extracted for projects.

### Command Line Mode

**PID ReportAdapter** can also be used in command line mode to automatically extract all data from a plant to an mdb file via a batch script. Use the following command to view the command line arguments:

![](./media/ReportAdapterForSmartPlantPID_image51.png)

Command line arguments:

<img src="./media/ReportAdapterForSmartPlantPID_image52.png" width="959">

Examples:

```"C:\Program Files\CAXperts\PID ReportAdapter\PID ReportAdapter.exe" /output "c:\temp\PlantA.mdb"```

```"C:\Program Files\CAXperts\PID ReportAdapter\PID ReportAdapter.exe" /output "c:\temp\PlantA.mdb" /site "d:\Site1\smartplantv4.ini" /plant PlantA /parentplant PlantA /config "d:\PlantA.ini"```

```"C:\Program Files\CAXperts\PID ReportAdapter\PID ReportAdapter.exe" /output "c:\temp\PlantA.mdb" /pbs Refining Area\Recovery Unit;\Refining Area\Distillation Unit\a_*``` will save all drawings with names starting with ```a_``` located in the ```Refining Area\Recovery Unit``` or ```Refining Area\Distillation Unit```

```"C:\Program Files\CAXperts\PID ReportAdapter\PID ReportAdapter.exe" /output d:\temp\1.mdb /unitcode 03``` will save all drawings located beneath the unit with unit code 03

Note that the parameters ```/pbs``` and ```/unitcode``` must be used separately—use either ```/pbs``` or ```/unitcode```, but not both.

The attribute configuration ini file, used in the command line with the
parameter ```/config```, can be created using the menu **File - Save settings
to file**.

The options of **\"Extract Drawing Files\** and **\"Extract From-To relations
for InlineComp_Prun\** from the interactive mode are saved in the file

```
%APPDATA%\CAXperts\PID ReportAdapter\config.ini
```

(e.g. ```C:\Documents and Settings\UserName\Application Data\CAXperts\PID ReportAdapter\config.ini```).
For the command line mode, the two options will be read from the
```config.ini``` and will be used for the extraction.
