Initial commit almost identical to SVN-repo rev.340

This commit is contained in:
Milan Hanajik
2014-07-28 09:56:40 +02:00
commit 175a92f633
575 changed files with 186534 additions and 0 deletions
@@ -0,0 +1,16 @@
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface IAmbient : IComponent
{
/// <summary>
/// Events: Event.AmbientDone, Event.Error
/// </summary>
/// <param name="temperature">FloatBox for the air temperature in [deg.C]</param>
/// <param name="pressure">FloatBox for the air pressure in [mBar]</param>
/// <param name="humidity">FloatBox for the air humidity in [%]</param>
/// <returns>Operation</returns>
IOperation ReadAmbientOp(FloatBox temperature, FloatBox pressure, FloatBox humidity);
}
}
@@ -0,0 +1,48 @@
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
/// <summary>
/// Basic balance functions
/// </summary>
public interface IBalance : IDevice, IComponent
{
/// <summary>
/// Camera number: 0-based index required for communication with the Elde component
/// </summary>
int BalanceNr { get; }
/// <summary>
/// Balance water tank capacity in kg or ltr
/// </summary>
float Capacity { get; }
/// <summary>
/// Measurement correction table
/// </summary>
IList<Entities.MeasurementCorrection> Corrections { get; }
/// <summary>
/// Events: BalanceDone, Error
/// </summary>
/// <param name="result">Reference to a variable for 'tara' in kg</param>
/// <returns>TaringOp instance reference casted to IOperaton</returns>
IOperation TaringOp(ref FloatBox tara);
/// <summary>
/// Events: BalanceDone, Error
/// </summary>
/// <param name="result">Reference to a variable for the measured mass in kg</param>
/// <returns>ReadMassOp instance reference casted to IOperaton</returns>
IOperation ReadMassOp(ref FloatBox mass);
/// <summary>
/// Events: BalanceDone, Error
/// </summary>
/// <param name="result">Reference to a variable for the measured mass in kg</param>
/// <param name="readingsCount">Required mass readings count (>= 3)</param>
/// <returns>ReadMassAverageOp instance reference casted to IOperaton</returns>
IOperation ReadStableMassOp(ref FloatBox mass, int readingsCount);
}
}
@@ -0,0 +1,14 @@
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface IBalance2 : IBalance, IComponent
{
/// <summary>
/// Events: Done, Error
/// </summary>
/// <param name="serialNumber">Reference to the serialNumber</param>
/// <returns>GetBalanceSNOp instance reference casted to IOperaton</returns>
IOperation GetBalanceSNOp(ref string serialNumber);
}
}
@@ -0,0 +1,46 @@
using TBF.BenchControl;
namespace TBF.BenchControl.GenericDevices
{
public interface ICamera : Generic.IComponent
{
/// <summary>
/// Camera number: 0-based index required for communication with 'Pictures'screen
/// </summary>
int CameraNr { get; }
float Brightness { get; }
/// <summary>
/// Grab an image.
/// </summary>
/// <returns>Reference to operation object instance</returns>
IOperation GrabOp();
/// <summary>
/// Display live image.
/// </summary>
/// <returns>Reference to operation object instance</returns>
IOperation LiveOp();
/// <summary>
/// Display live detail to focus the camera.
/// </summary>
/// <returns>Reference to operation object instance</returns>
IOperation FocusOp();
/// <summary>
/// Watermeter wheel/arrow detection process.
/// </summary>
/// <param name="roiId">Region of interest (1..4)</param>
/// <returns>Reference to operation object instance</returns>
IOperation DetectOp(int roiId, Cameras.IdcCamera.IWorkerCmd cmd);
/// <summary>
/// Watermeter wheel/arrow angle measurement process.
/// </summary>
/// <param name="roiId">Region of interest (1..4)</param>
/// <returns>Reference to operation object instance</returns>
IOperation MeasureOp(int roiId, Cameras.IdcCamera.IWorkerCmd cmd);
}
}
@@ -0,0 +1,23 @@
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface ICameraRoi : IComponent, IRegisterReader
{
GenericDevices.ICamera Camera { get; }
/// <summary>
/// Watermeter wheel/arrow detection process.
/// </summary>
/// <param name="roiId">Region of interest (1..4)</param>
/// <returns>Reference to operation object instance</returns>
IOperation DetectOp();
/// <summary>
/// Watermeter wheel/arrow angle measurement process.
/// </summary>
/// <param name="roiId">Region of interest (1..4)</param>
/// <returns>Reference to operation object instance</returns>
IOperation MeasureOp();
}
}
@@ -0,0 +1,11 @@
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface IDataEntry : IComponent
{
IOperation ShowFormAtCycleBeginningOp(IList<IWaterMeter> waterMeters);
IOperation ShowFormAtCycleEndOp(IList<IWaterMeter> waterMeters);
}
}
@@ -0,0 +1,12 @@
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface IDiverter : IComponent
{
/// <summary>
/// Diverter state: true = to tank, false = bypass tank
/// </summary>
bool State { get; }
}
}
@@ -0,0 +1,36 @@
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
/// <summary>
/// Basic flow meter functions
/// </summary>
public interface IFlowMeter : IComponent
{
/// <summary>
/// Nominal flow @2kHz output frequency in m3
/// </summary>
float NominalFlow { get; }
/// <summary>
/// Measurement correction table
/// </summary>
IList<Entities.MeasurementCorrection> Corrections { get; }
/// <summary>
/// Events: FlowDone, Error
/// </summary>
/// <param name="flow">Reference to a variable for the measured flow in xxx</param>
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
IOperation ReadFlowOp(ref FloatBox flow);
/// <summary>
/// Events: flowDone, Error
/// </summary>
/// <param name="flow">Reference to a variable for the measured flow in xxx</param>
/// <param name="flowDone">Event returned when measurement done</param>
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
IOperation ReadFlowOp(ref FloatBox flow, Event flowDone);
}
}
@@ -0,0 +1,8 @@
namespace TBF.BenchControl.GenericDevices
{
interface IHasCompleted
{
bool Completed { get; }
}
}
@@ -0,0 +1,8 @@
namespace TBF.BenchControl.GenericDevices
{
public interface IHasProtocolTitle
{
string ProtocolTitle { get; }
}
}
@@ -0,0 +1,31 @@
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
/// <summary>
/// Basic pressure meter functions
/// </summary>
public interface IPressureMeter : IComponent
{
/// <summary>
/// Measurement correction table
/// </summary>
IList<Entities.MeasurementCorrection> Corrections { get; }
/// <summary>
/// Events: PressureDone, Error
/// </summary>
/// <param name="pressure">Reference to a variable for the measured pressure in bar</param>
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
IOperation ReadPressureOp(ref FloatBox pressure);
/// <summary>
/// Events: pressureDone, Error
/// </summary>
/// <param name="pressure">Reference to a variable for the measured pressure in bar</param>
/// <param name="pressureDone">Event returned when measurement done</param>
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
IOperation ReadPressureOp(ref FloatBox pressure, Event pressureDone);
}
}
@@ -0,0 +1,12 @@
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface IPump : IComponent
{
/// <summary>
/// Pump state: true = on, false = off
/// </summary>
bool State { get; }
}
}
@@ -0,0 +1,21 @@
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
/// <summary>
/// A pump controlled by a frequency inverter
/// using the test parameter 'Power' (0 .. 100.0f %)
/// </summary>
public interface IPumpFM : IPump
{
/// <summary>
/// Turns the frequency inverter on using the test parameter 'Power' (0 .. 100.0f %)
/// </summary>
IOperation TurnOn();
/// <summary>
/// Turns the frequency inverter off
/// </summary>
IOperation TurnOff();
}
}
@@ -0,0 +1,12 @@
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface IRegisterReader : IComponent
{
float PulsesPerLtr { get; }
IOperation ReadRegisterOp(ref IntBox pulses);
IOperation ReadRegisterOp(ref IntBox pulses, ref IntBox refPulses);
IOperation ReadReferenceForRegisterOp(ref IntBox pulses, ref IntBox refPulses);
}
}
@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface IRegulValve : IComponent
{
IDictionary<float, float> Dict { get; }
/// <summary>
/// Operation to set the water flow within tolerances
/// Events: Event.None, Event.FlowReached, Event.FlowTimeOut
/// </summary>
/// <param name="requiredFlowLo">Lower limit of the required flow [m3/h]</param>
/// <param name="requiredFlowHi">Higher limit of the required flow [m3/h]</param>
/// <param name="measuredFlow">Measured flow [m3/h]</param>
/// <param name="timeout">Timeout in [s]</param>
/// <returns>SetFlowOp instance</returns>
IOperation SetFlowOp(IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, FloatBox measuredFlow, int timeout);
/// <summary>
/// Operation to set the water flow within tolerances. Leave the measurement running.
/// Events: Event.None, Event.FlowReached, Event.FlowTimeOut
/// </summary>
/// <param name="requiredFlowLo">Lower limit of the required flow [m3/h]</param>
/// <param name="requiredFlowHi">Higher limit of the required flow [m3/h]</param>
/// <param name="measuredFlow">Measured flow [m3/h]</param>
/// <param name="timeout">Timeout in [s]</param>
/// <returns>SetFlowOp instance</returns>
IOperation SetFlowAndMeasureOp(IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, FloatBox measuredFlow, int timeout);
/// <summary>
/// Operation to set the regulation valve to a required position
/// Events: Event.None
/// </summary>
/// <param name="posLoPct">Lower limit of the required valve position in %</param>
/// <param name="posHiPct">Higher limit of the required valve position in %</param>
/// <param name="timeout">Timeout in [s]</param>
/// <returns>SetPositionOp instance</returns>
IOperation SetRegulValvePositionOp(float posLoPct, float posHiPct, int timeout);
/// <summary>
/// Operation to set the regulation valve to a required position
/// Events: Event.None
/// </summary>
/// <param name="timePulseSec">Time pulse in sec</param>
/// <returns>SetPositionOp instance</returns>
IOperation ChangeRegulValvePositionOp(float timePulseSec);
}
}
@@ -0,0 +1,18 @@
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface IResultsPrinter : IComponent
{
/// <summary>
/// Prints the test cycle results, Events: Event.ResultsPrinted
/// </summary>
/// <param name="results">Results to print</param>
/// <returns>Reference to the operation</returns>
IOperation PrintResultsOp(BenchControl.BenchId.Component benchId,
IList<IWaterMeter> waterMeters,
IList<Entities.TestResult> results,
string title);
}
}
@@ -0,0 +1,15 @@
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface IResultsWriter : IComponent
{
/// <summary>
/// Writes the test cycle results into a file, Events: Event.ResultsWritten
/// </summary>
/// <param name="results">Results to write into a file</param>
/// <returns>Reference to the operation</returns>
IOperation WriteResultsOp(IList<Entities.TestResult> results);
}
}
@@ -0,0 +1,24 @@
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
/// <summary>
/// Basic temperature meter functions
/// </summary>
public interface ITempMeter : IComponent
{
/// <summary>
/// Events: TempDone, Error
/// </summary>
/// <param name="temp">Reference to a variable for the temperature in Celsius</param>
/// <returns>ReadTempInOp instance reference casted to IOperaton</returns>
IOperation ReadTempOp(ref FloatBox temp);
/// <summary>
/// Events: tempDone, Error
/// </summary>
/// <param name="temp">Reference to a variable for the temperature in Celsius</param>
/// <returns>ReadTempInOp instance reference casted to IOperaton</returns>
IOperation ReadTempOp(ref FloatBox temp, Event tempDone);
}
}
@@ -0,0 +1,9 @@
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface ITestMethod : IComponent, ISequence
{
}
}
@@ -0,0 +1,37 @@
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface IValve : IComponent
{
/// <summary>
/// Valve state: true = open, false = closed
/// </summary>
bool State { get; }
/// <summary>
/// Coupled valve or null.
/// This valve is a slave and follows the coupled valve, which is a master.
/// In case of CoupledValve == null, this valve can be independently controlled.
/// </summary>
IValve CoupledTo { get; }
/// <summary>
/// The coupled valve is inverted referred to the master valve.
/// This property is used only in case 'CoupledTo' is non-null.
/// </summary>
bool Invert { get; }
/// <summary>
/// Delay (referred to the master valve) when opening this (coupled, slave) valve in [s]
/// This property is used only in case 'CoupledTo' is non-null.
/// </summary>
int LagOpening { get; }
/// <summary>
/// Delay (referred to the master valve) when opening this (coupled, slave) valve in [s]
/// This property is used only in case 'CoupledTo' is non-null.
/// </summary>
int LagClosing { get; }
}
}
@@ -0,0 +1,25 @@
using System.Collections.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface IValveControl
{
/// <summary>
/// Open one valve and/or close one valve.
/// Events: RouteDone, Error
/// </summary>
/// <param name="valveToOpen">Valve to be opened</param>
/// <param name="valveToClose">Valve to be closed</param>
/// <returns>Newly created operation instance reference casted to IOperaton</returns>
IOperation SetValvesOp(IValve valveToOpen, IValve valveToClose);
/// <summary>
/// Open and/or close multiple valves.
/// Events: RouteDone, Error
/// </summary>
/// <param name="valvesToOpen">A list of valves to be opened</param>
/// <param name="valvesToClose">A list of valves to be closed</param>
/// <returns>Newly created operation instance reference casted to IOperaton</returns>
IOperation SetValvesOp(IList<IValve> valvesToOpen, IList<IValve> valvesToClose);
}
}
@@ -0,0 +1,14 @@
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface IWaterMeter : IComponent
{
string Producer { get; }
float Qn { get; }
string ApprovalInfo { get; }
string MetrologicalClass { get; }
string SerialNr { get; set; }
string State { get; set; }
}
}
@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TBF.BenchControl.GenericDevices
{
public class ValveBase
{
/// <summary>
/// Process the list of components and return all valves (masters and coupled)
/// </summary>
public static IList<IValve> AllValves(IList<Generic.IComponent> cmpnts)
{
IList<IValve> result = new List<IValve>();
foreach (var cmpnt in cmpnts) if (cmpnt is IValve) result.Add(cmpnt as IValve);
return result;
}
/// <summary>
/// Process the list of components and return the masters valves
/// </summary>
public static IList<IValve> MasterValves(IList<Generic.IComponent> cmpnts)
{
IList<IValve> result = new List<IValve>();
foreach (var cmpnt in cmpnts)
{
IValve valve = cmpnt as IValve;
if (valve != null && valve.CoupledTo == null) result.Add(valve);
}
return result;
}
/// <summary>
/// Process the list of components and return the coupled valves
/// </summary>
public static IList<IValve> CoupledValves(IList<Generic.IComponent> cmpnts)
{
IList<IValve> result = new List<IValve>();
foreach (var cmpnt in cmpnts)
{
IValve valve = cmpnt as IValve;
if (valve != null && valve.CoupledTo != null) result.Add(valve);
}
return result;
}
public static IList<IValve> MakeList(IValve valve)
{
IList<IValve> result = new List<IValve>();
if (valve != null) result.Add(valve);
return result;
}
public static IList<IValve> Merge(IList<IValve> valves1, IList<IValve> valves2)
{
IList<IValve> result = new List<IValve>();
if (valves1 != null) foreach (var valve in valves1) result.Add(valve);
if (valves2 != null) foreach (var valve in valves2) result.Add(valve);
return result;
}
public static IList<IValve> Merge(IList<IValve> valves1, IList<IValve> valves2, IList<IValve> valves3)
{
IList<IValve> result = new List<IValve>();
if (valves1 != null) foreach (var valve in valves1) result.Add(valve);
if (valves2 != null) foreach (var valve in valves2) result.Add(valve);
if (valves3 != null) foreach (var valve in valves3) result.Add(valve);
return result;
}
}
}