Program.cs
The class that contains the Main() entry point of the testbed console app. This class is where you configure the testbed behavior, including:
- Specifying which module to run.
- Mapping points in your module to your data source.
- Creating a context to map your module to an asset in your data source.
- Adjusting logging levels.
Definition
Namespace: GSharp.Testbed
Assembly: GSharp.Testbed.exe
internal partial class Program
Methods
| Method | Description |
|---|---|
Main | The console application's main entry point. |
ConfigureAssembly | The method to specify the module, context and point mapping for the testbed. |
Example
- PI Asset Framework
- Canary Asset Hierarchy
internal partial class Program
{
private static void Main()
{
RunTestbed();
}
private void ConfigureAssembly(AssemblyBuilder builder)
{
builder.AddModule<TankVolume>(moduleBuilder => moduleBuilder
.ConfigurePoint(nameof(TankVolume.Diameter), "Diameter_cnst")
.ConfigurePoint(nameof(TankVolume.Level), "Level_meas")
.ConfigurePoint(nameof(TankVolume.Volume), "Volume_calc")
.AddContext("Test Tank 000", @"\\SVRPI01\Tank Demo\Tanks\Tank 000")
)
.RunAsAt("*")
.WithMinimumAssemblyLogLevel(LogLevel.Info)
.UsingFullLogLayoutFormat()
;
}
}
internal partial class Program
{
private static void Main()
{
RunTestbed();
}
private void ConfigureAssembly(AssemblyBuilder builder)
{
builder.AddModule<TankVolume>(moduleBuilder => moduleBuilder
.ConfigurePoint(nameof(TankVolume.Diameter), "Diameter_cnst")
.ConfigurePoint(nameof(TankVolume.Level), "Level_meas")
.ConfigurePoint(nameof(TankVolume.Volume), "Volume_calc")
.AddContext("Test Tank 000", "Tank Demo.GSharp.Tank Farm.Tank 000")
)
.RunAsAt("Now")
.WithMinimumAssemblyLogLevel(LogLevel.Info)
.UsingFullLogLayoutFormat()
;
}
}
Remarks
The Program.cs file is designed to be edited by you, the developer, and contains methods to set up the testbed for your specific module and data source. The rest of the Program class is hidden away in a partial class so as to remove any distractions and allow you to focus on the configuration. It sets up the framework of the testbed and handles the execution of your module. It does not need to be modified.