Override a step within the Krunch Pipeline Data Stream
- Last UpdatedApr 08, 2026
- 2 minute read
This scenario guides you through the steps required to modify the behavior of a baseline step in Krunch Pipeline Data Stream.
To identify the code associated with code related instructions, see the code comments in the Example code section.
To modify the baseline code for a step in Krunch Pipeline Data Stream
In this example, the step code is written to a file called MyAnalogProcessingDeadband.cs. The AnalogProcessingDeadband step is modified to log an entry every time it returns early from the pipeline.
- Within your custom development workspace, locate the source for the step that you want to modify. The step source will be located within the following directory in the RealTime silo:
KrunchDataStream\OASySDNA.RealTime.ExecutionPipelines.KrunchDataStream\Steps
For example:
C:\OASySDev\RealTime\source\KrunchDataStream\OASySDNA.RealTime.ExecutionPipelines.KrunchDataStream\Steps
- In the created project used to modify the step code, open or create the class file using a copy of the baseline source step file.
In the example, a copy of the AnalogProcessingDeadband.cs file was renamed to MyAnalogProcessingDeadband.cs.
- Rename the class to the name of your modified version of the step.
Renaming the step is not required, but it is performed here for illustrative purposes.
- Set the Name member of the IStepInterface to the name of your step.
- Modify the code within the step as desired.
Example code
using System;
using OASySDNA.Common.Logging;
using OASySDNA.RealTime.ExecutionPipelines.KrunchCommon.Context;
using OASySDNA.RealTime.ExecutionPipelines.KrunchDataStream.Steps.Common;
namespace OASySDNA.RealTime.ExecutionPipelines.KrunchDataStream.Steps.Analog
{
// Rename the class to the name of your modified version of the step.
public sealed class MyAnalogProcessingDeadband : IStep
{
// Set the Name member of the IStepInterface to the name of your step.
public String Name { get; } = "MyAnalogProcessingDeadband";
public Boolean ExecutionRequired { get; } = false;
// Modify the code within the step. For our example, we need an instance of the DNALogAdapter, so we will add a declaration here.
private readonly IDNALog dnaLog = DNALogAdapter.Instance;
public IStepContext Execute(IStepContext stepContext, ICachedSettings cachedSettings)
{
Exception resultException = null;
var resultState = true;
var context = stepContext as KrunchContext;
var additionalParameters = context.AdditionalParameters;
var setRecord = context.CommonParameters.SetRecord;
try
{
if (setRecord.ReadField<Boolean>("enable_procdb"))
{
if (Math.Abs(setRecord.ReadField<Double>("curval") - (Double)additionalParameters.Get(AnalogParameterNames.AnalogValue)) <= setRecord.ReadField<Double>("procdb") &&
setRecord.ReadField<Boolean>("flag.fresh") == (Boolean)additionalParameters.Get(CommonParameterNames.OriginalFreshFlag))
{
// Modify the code within the step. For our example,
// we are adding a log whenever we return early from the pipeline.
dnaLog.Always(quot;Returning early and not krunching the point for {context.SetTable.Name} record number {setRecord.RecordNumber}");
resultState = false;
}
}
}
catch (Exception exp)
{
resultException = exp;
resultState = false;
}
context.StepResults.Add(new StepResult(Name, resultState, resultException));
return context;
}
}
}