<< Click to Display Table of Contents >> Getting Tag from connected objects into instruments |
This chapter describes how you can get the Tag into a General Instrument Symbol from the objects the Instrument is connected to.
A link with the project created during this chapter is at the end of this chapter.
The image below shows the various uses cases considered in this example. The number in red are the PnPIDs which we will see later in the tables and views. If you compare the image above and below you will see, that the line segment between the Instruments PI 1 and PIC 1 seems to be gone. But this is not the case. Instrument PIC 1 was just moved to PI 1 which seems to delete the line segment, but in reality the line segment is still there.
|
EngineeringItems This table is actually not needed for the views, but it gives a good overview of the symbols and line segments in this example. What is missing are the Pipe Line Groups and Signal Line Groups classes and the Non Engineering Items class. But they are not important for our example. LineStartAsset This relationship table tell us from which symbol a line segment starts. The column Asset stores the PnPID where the line segment starts. The column Line stored the line segment starts. Compare the last row with the images above. You will see, that the line segment 693 start from the valve 688. LineStartLine This is similar to the LineStartAsset table, but this time the line segments start at another line segment. Compare the row with the images above and you will see, that in Line1 is the line segment starts at the main line segment 592. Which is stored in Line2. LineEndAsset This table tells us at which symbol a line segment ends. Line is the column which contains the PnPID of the line segment and Asset hosts the PnPID where the line segment ends. Compare the last row with the images above. You will see, that the line segment 693 ends at instrument 691. LineEndLine There is also a table which stores if a line segment ends on another line segment. But this use case does not exist in out example. |
Since the General Instrument Symbols are connected with different sources, we need to create SQL statements for each of them. Let's start with the General Instrument Symbols which are connected with Equipment. We need the GeneralInstrumentClass, LineEndAsset, LineStartAsset, and Equipment tables. Next we connect the tables with relationship lines. The PnPID of the GeneralInstrumentSymbol is where the line segment ends. The line segment that ends at the GeneralInstrumentSymbol is the same one that starts on the Equipment. In our resulting view we need the PnPIDs of the GeneralInstrumentSymbols table and the Equipment table. We let SQLite Expert create the SQL Statement. Now we see the result of the statement and the result. Compare this again with the image at the top. We will later be able to get the Equipment Tag for the GeneralInstrumentSymbol 618. You may also recognize, that the line segment connecting the GeneralInstrumentSymbol with the Equipment plays no role in the resulting data. The line segment is merely connecting the two symbols. Also, the type of line segment plays no role. It can be a SignalLineSegment or a PipeLineSegment of any type. That was the first SQL statement, but we have more use cases in our example. To add more SQL Statements we click on the + button. We will get a blank slate again. Now we will consider the HandValves class. It is essentially the same example as with the Equipment table, but no it is the HandValves table. We cannot use the InlineAssets table though, because the Tag property is not available under InlineAssets, but under HandValves class. We execute the setup from SQL Builder again. You will recognize, that the is a UNION between the two SQL statements. It is like adding the results of both statements together. The result now also shows the Tag of the HandValve. We add another SQL statement. Now we use again a similar example, but this time we will consider the Instrumentation class. This covers the case of a connection from and InlinInstrument like the ControlValve above, but also a connection from another GeneralInstrumentSymbol. Now we have three statements. You may wonder how can the two Limit Switches 621 and 623 get the Tag from the ControlValve, because they are connected with the Actuator. This is because the overall object is from the ControlValves class no matter where exactly you connect to. And one last time... For the final example, we need the Tag of the PipeLineSegment. Here we don't use LineStartAsset, but LineStartLine, because the line segment between the main line and the instrument start on a line segment and no a symbol. Now we covered all 4 use cases. All this work was just to get the SQL Statement and check if the result is what we expect and need. Now we can actually create the View for the database. We copy the SQL Statement into the view and type in some name. We recommend using some prefix. This way all your views you may create in the future are grouped together. Now you click Apply in the lower right hand corner. If there is anything wrong with the SQL Statement, you will be informed. You see the View now in the list between the other views. You can toggle between the Data tab and the Design tab to either see the result, or the design of the view.
|
Creating the Link Configuration
Creating the view was the major part. Now the easy part is creating the link configuration in PlantLink. Create a new Link Configuration and select the ProcessPower.dcf from your project. PlantLink will change this to [SQLPID]. By default Update AutoCAD P&ID/Plant 3D properties properties is selected. You want the data for the General Instrument Symbols class. You select the new view. You select PnPID for the External table column and the Class property. Remember: The first column from the view is the PnPID fro the instrument symbol in our drawing. We map the Tag to the Location property of the instrument symbols. Of course if you have another property you can use this as well. Using On Drawing Save is a good option to use, because it ensures, that value from the view is mapped when you save and save&close the a drawing. Finally some name. Make sure, that the link configuration is shown as Active.
|
Now you save the drawing, which triggers an update of the Location property. And we see the Tags in Data Manager.
|
Next Chapter: Using Advanced Conditions