laatzen/Common/Ui/LegacyGenesisControl/ICtlBatch.cs
2025-02-04 10:06:57 +01:00

228 lines
10 KiB
C#

using System;
using System.Runtime.InteropServices;
using XylemCommonUiLegacyGenCtl.DataPackage;
using XylemCommonUiLegacyGenCtl.Enums;
namespace XylemCommonUiLegacyGenCtl
{
[Guid("35C5564E-3279-402E-B504-615467589610")
, ComVisible(true)
, InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ICtlBatch : IDisposable
{
/// <summary>
/// Pass a TestSetupContainer
/// Frist Call call for a TESTRUN (Prüfgang)
/// only run once for a every testrun
/// TestSetupContainer contains all DUTs and his testcriteria
/// </summary>
/// <param name="container">
/// WatingForDecision (Wait if an error occure for manual input)
/// TempSouce (for Preadjustment-> Temp. calibration wich reference shuld be used)
/// MeterSize (for Preadjustment-> wich metersize set up and also wich parameter will be set up)
/// DelayInSBeforStart (for Test run-> a delay be for the messuremnt starts (flow is set up before))
/// AllChanelsRequired (for Test run-> if all chanels are required. if false only the @f protocoll will be used)
/// ProductionMode (for Test run-> if Production mode is active meter will be set to Idle after a Testrun )
/// Slot (for Test run and Preadjustment -> on wich Slot (einbauplatz) the meter is attached/installed )
/// SerialNr (for Test run and Preadjustment -> Meters serialnummer )
/// FlowAdjustment (for Test run-> if a flowcalibartion has to be done (Q3 justage) )
/// FlowAdjustmentTarget (for Test run-> the Targe in % for the flowcalibartion )
/// PreAdjustment (for Preadjustment-> if a PreAdjustment will be done)
/// FlowTesting (for Test run--> if a Flowtesting will be done)</param>
void SetTestSetupContainer(dynamic container);
dynamic GetTestSetupContainer();
/// <summary>
/// Init GUI
/// Second Call for a TESTRUN (Prüfgang)
/// only run once for a every testrun
/// Set a new MeterBatch
/// </summary>
/// <param name="ControlSrt">A hind which programm part called the init (frmGenesisControl - Pruef2000.exe)</param>
void PrepareBatch(string ControlSrt);
/// <summary>
/// Add all meters from a TestSetupContainer to the Bach an do general preparations (setup and login)
/// Set Meters in test mode an delay till all meters have a flow detected
/// First call for every TestPOINT (Prüfpunkt)
/// Required that a TestContainer is present <see cref="SetTestSetupContainer"/>
/// If no TestSetupContainer is present you could use <see cref="AddMeter"/>
///
/// </summary>
/// <param name="meterDn"> only for GUI -> size of the pipe</param>
/// <param name="refPulseValence">only for GUI -> </param>
/// <param name="predictedQFlow">only for GUI -> </param>
/// <param name="predictedTs">only for GUI -> </param>
/// <param name="refError">only for GUI -> </param>
/// <param name="isAdjustment">if this test point is an calibration (other test mode) </param>
/// <param name="IsFlyingStartStop">Just for logging (Test run against scale or ref meter)</param>
void AddAllMeters(string meterDn = "-", double refPulseValence = 0.0, double predictedQFlow = 0.0, double predictedTs = 0.0, double refError = 0.0, bool isAdjustment = false, bool IsFlyingStartStop = true, int TestRunNr = 0);
/// <summary>
/// Add a meter to the batch and control, possibly obsolete (used only on TBF)
/// </summary>
/// <param name="serialNumber">Meters serialnummer </param>
/// <param name="slot">Slot (einbauplatz) the meter is attached/installed </param>
void AddMeter(string serialNumber, int slot);
/// <summary>
/// Set the meter in the Idle mode with the state from the TestRun (meter failed or Succeed)
/// </summary>
/// <param name="slot">Slot for identify the meter</param>
/// <param name="Succeed">FlowTested or FlowTestedFailed</param>
void MeterDone(int slot, bool Succeed);
/// <summary>
/// Set the meter in the Idle mode with the state from the TestRun (meter failed or Succeed)
/// Also call a webservice to stroe information about the test tun (e.g. wich logfiles where created an where they are located)
/// </summary>
/// <param name="slot">Slot for identify the meter</param>
/// <param name="Succeed">FlowTested or FlowTestedFailed</param>
void MeterDoneWithDetails(int slot, bool Succeed);
/// <summary>
/// Gets the LUT CRC wich is in the meter (for display an documation proposed)
/// </summary>
/// <param name="slot">Slot for identify the meter</param>
/// <returns>the CRC</returns>
string LutCrc(int slot);
/// <summary>
/// Calls a webservice if the meter on this slot has a vaild Preadjustment
/// </summary>
/// <param name="slot">Slot for identify the meter</param>
/// <returns></returns>
bool MeterHasPreadjustment(int slot);
/// <summary>
/// Set the Error frame for this Slot (only for diplay)
/// </summary>
/// <param name="slot"></param>
/// <param name="errorFrame"></param>
void SetErrorFrame(int slot, double errorFrame = 0.0);
/// <summary>
/// All parameters has pass to the batch and just witing till mesurement can start
/// </summary>
void SetReadyForMesuremnt();
/// <summary>
/// pass informations from current running test point
/// </summary>
/// <param name="refFlowrate"></param>
/// <param name="refTestTime"></param>
/// <param name="refFlowUncorrected"></param>
/// <param name="currentPulse"></param>
/// <param name="currentRefVolume"></param>
/// <param name="remainingPulse"></param>
/// <param name="period"></param>
/// <param name="forceMeterUpdate"></param>
void SetBatchInfos(double refFlowrate = 0.0, double refTestTime = 0.0, double refFlowUncorrected = 0.0,
int currentPulse = 0, double currentRefVolume = 0.0, int remainingPulse = 0, string period = "-", bool forceMeterUpdate = false);
/// <summary>
/// Call a meters to start the Measurement
/// </summary>
void StartMeasurement();
/// <summary>
/// Call a meters to stop the Measurement
/// </summary>
void StopMeasurement();
/// <summary>
/// Set a new Action test for the Logfile (so the logfile name has a hint wich action curently is taking part e.g. which test run number is running))
/// </summary>
/// <param name="ActionText"></param>
void SetLoggerActionText(string ActionText);
/// <summary>
/// Get overview over all CalibrationResult if the calibraion is runing, succed or failed
/// </summary>
/// <returns></returns>
LegacyCalibrationResult GetCalibrationIsDone();
/// <summary>
/// Get CalibrationResult for a meter
/// </summary>
/// <param name="slot">Slot for identify the meter</param>
/// <returns></returns>
LegacyCalibrationResult GetCalibrationResult(int slot);
/// <summary>
/// Force all meters (which have a Calibration running) to calculate and store the correction factor according to the FlowAdjustmentTarget
/// </summary>
/// <param name="RefVolume">Volume in qm from ref (meter or scale)</param>
/// <param name="testTimeRef">Time in S how long the messuremnt on the ref was running</param>
void StartStoreCalibration(double RefVolume, double testTimeRef);
/// <summary>
/// Force all meters (which have a Calibration running) to calculate and store the correction factor according to the input by user
/// </summary>
/// <param name="RefVolume">Volume in qm from ref (meter or scale)</param>
/// <param name="testTimeRef">Time in S how long the messuremnt on the ref was running</param>
void StartStoreCalibrationAuto(double RefVolume, double testTimeRef, double AdjustmentPerc = 0);
/// <summary>
/// get the version of the LegacyGenCtl project for diplay and logging on the test bench
/// </summary>
/// <returns></returns>
string GetVersion();
/// <summary>
/// get the meter results to diplay and store the result in the database (by caller)
/// </summary>
/// <param name="Slot">Slot for identify the meter</param>
/// <param name="Chnnl">which reuslt to get a channle or the diplay value </param>
/// <param name="refVol">Volume in qm from ref (meter or scale)</param>
/// <param name="doubleRefTime">Time in S how long the messuremnt on the ref was running</param>
/// <returns></returns>
Results GetResults(int Slot, int Chnnl, double refVol, double doubleRefTime);
/// <summary>
/// write a log entry from the caller (test bench) to the current meters log file
/// </summary>
/// <param name="slot">Slot for identify the meter</param>
/// <param name="message"></param>
///
void LogMeter(int slot, string message);
/// <summary>
/// remove a meter (e.g. when the meter failed on preadjustemnt)
/// </summary>
/// <param name="slot"></param>
void RemoveMeter(int slot);
/// <summary>
/// Indicated if the cltBatch is busy. Often the caller waits till the control is not busy any more to continue this progress
/// </summary>
/// <returns></returns>
bool IsBusy();
/// <summary>
/// Dispose call for an expredet end of life time (test run in finished or canneceld)
/// </summary>
/// <param name="fromCode"></param>
void Dispose(bool fromCode);
/// <summary>
/// Check SM If the State is MessuremntActive
/// </summary>
/// <returns></returns>
bool MeasurementIsActive();
/// <summary>
/// Check SM If the State is MMeasurementCompleted
/// // </summary>
/// <returns></returns>
bool MeasurementIsCompleted();
bool MetersArePrepared();
bool IsReadyForMesuremnt();
}
}