ver 3.9.2149.2 ReadPulses added in Run()

Update AssemblyVersion to 3.9.2149.2 and enhance PoseidonReader with new timing and task-tracking functionality.
This commit is contained in:
Michal Buzik 2025-11-13 15:58:09 +01:00
parent 224b53f774
commit f1d32a39ba
3 changed files with 25 additions and 2 deletions

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.9.2149.1")]
[assembly: AssemblyFileVersion("3.9.2149.1")]
[assembly: AssemblyVersion("3.9.2149.2")]
[assembly: AssemblyFileVersion("3.9.2149.2")]

View File

@ -17,6 +17,7 @@ namespace TBF.Rig.RegisterReaders.PoseidonCmdStartStop
private readonly ILog log;
private List<Task> taskPool = new List<Task>();
private long startTime;
private long incommingTime;
public List<Task> TaskPool { get { return taskPool; } }
public void AddTask(Task task) { taskPool.Add(task); }
@ -39,6 +40,11 @@ namespace TBF.Rig.RegisterReaders.PoseidonCmdStartStop
get => startTime;
}
public long IncommingTime
{
get => incommingTime;
}
public bool TimeOutReceived(long timeout)
{
return (DateTime.Now.Ticks - startTime) > timeout;
@ -121,6 +127,8 @@ namespace TBF.Rig.RegisterReaders.PoseidonCmdStartStop
throw;
}
//comming answer from serial port - good place for time stamp
incommingTime = DateTime.Now.Ticks;
string allOutput = (stdOutTask.Result ?? "") + (stdErrTask.Result ?? "");
log?.Debug(allOutput);
return allOutput;

View File

@ -147,6 +147,8 @@ namespace TBF.Rig.RegisterReaders.PoseidonCmdStartStop
int wmRefPulses;
double wmTestTime;
private string wmSerialNr;
int timeFromStart; /// [s] Time from test start to determine when the test start sample should be taken
public IOperation ReadDatastreamOp()
@ -328,15 +330,23 @@ namespace TBF.Rig.RegisterReaders.PoseidonCmdStartStop
/// </summary>
private long startTimeInMilis = -1, fullTimeInMilis = -1;
private static long SafetyTimeOut = 30 * 1000;
private long incommingTime = -1;
/// 30 seconds
public long DeltaTime { get{return fullTimeInMilis;}}
public long IncommingTime { get{return incommingTime;}}
/// <summary>Run this operation</summary>
/// <returns>eventDone</returns>
public Event Run()
{
lock (this)
{
timeFromStart += StateMachine.Period;
ReadPulses();
}
if (_currentOp == CurrentPoseidonOp.SendStartDataStream)
{
CliRunner.AddSendAsync(serialPort, SerialPortData.EMeterArg.AllParams);
@ -353,6 +363,8 @@ namespace TBF.Rig.RegisterReaders.PoseidonCmdStartStop
}
else if (_currentOp == CurrentPoseidonOp.SendStartDataStream_Done)
{
var first = CliRunner.TaskPool.FindLast(t => t is Task<string>);
_currentOp = CurrentPoseidonOp.Done;
return Event.Done;
}
@ -360,6 +372,7 @@ namespace TBF.Rig.RegisterReaders.PoseidonCmdStartStop
|| _currentOp == CurrentPoseidonOp.ReadDataStream_End)
{
startTimeInMilis = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
incommingTime = -1;
_isReadingStart = (_currentOp == CurrentPoseidonOp.ReadDataStream_Start);
CliRunner.AddRunAndCaptureJsonAsync<JsonDataFromPoseidon>(serialPort, SerialPortData.EMeterArg.AllParams);
_currentOp = CurrentPoseidonOp.ReadDatastream_Running;
@ -370,6 +383,8 @@ namespace TBF.Rig.RegisterReaders.PoseidonCmdStartStop
|| CliRunner.TimeOutReceived(SafetyTimeOut))
{
_currentOp = CurrentPoseidonOp.ReadDatastream_Done;
//set time stamp - end of reading
incommingTime = CliRunner.IncommingTime;
}
return Event.Busy;
}