Download Overview of Import from Excel Spreadsheets

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Entity–attribute–value model wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Navitaire Inc v Easyjet Airline Co. and BulletProof Technologies, Inc. wikipedia , lookup

Concurrency control wikipedia , lookup

Database wikipedia , lookup

Relational model wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Clusterpoint wikipedia , lookup

ContactPoint wikipedia , lookup

Database model wikipedia , lookup

Transcript
Importing Data into the Bentley Plant
Project Database
Overview of Import from Excel Spreadsheets
August 15, 2012
Rev 1.0
Contents
Importing Data into the Bentley Plant Project Database ............................................................................. 3
Project Set Up ........................................................................................................................................... 3
Spreadsheet Preprocessing....................................................................................................................... 4
Example of Instrument Work Sheet Import .......................................................................................... 4
Creating the Drawings............................................................................................................................... 5
Example of Excel Macro ............................................................................................................................ 6
Here is the Macro in VBA form. ............................................................................................................ 7
Importing Data into the Plant Project Database
Overview of Import from Excel
Copyright © Bentley Systems Inc. 2012
Page 2 of 9
Importing Data into the Bentley Plant Project Database
The procedure below defines the process of importing data into the Bentley Plant Project Database from
an Excel Spreadsheet created by exporting data from the Aveva PID tool and database. Though this data
came from Aveva any source of data in spreadsheet form could be imported.
The intent is to use this data in turn to create the PID’s in Bentley OpenPlant PowerPID. The described
method does require preprocessing of the spreadsheets, however, this process could be handled by a
macro created in Excel so as to speed up the process and eliminate potential errors. Look at the last
section for a macro to do this.
As of today I have mapped in the Valves, Equipment, Pipes and Instruments data. The remaining sheets
status is as follows.
Work Sheet Name
Nozzle
Contents
Nozzles for equipment
Reducer
Pipeline Reducers
Line Fittings
Offsheet Connectors
Unknown
To/From data between drawings
Status
Created by AutoPLANT PID at the
time the line is drawn and
connected to the equipment.
OpenPlant PowerPID does not
track reducers.
Pending clarification.
This is created by OpenPlant
PowerPID at the time that the
off page connector is added to a
line and linked to the respective
next sheet.
Project Set Up
To begin the process a Plant Project needs to be created using the Bentley Plant Project Administrator
application. This project then needs to have the tag formats modified to match those of the
spreadsheet. This step insures that the data is imported and parsed into the proper fields within the
database tables.
1.
2.
3.
4.
Create the project.
Add any additional database fields as required.
Modify the tag formats for Instruments, Valves, Equipment and process lines.
Modify the Views located in the Bentley DataManager product to show the proper database
fields as required.
Importing Data into the Plant Project Database
Overview of Import from Excel
Copyright © Bentley Systems Inc. 2012
Page 3 of 9
Spreadsheet Preprocessing
The next step is to preprocess the spreadsheets so that the Plant Project Database will recognize the
records. This requires the addition of several new columns. It may also require the renaming of existing
columns or the user may choose to create all new columns and use Excel Reference Formulas to copy
the data from the default columns/cells to the Plant Project Database recognized columns/cells. In my
example I have added the new columns and renamed existing columns to support by import.
Example of Instrument Work Sheet Import
1. To the existing spreadsheet you need to add 3 new columns to the each work sheet. The
three columns MUST BE the first three columns of the worksheet. The columns are KEYTAG,
TAG_TYPE and TAG_CODE.
2. In addition and because the sheet does not contain a TAG column (tag is built from separate
columns but not parsed and displayed in its own column) you must also add another column
named TAG_NO.
3. The new columns must be filled in as follows.
Importing Data into the Plant Project Database
Overview of Import from Excel
Copyright © Bentley Systems Inc. 2012
Page 4 of 9
COLUMN NAME
KEYTAG
CONTENTS
No value required (System will assign upon
import)
The respective tag type from the Plant
Project Database. In this case AT_INST_,
AT_CVALVE and AT_PSV.
The tag code as defined in the Plant Project
and for instruments this is A-T-N where A –
Area, T = Type and N = Number
This needs to be the parsed together tag
number. Example 0000-PT-8202. This
process could also be automated in Excel so
the user would not have to enter these
values.
TAG_TYPE
TAG_CODE
TAG_NO
4. Additional fields can also be mapped in a similar fashion by editing the names of the
columns.
5. There are limits and basically the only required fields are those that are defined in the
previous steps. Some of the fields found in the worksheets such as DRAWING are not
populated in the table but are linked to the table from the Plant Project Database DOC_REG
table. These values will be automatically populated when the PID component is added to a
drawing. Same rule applies to the OWNER column in the spreadsheet. This will be populated
when the instrument is attached in the PID to the required process line/pipe run.
Creating the Drawings
The final step is to create the drawings and add the components to the respective PID document. This is
a redraw process. The user will create the new PID in the Plant Project and then start drawing the
components using the OpenPlant Power PID tools. When prompted for a tag the user can use the
Browse button to select the tag from those located in the Plant Project Database. The system will then
create a link between the tag in the database and the entity in the drawing. Also at this time other
information will be written into the tag and the database. This information will include when applicable,
process line tag, size and specification. Also written into the database is Drawing Number which the
component resides on and other information depending on what data is entered by the PID designer.
Importing Data into the Plant Project Database
Overview of Import from Excel
Copyright © Bentley Systems Inc. 2012
Page 5 of 9
To speed up the process the user could reference in the exported file and, merge the file into the
current file and then use the conformance tools to make the components intelligent PowerPID
components.
Example of Excel Macro
Below is a sample Macro generated inside of Microsoft Excel. This will perform the following operations.
1. It will insert the columns of KEYTAG, TAG_TYPE, TAG_CODE and TAG_NO.
2. It will add two formulas using IF statements to set the TAG_CODE to the proper code expected
and the TAG_NO cell will be parsed into the relevant parts complete with the dash separators as
required by the Plant Project Database.
3. Lastly it will rename the AREA, CODE, NO and SUFFIX to EAREA, ETYP, ENUM and ESUFF.
This macro was completed for an example Equipment worksheet only and others with minor differences
will need to be created for Valves, Pipes and Instrument work sheets you may have in your
spreadsheets.
This is being stored in the Personal Macro Workbook named personal.xlsb. I also customized the Quick
Access Tool bar and added an icon that will allow this to be executed with a simple push of a button.
This could be customized further to include all macros in one command and execute against all sheets in
the workbook.
Importing Data into the Plant Project Database
Overview of Import from Excel
Copyright © Bentley Systems Inc. 2012
Page 6 of 9
Here is the Macro in VBA form.
Sub Macro2()
'
' Macro2 Macro
'
'
ActiveCell.FormulaR1C1 = _
"=IF(RC[9]<0,RC[6]&""-""&RC[7]&""-""&RC[8],RC[6]&""-""&RC[7]&""-""&RC[8]&""-""&RC[9])"
Range("D3").Select
End Sub
Sub Equipment()
'
' Equipment Macro
' Pre-Process Equipment Work Sheet
'
'
Columns("A:A").Select
election.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("A1").Select
ActiveCell.FormulaR1C1 = "KEYTAG"
Columns("B:B").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Importing Data into the Plant Project Database
Overview of Import from Excel
Copyright © Bentley Systems Inc. 2012
Page 7 of 9
Range("B1").Select
ActiveCell.FormulaR1C1 = "TAG_TYPE"
Columns("C:C").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("C1").Select
ActiveCell.FormulaR1C1 = "TAG_CODE"
Columns("D:D").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("D1").Select
ActiveCell.FormulaR1C1 = "TAG_NO"
Range("C2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[10]>0,""A-T-N-U"",""A-T-N"")"
Range("C2").Select
Selection.AutoFill Destination:=Range("C2:C24"), Type:=xlFillDefault
Range("C2:C24").Select
Range("C12:C24").Select
Selection.ClearContents
Range("D2").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[9]>0,RC[6]&""-""&RC[7]&""-""&RC[8]&""-""&RC[9],RC[6]&""-""&RC[7]&""""&RC[8])"
Range("D2").Select
Selection.AutoFill Destination:=Range("D2:D11"), Type:=xlFillDefault
Range("D2:D11").Select
Importing Data into the Plant Project Database
Overview of Import from Excel
Copyright © Bentley Systems Inc. 2012
Page 8 of 9
Range("J1").Select
ActiveCell.FormulaR1C1 = "'EAREA"
Range("K1").Select
ActiveCell.FormulaR1C1 = "'ETYP"
Range("L1").Select
ActiveCell.FormulaR1C1 = "'ENUM"
Range("M1").Select
ActiveCell.FormulaR1C1 = "'ESUFF"
Range("M2").Select
End Sub
Importing Data into the Plant Project Database
Overview of Import from Excel
Copyright © Bentley Systems Inc. 2012
Page 9 of 9