Lesson 4 exercises
- Last UpdatedMay 16, 2023
- 2 minute read
- PI System
- AF SDK 2.10
- PI Server
-
Exercise 1
Create an element called Feeders directly under the database root.
-
Exercise 2
Create an element called Feeder001 under Feeders based off of the FeederTemplate element template. Set the value of the City attribute to London. Set the ConfigString property of the Power attribute such that the attribute's data source is the SINUSOID PI Point.
-
Exercise 3
Create a weak reference between Feeder001 and the Feeder001 element. The result should resemble the following structure:
Elements
- Configuration
- Feeders
- Feeder001
- Geographical Locations
- London
- Feeder001
- Meter001
- Meter002
- Meter003
- Meter004
+ Montreal
+ San Francisco
+ Meters
Bonus exercises
Create a replica of the AF Database Green Power Company.
-
Create an AF Database named Ethical Power Company.
AFDatabase CreateDatabase( string servername, string databasename )
-
Create the element categories and attribute categories.
void CreateCategories( AFDatabase database )
-
Create the enumeration sets and their values.
void CreateEnumerationSets( AFDatabase database )
-
Create the PI AF Element Templates and their attribute templates. Set the properties and categories based on the reference database.
void CreateTemplates( AFDatabase database )
-
Create a root element called Meters. Create individual meter elements from the appropriate templates. For Meter001 through Meter008 use MeterBasic. For Meter009 through Meter012 use MeterAdvanced.
void CreateElements( AFDatabase database )
-
Set the attribute values of the meter as appropriate based on the reference database. Only do this for the first meter.
void SetAttributeValues( AFDatabase database )
-
Create the root element called Geographical Locations. Then, create three child elements called London, Montreal, and San Francisco, based on the District template.
void CreateDistrictElements( AFDatabase database )
-
Add meter elements as weak references under the District elements, following the reference database.
void CreateWeakReferences( AFDatabase database )