Network Data Type

From a modeling perspective, the Network data type is simply an encapsulation of the Model and its associated settings and components. The table below shows the properties belonging to the Network data type which are considered as configurable parameters and how they are represented both in C# and in XML.

Network Property/Attribute Table
Property Name Xml Name Type Description
Model Model NetworkModel The components, settings, and measurements of the network

The Xml representation of a Network object shows it at the highest level of the hierarchy. A bi-product of this encapsulation is that the Xml namespace definitions that must come at this level are held by the Network rather than the Model. This results in a much cleaner Model definition. Although the true reason for this encapsulation is based on software architecture. The Network has only a single child – its Model:

<?xml version="1.0" encoding="utf-8" ?> 
<Network xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<Model />
</Network>

There are several ways to instantiate a Network programmatically. First, an empty Network object can be instantiated by calling its default constructor and subsequently assigning its Model property using a predefined source. This is the methodology that would be utilized if the network models were to be assembled entirely programmatically. Second, if the network model has been preassembled and saved as an XML serialization the preferred way to instantiate a Network object is through its DeserializeFromXml() static method.

using SynchrophasorAnalytics.Networks; 
using SynchrophasorAnalytics.Modeling;

//...

// Instantiate a Network and assign is Model property from previously determined source
Network network = new Network()
{
     Model = GetModelFromSomewhere()
};

//... or ...

// Instantiate a Network by deserializing from an XML momento
Network network = Network.DeserializeFromXml(@"C:\Users\Kevin\Network Models\Network.xml");

Once a Network has been instantiated and all of the components been added, whether by directly setting the Model property or by de-serializing from Xml, in order to complete proper initialization of the object the Initialize() method must be called. This searches through the entire Model and assigns the appropriate references, both hierarchically and horizontally among children network components.

Network network = GetNetworkFromSomewhere();

// Set appropriate references and properties
network.Initialize();

Last edited Sep 14, 2014 at 10:57 PM by kevinjones, version 3