tbf/TBF/UiBridge/ProcessDataEventArgs.cs

64 lines
1.8 KiB
C#

///
/// Copyright (c) 2016-2017 Sensus Slovensko a.s.
///
using System;
using Common;
using Config.Entities;
namespace TBF.UiBridge
{
class ProcessDataEventArgs : EventArgs
{
public string CompleteTestName;
public int Part;
public int Repeats;
public int RepetitionNr;
public Progress TestPhase;
//public FloatBox RegValvePos; /// Current regulation valve position in [%] (0 .. 100.0)
//public bool PumpOn;
//public bool DivToTank;
public int Time;
public float Flow;
public float Temperature;
public float Pressure;
public float RegValvePosition;
public ProcessDataEventArgs(string testName, int testRepeats, int testPart, int repetitionNr, Progress testPhase)
{
CompleteTestName = Results.Utils.GetTestName(testName, testRepeats, repetitionNr);
Part = testPart;
Repeats = testRepeats;
RepetitionNr = repetitionNr;
TestPhase = testPhase;
Time = TBF.Rig.StateMachine.Time;
Flow = CalcSinusFunction_2(1, Time);
Temperature = CalcSinusFunction_2(2, Time);
Pressure = CalcSinusFunction_2(3, Time);
RegValvePosition = CalcSinusFunction_2(4, Time);
}
public ProcessDataEventArgs(Test test, int repetitionNr, Progress testPhase)
{
CompleteTestName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
Part = test.Part;
Repeats = test.Repeats;
RepetitionNr = repetitionNr;
TestPhase = testPhase;
}
public ProcessDataEventArgs(Test test, Progress testPhase)
: this(test, 1, testPhase)
{
}
protected float CalcSinusFunction_2(int idx, int time)
{
return (float)((20.0f * Math.Sin(40 * (idx + 1) * time * Math.PI / 5800)) * Math.Sin(160 * (idx + 1) * time * Math.PI / 5800))
+ (float)((200.0f * Math.Sin(4 * (idx + 1) * time * Math.PI / 5800)));
}
}
}