Skip to main content

AddModule Method

Adds a calculation module to the testbed assembly and returns the same AssemblyBuilder instance so you can continue configuring the test run fluently.

Definition​

Namespace: GHost.GSharp.Developer.Builder
Type: AssemblyBuilder
Assembly: GHost.GSharp.Developer.dll

public AssemblyBuilder AddModule<TModule>(Action<ModuleBuilder> builderAction)

Parameters​

TModule
The calculation module type to add to the testbed assembly.

builderAction Action<ModuleBuilder>
A configuration delegate that is passed a ModuleBuilder instance to be used to configure the module’s inputs, outputs, and test contexts for the testbed run.

Return Value​

AssemblyBuilder
The same AssemblyBuilder builder instance, to allow methods to be chained.

Example​

private void ConfigureAssembly(AssemblyBuilder builder)
{
builder
.AddModule<TankVolume>(moduleBuilder => moduleBuilder
.ConfigurePoint(nameof(TankVolume.Diameter), "Diameter_cnst")
// ... more configuration here
)
.AddModule<TankPressure>(moduleBuilder => moduleBuilder
.ConfigurePoint(nameof(TankPressure.Flow), "Flow_meas")
// ... more configuration here
);
}

Remarks​

Use this method to tell the testbed which calculation module you want to execute. For most scenarios you will add a single module to the assembly, but you can call AddModule multiple times if you need to run several modules together in one testbed run.

The ModuleBuilder is a fluent-style builder that allows the chaining of methods to configure your test module:

moduleBuilder
.ConfigurePoint(nameof(TankVolume.Diameter), "Diameter_cnst")
.ConfigurePoint(nameof(TankVolume.Level), "Level_meas")
.ConfigurePoint(nameof(TankVolume.Volume), "Volume_calc")
;

See Also​