Example 1: Getting Started
This example covers the basics of the PowerTSM .NET API: creating an ITsm instance, creating objects, and accessing the stores of a configured repository. Each section is named after the corresponding method in the example.
Creating an ITsm Instance
Section titled “Creating an ITsm Instance”The first method CreatingAnITsmInstance() only shows how to create the core ITsm interface. This object is the entry point to the .NET API and provides access to various factories and services.
Creating TSM Objects
Section titled “Creating TSM Objects”The CreatingTsmObjects() method presents how objects can be created using static methods or factories from the ITsm instance.
Simpler objects using static methods:
var function = FunctionType.StepRight();var intervalType = IntervalType.Minute();Complex objects using the ITsm instance:
var tsm = ITsm.Create();var interval = tsm.Intervals.Create(intervalType, 30);The output of this example should look like this:
- A
StepRightfunction type - A
Minuteinterval type - A 30-minute interval object
Accessing TSM Data
Section titled “Accessing TSM Data”The AccessingTsmData() method demonstrates how to connect to a configured repository and access its stores:
var tsm = ITsm.Create();var repository = await tsm.Repositories.Load("TSM_Example_Repository");var attributeStore = await repository.GetAttributeStore();var timeSeriesStore = await repository.GetTimeSeriesStore();This method:
- Creates an
ITsminstance - Loads a repository named
TSM_Example_Repositoryfrom theHAKOM.xmlconfiguration - Retrieves the attribute store
- Retrieves the time series store
Note that this method doesn’t perform any operations with the retrieved stores; it simply demonstrates how to access them.