02.05.2014 Views

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Units<br />

Below is an example creating a custom unit system:<br />

// Find the unit service<br />

IUnitService us;<br />

us = CoreSystem.GetService();<br />

// Get the current catalog<br />

IUnitCatalog catalog = service.GetCatalog(null);<br />

// Define the name and description of my custom unit system.<br />

string name = “My Unit System”;<br />

string desc = “Custom units system for my module.”<br />

// Create a dictionary of my custom units.<br />

IDictionary map = new Dictionary();<br />

// Define the units I want in my system.<br />

map[“Length”] = “ft”;<br />

map[“Pressure”] = “bar”;<br />

map[“Temperature”] = “degF”;<br />

// Create my custom unit system.<br />

IUnitSystem myUnitSystem = catalog.CreateSystem(name, desc, map);<br />

Unit Measurement<br />

The IUnitMeasurement interface is used to access measurement properties and<br />

methods. You can navigate the measurement hierarchy and acquire all units available for a<br />

measurement. Here is the definition for IUnitMeasurement:<br />

public interface IUnitMeasurement<br />

{<br />

IUnitMeasurement BaseMeasurement { get; }<br />

IEnumerable Children { get; }<br />

string Description { get; }<br />

string Name { get; }<br />

IUnitMeasurement Parent { get; }<br />

IEnumerable Units { get; }<br />

}<br />

4-208 <strong>Ocean</strong> Application Development Framework 2008.1<br />

<strong>Schlumberger</strong> Private

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!