Understand the Drag Reducing Agent (DRA) Injector Setpoint Management Programmatic Interface
- Last UpdatedApr 24, 2025
- 4 minute read
Understand the Drag Reducing Agent (DRA) Injector Setpoint Management Programmatic Interface
The public interface IDraLineManager is used to set a dynamic configuration of the DRA Line.
The following is the definition of the IDraLineManager:
using OASySDNA.LMS.DraSetpoints.Abstractions.Manager.Options;
namespace OASySDNA.LMS.DraSetpoints.Abstractions.Manager {
/// <summary>
/// Acts as a manager for DRA lines.
/// </summary>
public interface IDraLineManager {
/// <summary>
/// Configures the DRA line based on the given options.
/// </summary>
/// <param name="options">
/// The options to be used to configure this DRA line.
/// </param>
/// <returns>
/// An instance of an IDraLineManagerResult indicating if
/// configuring this DRA line was successful or not.
/// </returns>
IDraLineManagerResult Configure(DraLineManagerOptions options);
}
}
An instance of DraLineManagerOptions is required for the Configure method, which returns an instance implementing the IDraLineManagerResult interface.
The following is the definition of the DraLineManagerOptions:
using System.Collections.Generic;
namespace OASySDNA.LMS.DraSetpoints.Abstractions.Manager.Options {
/// <summary>
/// Acts as a container for options to configure the.
/// </summary>
public sealed class DraLineManagerOptions {
/// <summary>
/// The name of the DRA Line that is to be configured.
/// </summary>
public string DraLineName { get; set; }
/// <summary>
/// List of DRA injector product groups to be configured for
/// this DRA line.
/// </summary>
public List<DraInjectorProductGroup> DraInjectorProductGroups
{ get; } =
new List<DraInjectorProductGroup>();
/// <summary>
/// List of DRA injector flow rate ranges to be configured for
/// this DRA line.
/// </summary>
public List<DraInjectorFlowRateRange> DraFlowRateRanges
{ get; } =
new List<DraInjectorFlowRateRange>();
/// <summary>
/// List of DRA injector setpoint groups to be configured for
/// this DRA line.
/// </summary>
public List<DraInjectorSetpointGroup> DraInjectorSetpointGroups
{ get; } =
new List<DraInjectorSetpointGroup>();
}
}
The list properties (DraInjectorProductGroups, DraFlowRateRanges, and DraInjectorSetpointGroups) combined with DraLineName will make up the new DRA Dynamic Configuration upon successful completion of call to Configure.
The following is the definition of the DraInjectorProductGroups:
using OASySDNA.Common;
using System;
using System.Collections.Generic;
namespace OASySDNA.LMS.DraSetpoints.Abstractions.Manager.Options {
/// <summary>
/// Acts as a container to represent a DRA injector product group.
/// </summary>
public sealed class DraInjectorProductGroup {
/// <summary>
/// Creates a new instance of the DraInjectorProductGroup class.
/// </summary>
/// <param name="name">
/// The name of the DRA injector product group.
/// </param>
public DraInjectorProductGroup(string name) {
Ensure.NotEmpty(name, nameof(name));
Name = name;
}
/// <summary>
/// The name of this DRA injector product group.
/// </summary>
public string Name { get; }
/// <summary>
/// Readonly list of LMS product type codes.
/// </summary>
public HashSet<string> ProductTypeCodes
{ get; } = new HashSet<string>();
}
}
The following is the definition of the DraFlowRateRanges:
using OASySDNA.Common;
using OASySDNA.LMS.DraSetpoints.Abstractions.Dra;
using System;
namespace OASySDNA.LMS.DraSetpoints.Abstractions.Manager.Options {
/// <summary>
/// Acts as a container to represent a DRA injector flow rate range.
/// </summary>
public sealed class DraInjectorFlowRateRange {
/// <summary>
/// Creates a new instance of the DraInjectorFlowRateRange class.
/// </summary>
/// <param name="name">
/// The name of the DRA injector flow rate range.
/// </param>
public DraInjectorFlowRateRange(string name) {
Ensure.NotEmpty(name, nameof(name));
Name = name;
}
/// <summary>
/// The name of the DRA injector flow rate range.
/// </summary>
public string Name { get; }
}}
The following is the definition of the DraInjectorSetpointGroups with DraInjectorSetpoint:
Note: The DraInjectorName needs to match the name of an existing DRA Injector.
using System.Collections.Generic;
namespace OASySDNA.LMS.DraSetpoints.Abstractions.Manager.Options {
/// <summary>
/// Acts as a container to group DRA injector setpoints.
/// </summary>
public sealed class DraInjectorSetpointGroup {
/// <summary>
/// Gets or sets the name of the DRA injector.
/// </summary>
public string DraInjectorName { get; set; } =
new List<DraInjectorSetpoint>();
}
}
namespace OASySDNA.LMS.DraSetpoints.Abstractions.Manager.Options {
/// <summary>
/// Acts as a container to represent a DRA injector setpoint.
/// </summary>
public sealed class DraInjectorSetpoint {
/// <summary>
/// Gets or sets the name of the associated DRA injector
/// product group.
/// </summary>
public string DraInjectorProductGroupName { get; set; }
/// <summary>
/// Gets or sets the name of the associated DRA injector
/// flow rate range.
/// </summary>
public string DraInjectorFlowrateName { get; set; }
/// <summary>
/// Gets or sets the value of the DRA injector setpoint
/// for the given
/// DRA injector product group and DRA
/// injector flow rate range combination.
/// </summary>
public double Value { get; set; }
}
}
After calling Configure, an instance implementing the IDraLineManagerResult interface is returned. Success or failure can be determined by checking the Success property. When not successful the ErrorMessages property will provide messages regarding the failure.
The following is the definition of the IDraLineManagerResult:
using System.Collections.Generic;
namespace OASySDNA.LMS.DraSetpoints.Abstractions.Manager {
/// <summary>
/// Acts as a container to hold information about the result
/// of an IDraLineManager action.
/// </summary>
public interface IDraLineManagerResult {
/// <summary>
/// Indicates if the action of the IDraLineManager was
/// successful.
/// </summary>
bool Success { get; }
/// <summary>
/// Gets the messages that were returned by the
/// IDraLineManager action.
/// </summary>
IReadOnlyCollection<string> ErrorMessages { get; }
}
}.