Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0dc707032d | ||
|
|
2463a19af7 | ||
|
|
ce556762c7 |
+32
-2
@@ -4,6 +4,10 @@ Config/bin/
|
||||
Config/obj/
|
||||
DataStreamInterface/bin/
|
||||
DataStreamInterface/obj/
|
||||
DataStreamInterfaceTest/bin/
|
||||
DataStreamInterfaceTest/obj/
|
||||
DataStreamMeter/bin/
|
||||
DataStreamMeter/obj/
|
||||
Decrypt/bin/
|
||||
Decrypt/obj/
|
||||
DeviceTest/bin/
|
||||
@@ -16,12 +20,16 @@ EventViewer/bin/
|
||||
EventViewer/obj/
|
||||
Events/bin/
|
||||
Events/obj/
|
||||
FeatureVectorCalculator/bin/
|
||||
FeatureVectorCalculator/obj/
|
||||
GemCard/bin
|
||||
GemCard/obj
|
||||
GenCode128/bin
|
||||
GenCode128/obj
|
||||
GraphLib/bin
|
||||
GraphLib/obj
|
||||
MergeResultsDBs/bin
|
||||
MergeResultsDBs/obj
|
||||
TracingDB/bin
|
||||
TracingDB/obj
|
||||
ResetBatchNr/bin
|
||||
@@ -32,8 +40,8 @@ Results/bin/
|
||||
Results/obj/
|
||||
ResultsBrowser/bin/
|
||||
ResultsBrowser/obj/
|
||||
SchematicDrawing/bin
|
||||
SchematicDrawing/obj
|
||||
ResultsParser/bin/
|
||||
ResultsParser/obj/
|
||||
Statistics/bin/
|
||||
Statistics/obj/
|
||||
TBF/bin/
|
||||
@@ -46,6 +54,28 @@ Users/bin/
|
||||
Users/obj/
|
||||
UserManagement/bin/
|
||||
UserManagement/obj/
|
||||
DataMatrix4Net/bin/
|
||||
DataMatrix4Net/obj/
|
||||
GenericTest/bin/
|
||||
GenericTest/obj/
|
||||
LabelPrinting/bin/
|
||||
LabelPrinting/obj/
|
||||
OrderManagement/bin/
|
||||
OrderManagement/obj/
|
||||
ProductionTracing/bin/
|
||||
ProductionTracing/obj/
|
||||
RecordProcessing/bin/
|
||||
RecordProcessing/obj/
|
||||
S640TestApp/bin/
|
||||
S640TestApp/obj/
|
||||
SchematicDrawing/bin/
|
||||
SchematicDrawing/obj/
|
||||
SharedDatabase/bin/
|
||||
SharedDatabase/obj/
|
||||
WorkflowConfigurator/bin/
|
||||
WorkflowConfigurator/obj/
|
||||
Workplace/bin/
|
||||
Workplace/obj/
|
||||
.vs/
|
||||
*.suo
|
||||
*.bak
|
||||
|
||||
+7
-1
@@ -62,12 +62,18 @@ namespace Config
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = 1;
|
||||
#elif ALZIR_25 || BAHRAIN_50 || CEVAK_40 || FEWA_50 || FILIPINY_50 || FUZHOU_50 || IZRAEL_25 || JUZNA_AFRIKA_50 || JUZNA_AFRIKA_NEW || KEMPNO_50 || KRAKOW_50 || MURES_40 || PETERSBURG_50 || TORUN_50 || ZAMBIA || ZODINO
|
||||
#elif ALZIR_25 || BAHRAIN_50 || CEVAK_40 || FEWA_50 || FILIPINY_50 || FUZHOU_50 || IZRAEL_25 || JUZNA_AFRIKA_50 || KEMPNO_50 || KRAKOW_50 || MURES_40 || PETERSBURG_50 || TORUN_50 || ZAMBIA || ZODINO
|
||||
public const int WMsCount = 20;
|
||||
public const int LineSize = 10;
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = WMsCount / LineSize;
|
||||
#elif JUZNA_AFRIKA_NEW
|
||||
public const int WMsCount = 26;
|
||||
public const int LineSize = 13;
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = WMsCount / LineSize;
|
||||
#elif RUM_MOB
|
||||
public const int WMsCount = 8;
|
||||
public const int LineSize = 8;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DataStreamInterface</RootNamespace>
|
||||
<AssemblyName>DataStreamInterface</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
|
||||
@@ -5,6 +5,8 @@ namespace SchematicDrawing
|
||||
{
|
||||
public interface IDrawingItCmpntWithMeasuredVal : IDrawingItCmpnt
|
||||
{
|
||||
bool MsrmntAvailable { get; }
|
||||
double MeasuredVal { get; }
|
||||
string AltString { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,16 @@ namespace SchematicDrawing
|
||||
get { return route; }
|
||||
}
|
||||
|
||||
///
|
||||
/// Measurement available flags
|
||||
///
|
||||
private bool[] msrmntAvailableFlags;
|
||||
public bool[] MsrmntAvailableFlags
|
||||
{
|
||||
set { if (msrmntAvailableFlags != value) { msrmntAvailableFlags = value; Redraw(); } }
|
||||
get { return msrmntAvailableFlags; }
|
||||
}
|
||||
|
||||
///
|
||||
/// Measured values
|
||||
///
|
||||
@@ -84,6 +94,16 @@ namespace SchematicDrawing
|
||||
get { return measuredValues; }
|
||||
}
|
||||
|
||||
///
|
||||
/// Alternative strings
|
||||
///
|
||||
private string[] altStrings;
|
||||
public string[] AltStrings
|
||||
{
|
||||
set { if (altStrings != value) { altStrings = value; Redraw(); } }
|
||||
get { return altStrings; }
|
||||
}
|
||||
|
||||
///
|
||||
/// Setpoints
|
||||
///
|
||||
@@ -300,6 +320,8 @@ namespace SchematicDrawing
|
||||
Font measuredValueFont;
|
||||
Brush measuredValueBrush;
|
||||
Brush measuredValueBackColor;
|
||||
Brush measuredValueOoRBackColor;
|
||||
Brush measuredValueErrorBackColor;
|
||||
///
|
||||
Font setpointFont;
|
||||
Brush setpointBrush;
|
||||
@@ -429,6 +451,8 @@ namespace SchematicDrawing
|
||||
measuredValueFont = new Font("Arial", 10, FontStyle.Regular);
|
||||
measuredValueBrush = Brushes.Black;
|
||||
measuredValueBackColor = new SolidBrush(Color.LightGreen);
|
||||
measuredValueOoRBackColor = new SolidBrush(Color.Orange);
|
||||
measuredValueErrorBackColor = new SolidBrush(Color.Red);
|
||||
|
||||
/// Font for drawing setpoints
|
||||
setpointFont = new Font("Arial", 10, FontStyle.Regular);
|
||||
@@ -652,23 +676,11 @@ namespace SchematicDrawing
|
||||
if (item is IDrawingItemWithMeasuredVal)
|
||||
{
|
||||
IDrawingItemWithMeasuredVal itm = item as IDrawingItemWithMeasuredVal;
|
||||
double msrdVal = Config.Units.ConvertTo(itm.MsrdUnits, measuredValues[msrdValIx++]);
|
||||
if (!Utils.IsHidden(item))
|
||||
bool msrmntAvailable = msrmntAvailableFlags[msrdValIx];
|
||||
double msrdVal = Config.Units.ConvertTo(itm.MsrdUnits, measuredValues[msrdValIx]);
|
||||
|
||||
if ((msrmntAvailable || EditMode) && !Utils.IsHidden(item))
|
||||
{
|
||||
string strVal = string.IsNullOrEmpty(itm.MsrdFormat) ? msrdVal.ToString() : string.Format(itm.MsrdFormat, msrdVal);
|
||||
SizeF size = e.Graphics.MeasureString(strVal, measuredValueFont);
|
||||
Rectangle rect = new Rectangle(itm.X + itm.MsrdX, itm.Y + itm.MsrdY, (int)Math.Round(size.Width) + 4, (int)Math.Round(size.Height) + 2);
|
||||
ItemElementRectangles.Add(new ItemElementRect(item, Element.MeasuredVal, rect));
|
||||
e.Graphics.FillRectangle(measuredValueBackColor, rect);
|
||||
e.Graphics.DrawRectangle(thinBlackPen, rect);
|
||||
e.Graphics.DrawString(strVal, measuredValueFont, measuredValueBrush, rect.X + 2, rect.Y + 2);
|
||||
|
||||
if (EditMode && (item == selectedItem) && (selectedElement == Element.MeasuredVal))
|
||||
{
|
||||
/// Draw red rectangle around the selected item label
|
||||
e.Graphics.DrawRectangle(selectedRectPen, rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2);
|
||||
}
|
||||
|
||||
/// Paint water in the tank on a scale
|
||||
DrawingShape dshape = DrawingShape.GetDrawingShape(item.Shape, item.Sz);
|
||||
if (dshape.Shape == Shape.Scale)
|
||||
@@ -677,7 +689,31 @@ namespace SchematicDrawing
|
||||
int level = (int)Math.Round((r.Height - 2) * msrdVal / itm.MsrdValLimHi);
|
||||
e.Graphics.FillRectangle(brushWater, r.X + 2, r.Y + r.Height - 2 - level, r.Width - 4, level);
|
||||
}
|
||||
|
||||
string strVal = string.IsNullOrEmpty(itm.MsrdFormat) ? msrdVal.ToString() : string.Format(itm.MsrdFormat, msrdVal);
|
||||
SizeF size = e.Graphics.MeasureString(strVal, measuredValueFont);
|
||||
Rectangle rect = new Rectangle(itm.X + itm.MsrdX, itm.Y + itm.MsrdY, (int)Math.Round(size.Width) + 4, (int)Math.Round(size.Height) + 2);
|
||||
ItemElementRectangles.Add(new ItemElementRect(item, Element.MeasuredVal, rect));
|
||||
|
||||
if (measuredValues[msrdValIx] >= itm.MsrdValLimLo && measuredValues[msrdValIx] <= itm.MsrdValLimHi)
|
||||
{
|
||||
e.Graphics.FillRectangle(measuredValueBackColor, rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Graphics.FillRectangle(measuredValueOoRBackColor, rect);
|
||||
}
|
||||
|
||||
e.Graphics.DrawRectangle(thinBlackPen, rect);
|
||||
e.Graphics.DrawString(strVal, measuredValueFont, measuredValueBrush, rect.X + 2, rect.Y + 2);
|
||||
|
||||
if (EditMode && (item == selectedItem) && (selectedElement == Element.MeasuredVal))
|
||||
{
|
||||
/// Draw red rectangle around the selected item label
|
||||
e.Graphics.DrawRectangle(selectedRectPen, rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2);
|
||||
}
|
||||
}
|
||||
msrdValIx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,15 +143,25 @@ namespace TBF.BenchControl.ControlBoard.Papouch
|
||||
}
|
||||
|
||||
///
|
||||
/// Collect measured values
|
||||
/// Collect measured values and alternative strings
|
||||
///
|
||||
if (ProcessData.MeasuredValues == null || ProcessData.Setpoints.Length != ProcessData.ComponentsWithMeasuredVal.Count)
|
||||
if (ProcessData.MsrmntAvailableFlags == null || ProcessData.MsrmntAvailableFlags.Length != ProcessData.ComponentsWithMeasuredVal.Count)
|
||||
{
|
||||
ProcessData.MsrmntAvailableFlags = new bool[ProcessData.ComponentsWithMeasuredVal.Count];
|
||||
}
|
||||
if (ProcessData.MeasuredValues == null || ProcessData.MeasuredValues.Length != ProcessData.ComponentsWithMeasuredVal.Count)
|
||||
{
|
||||
ProcessData.MeasuredValues = new double[ProcessData.ComponentsWithMeasuredVal.Count];
|
||||
}
|
||||
if (ProcessData.AltStrings == null || ProcessData.AltStrings.Length != ProcessData.ComponentsWithMeasuredVal.Count)
|
||||
{
|
||||
ProcessData.AltStrings = new string[ProcessData.ComponentsWithMeasuredVal.Count];
|
||||
}
|
||||
for (int i = 0; i < ProcessData.ComponentsWithMeasuredVal.Count; i++)
|
||||
{
|
||||
ProcessData.MsrmntAvailableFlags[i] = ProcessData.ComponentsWithMeasuredVal[i].MsrmntAvailable;
|
||||
ProcessData.MeasuredValues[i] = ProcessData.ComponentsWithMeasuredVal[i].MeasuredVal;
|
||||
ProcessData.AltStrings[i] = ProcessData.ComponentsWithMeasuredVal[i].AltString;
|
||||
}
|
||||
|
||||
///
|
||||
@@ -166,7 +176,8 @@ namespace TBF.BenchControl.ControlBoard.Papouch
|
||||
ProcessData.Setpoints[i] = ProcessData.ComponentsWithSetpoint[i].SetpointVal;
|
||||
}
|
||||
|
||||
TBF.UiBridge.Bridge.OnStateMachineTick(this, new TBF.UiBridge.StateMachineTickEventArgs(benchModelRoute, ProcessData.MeasuredValues, ProcessData.Setpoints));
|
||||
TBF.UiBridge.Bridge.OnStateMachineTick(this, new TBF.UiBridge.StateMachineTickEventArgs(benchModelRoute, ProcessData.MsrmntAvailableFlags, ProcessData.MeasuredValues,
|
||||
ProcessData.AltStrings, ProcessData.Setpoints));
|
||||
}
|
||||
|
||||
public void StopDevice()
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using SchematicDrawing;
|
||||
using TBF.Boxes;
|
||||
using TBF.BenchControl.Sequences;
|
||||
|
||||
namespace TBF.BenchControl.Dummy.FlowMeter
|
||||
{
|
||||
public class FlowMeter : ComponentBase, GenericDevices.IFlowMeter, IDrawingItCmpnt
|
||||
public class FlowMeter : ComponentBase, GenericDevices.IFlowMeter, IDrawingItCmpntWithMeasuredVal
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(FlowMeter));
|
||||
public override string ToString() { return string.Format("FlowMeter({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly FlowMeterCfg flowMeterCfg;
|
||||
public IDrawingItem DrawingItem { get { return flowMeterCfg as IDrawingItem; } }
|
||||
readonly FlowMeterCfg myCfg;
|
||||
public IDrawingItem DrawingItem { get { return myCfg as IDrawingItem; } }
|
||||
|
||||
public double NominalFlow { get { return flowMeterCfg.NominalFlow; } }
|
||||
public double NominalFlow { get { return myCfg.NominalFlow; } }
|
||||
|
||||
public double LtrPerPulse { get { return flowMeterCfg.NominalFlow / 7200.0f; } }
|
||||
public double LtrPerPulse { get { return myCfg.NominalFlow / 7200.0f; } }
|
||||
|
||||
public double LtrPerPulseCorrected(double flow, int rangeIx)
|
||||
{
|
||||
@@ -28,22 +29,31 @@ namespace TBF.BenchControl.Dummy.FlowMeter
|
||||
|
||||
public int Idx1 { get { return 1; } }
|
||||
|
||||
public bool MsrmntAvailable { get { return ProcessData.Devices != null && ProcessData.Devices.FlowMeter == this && ReadFlow() > 0; } }
|
||||
public string AltString { get { return string.Empty; } }
|
||||
public double MeasuredVal
|
||||
{
|
||||
get { return (ProcessData.Devices != null && ProcessData.Devices.FlowMeter == this) ? ReadFlow() : 0; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public FlowMeter()
|
||||
{
|
||||
}
|
||||
public double MsrdValLimLo { get { return myCfg.MsrdValLimLo; } set { myCfg.MsrdValLimLo = value; } }
|
||||
public double MsrdValLimHi { get { return myCfg.MsrdValLimHi; } set { myCfg.MsrdValLimHi = value; } }
|
||||
|
||||
|
||||
public FlowMeter() { }
|
||||
|
||||
public FlowMeter(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
flowMeterCfg = cfg as FlowMeterCfg;
|
||||
myCfg = cfg as FlowMeterCfg;
|
||||
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
|
||||
public double ReadFlow() { return 1.23; }
|
||||
public double ReadFrequency() { return 1.23 * 2000.0 / (double)NominalFlow; }
|
||||
public double ReadFlow() { return ProcessData.FlowFromMassIncrease; }
|
||||
public double ReadFrequency() { return ProcessData.FlowFromMassIncrease * 2000.0 / (double)NominalFlow; }
|
||||
|
||||
/// <summary>
|
||||
/// Events: FlowDone, Error
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -10,7 +10,7 @@ using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Dummy.FlowMeter
|
||||
{
|
||||
public class FlowMeterCfg : ComponentCfgBase, IComponentCfg, IDrawingItem
|
||||
public class FlowMeterCfg : ComponentCfgBase, IComponentCfg, IDrawingItemWithMeasuredVal
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(FlowMeterCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
@@ -32,8 +32,21 @@ namespace TBF.BenchControl.Dummy.FlowMeter
|
||||
public int LblY { get; set; }
|
||||
public Orient LblOrient { get; set; }
|
||||
|
||||
public int MsrdX { get; set; }
|
||||
public int MsrdY { get; set; }
|
||||
public Orient MsrdOrient { get; set; }
|
||||
public string MsrdFormat { get; set; }
|
||||
public Config.Unit MsrdUnits { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
[XmlIgnore]
|
||||
public double MsrdValLimLo { get { return msrdValLimLo; } set { msrdValLimLo = value; } }
|
||||
[XmlIgnore]
|
||||
public double MsrdValLimHi { get { return msrdValLimHi; } set { msrdValLimHi = value; } }
|
||||
|
||||
double msrdValLimLo;
|
||||
double msrdValLimHi;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
FlowMeterCfg()
|
||||
@@ -46,14 +59,14 @@ namespace TBF.BenchControl.Dummy.FlowMeter
|
||||
{
|
||||
Shape = Shape.FlowM;
|
||||
Sz = Sz.M;
|
||||
MsrdFormat = "{0:F4}";
|
||||
MsrdUnits = Config.Unit.kg;
|
||||
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
NominalFlow = 1.0f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("{0} {1}[{2},{3}] NominalFlow={4}", Name, Shape, X, Y, NominalFlow);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
@@ -41,7 +41,8 @@ namespace TBF.BenchControl.Dummy.FlowMeter
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
}
|
||||
if (flowBox != null) flowBox.Val = flowMeter.ReadFlow();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
|
||||
@@ -48,8 +48,8 @@ namespace TBF.BenchControl.Elde.TempMeter
|
||||
public Orient MsrdOrient { get; set; }
|
||||
public Config.Unit MsrdUnits { get; set; }
|
||||
public string MsrdFormat { get; set; }
|
||||
public double MsrdValLimLo { get; set; }
|
||||
public double MsrdValLimHi { get; set; }
|
||||
public double MsrdValLimLo { get { return 5.0; } set { } }
|
||||
public double MsrdValLimHi { get { return 95.0; } set { } }
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
[XmlIgnore]
|
||||
public double MsrdValLimLo { get { return 0; } set { } }
|
||||
[XmlIgnore]
|
||||
public double MsrdValLimHi { get { return Capacity; } set { Capacity = (float)value; } }
|
||||
public double MsrdValLimHi { get { return Capacity; } set { } }
|
||||
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
|
||||
@@ -81,6 +81,8 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// <summary>The mass after StartMassMeasurement() when MsrmntState == MsrmntState.Valid</summary>
|
||||
public double Mass { get { return mass; } }
|
||||
protected double mass;
|
||||
public bool MsrmntAvailable { get { return true; } }
|
||||
public string AltString { get { return string.Empty; } }
|
||||
public double MeasuredVal
|
||||
{
|
||||
get { return mass; }
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace TBF.BenchControl.Modbus.Meret.PressureMeter
|
||||
|
||||
readonly GenericDevices.IModbus modbus;
|
||||
double receivedPressure;
|
||||
public bool MsrmntAvailable { get { return true; } }
|
||||
public string AltString { get { return string.Empty; } }
|
||||
public double MeasuredVal
|
||||
{
|
||||
get { return receivedPressure; }
|
||||
|
||||
@@ -36,8 +36,8 @@ namespace TBF.BenchControl.Modbus.Meret.PressureMeter
|
||||
public Orient MsrdOrient { get; set; }
|
||||
public Config.Unit MsrdUnits { get; set; }
|
||||
public string MsrdFormat { get; set; }
|
||||
public double MsrdValLimLo { get; set; }
|
||||
public double MsrdValLimHi { get; set; }
|
||||
public double MsrdValLimLo { get { return -0.1; } set { } }
|
||||
public double MsrdValLimHi { get { return 25.0; } set { } }
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace TBF.BenchControl.Modbus.Meret.TempMeter
|
||||
|
||||
readonly GenericDevices.IModbus modbus;
|
||||
double receivedTemp;
|
||||
public bool MsrmntAvailable { get { return true; } }
|
||||
public string AltString { get { return string.Empty; } }
|
||||
public double MeasuredVal
|
||||
{
|
||||
get { return receivedTemp; }
|
||||
|
||||
@@ -36,8 +36,8 @@ namespace TBF.BenchControl.Modbus.Meret.TempMeter
|
||||
public Orient MsrdOrient { get; set; }
|
||||
public Config.Unit MsrdUnits { get; set; }
|
||||
public string MsrdFormat { get; set; }
|
||||
public double MsrdValLimLo { get; set; }
|
||||
public double MsrdValLimHi { get; set; }
|
||||
public double MsrdValLimLo { get { return 5.0; } set { } }
|
||||
public double MsrdValLimHi { get { return 95.0; } set { } }
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
|
||||
@@ -44,7 +44,12 @@ namespace TBF.BenchControl.RegisterReaders.StandingStartStop
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
}
|
||||
if (cmpnt.ClassName.Contains("ControlBoard"))
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Redraw();
|
||||
|
||||
@@ -27,9 +27,18 @@ namespace TBF.BenchControl.Sequences
|
||||
///
|
||||
/// Measured values and setpoints to be displayed
|
||||
///
|
||||
public static bool[] MsrmntAvailableFlags;
|
||||
public static double[] MeasuredValues;
|
||||
public static string[] AltStrings;
|
||||
public static double[] Setpoints;
|
||||
|
||||
///
|
||||
/// Devices used by the currently running test
|
||||
///
|
||||
protected static BenchControl.BenchPath benchPath;
|
||||
protected static BenchControl.OutputPath outPath;
|
||||
public static BenchControl.OutputPath Devices { get { return outPath; } }
|
||||
|
||||
///
|
||||
/// State variables to be saved after each completed test
|
||||
///
|
||||
@@ -206,6 +215,7 @@ namespace TBF.BenchControl.Sequences
|
||||
public static DoubleBox Mass = new DoubleBox() { Name = "Mass", Format = "F3" }; /// [kg]
|
||||
public static DoubleBox StartMass = new DoubleBox() { Name = "Start Mass", Format = "F3" }; /// [kg]
|
||||
public static DoubleBox EndMass = new DoubleBox() { Name = "End Mass", Format = "F3" }; /// [kg]
|
||||
public static double FlowFromMassIncrease;
|
||||
|
||||
public static DateTime TestStartTime;
|
||||
public static DateTime TestEndTime;
|
||||
@@ -252,6 +262,7 @@ namespace TBF.BenchControl.Sequences
|
||||
public static Statistics PressDeltaStat = new Statistics(3, 4, true);
|
||||
public static Statistics ConductStat = new Statistics(0, 4, true, new Plotter("Conductivity"));
|
||||
public static Statistics RefFlowStat = new Statistics(5, 7, true, new Plotter("Flow"));
|
||||
public static Statistics MassStat = new Statistics(0, 7, false, new Plotter("Mass"));
|
||||
|
||||
public static Statistics TempRefHiStat = new Statistics();
|
||||
public static Statistics TempRefLoStat = new Statistics();
|
||||
@@ -283,8 +294,9 @@ namespace TBF.BenchControl.Sequences
|
||||
PressDeltaStat.Start(batchNr, testName, repetition, skippedSamplesCount);
|
||||
ConductStat.Start (batchNr, testName, repetition, skippedSamplesCount);
|
||||
RefFlowStat.Start (batchNr, testName, repetition, skippedSamplesCount);
|
||||
|
||||
TempRefHiStat.Start (batchNr, testName, repetition);
|
||||
MassStat.Start (batchNr, testName, repetition, skippedSamplesCount);
|
||||
|
||||
TempRefHiStat.Start(batchNr, testName, repetition);
|
||||
TempRefLoStat.Start (batchNr, testName, repetition);
|
||||
Energy.Start (batchNr, testName, repetition);
|
||||
VolumeForEnergy.Start(batchNr, testName, repetition);
|
||||
@@ -309,6 +321,10 @@ namespace TBF.BenchControl.Sequences
|
||||
ConductStat.Update(Conductivity);
|
||||
RefFlowStat.Update(RefFlow);
|
||||
|
||||
double massIncreasePerSec;
|
||||
MassStat.Update(Mass, out massIncreasePerSec);
|
||||
FlowFromMassIncrease = 3600 * massIncreasePerSec / Config.Formulas.DistilledWaterDensityFromTemp(TempDiv.Val);
|
||||
|
||||
if (BatchRslts.Batch.HeatMeter)
|
||||
{
|
||||
TempRefHiStat.Update((TempRefHi1.Val + TempRefHi2.Val) / 2);
|
||||
@@ -333,6 +349,8 @@ namespace TBF.BenchControl.Sequences
|
||||
PressDeltaStat.Stop();
|
||||
ConductStat.Stop();
|
||||
RefFlowStat.Stop();
|
||||
MassStat.Stop();
|
||||
FlowFromMassIncrease = 0;
|
||||
|
||||
TempRefHiStat.Stop();
|
||||
TempRefLoStat.Stop();
|
||||
|
||||
@@ -57,8 +57,6 @@ namespace TBF.BenchControl.Sequences
|
||||
/// They persist during all repetitions of the same test
|
||||
///------------------------------------------------------------
|
||||
protected static BenchControl.FeedingPath inPath;
|
||||
protected static BenchControl.BenchPath benchPath;
|
||||
protected static BenchControl.OutputPath outPath;
|
||||
protected static BenchControl.MetersPath sensPath;
|
||||
protected static BenchControl.HeatMetersPath heatMetersPath;
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ namespace TBF.BenchControl.Sequences
|
||||
bool recordingInProgress;
|
||||
double[] fifo;
|
||||
double[] sorted;
|
||||
double first;
|
||||
double[] timeStamps;
|
||||
double first;
|
||||
double last;
|
||||
double min;
|
||||
double max;
|
||||
@@ -46,6 +47,7 @@ namespace TBF.BenchControl.Sequences
|
||||
{
|
||||
fifo = new double[FilterSize];
|
||||
sorted = new double[FilterSize];
|
||||
timeStamps = new double[FilterSize];
|
||||
}
|
||||
|
||||
recordingInProgress = false;
|
||||
@@ -117,6 +119,15 @@ namespace TBF.BenchControl.Sequences
|
||||
Update(box.Val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates statistics
|
||||
/// </summary>
|
||||
/// <param name="value">New boxed value</param>
|
||||
public void Update(TBF.Boxes.DoubleBox box, out double increasePerSecond)
|
||||
{
|
||||
Update(box.Val, out increasePerSecond);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates statistics
|
||||
/// </summary>
|
||||
@@ -126,6 +137,15 @@ namespace TBF.BenchControl.Sequences
|
||||
Update(box.Val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates statistics
|
||||
/// </summary>
|
||||
/// <param name="value">New boxed value</param>
|
||||
public void Update(TBF.Boxes.FloatBox box, out double increasePerSecond)
|
||||
{
|
||||
Update(box.Val, out increasePerSecond);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// All samples are passed to this function
|
||||
/// </summary>
|
||||
@@ -136,22 +156,45 @@ namespace TBF.BenchControl.Sequences
|
||||
{
|
||||
if (totalCount >= skippedSamplesCount)
|
||||
{
|
||||
Process(value);
|
||||
double dummy;
|
||||
Process(value, out dummy, false);
|
||||
}
|
||||
totalCount++;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// All samples are passed to this function
|
||||
/// </summary>
|
||||
/// <param name="value">New value</param>
|
||||
public void Update(double value, out double increasePerSecond)
|
||||
{
|
||||
increasePerSecond = 0;
|
||||
|
||||
if (recordingInProgress)
|
||||
{
|
||||
if (totalCount >= skippedSamplesCount)
|
||||
{
|
||||
Process(value, out increasePerSecond, true);
|
||||
if (FilterSize > 1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
totalCount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Only samples after first 'SkippedSamplesCount' samples are passed to this function.
|
||||
/// Any filtering is done inside this function.
|
||||
/// </summary>
|
||||
/// <param name="value">New value</param>
|
||||
void Process(double value)
|
||||
void Process(double value, out double increasePerSecond, bool calculateIncrease = false)
|
||||
{
|
||||
double filteredValue;
|
||||
if (ApplyFilter(value, out filteredValue))
|
||||
if (ApplyFilter(value, out filteredValue, out increasePerSecond, calculateIncrease))
|
||||
{
|
||||
sum += filteredValue;
|
||||
if (count == 0) first = filteredValue;
|
||||
@@ -172,31 +215,43 @@ namespace TBF.BenchControl.Sequences
|
||||
/// <param name="value">Input value</param>
|
||||
/// <param name="filteredValue">Output filtered value</param>
|
||||
/// <returns>true when 'fileterdValue' is valid</returns>
|
||||
bool ApplyFilter(double value, out double filteredValue)
|
||||
bool ApplyFilter(double value, out double filteredValue, out double increasePerSecond, bool calculateIncrease = false)
|
||||
{
|
||||
increasePerSecond = 0;
|
||||
|
||||
if (FilterSize == 0)
|
||||
{
|
||||
/// No filter => Pass the input value to the output
|
||||
filteredValue = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// Shift values in FIFO buffer, calculate the sum
|
||||
double sum1 = 0;
|
||||
for (int i = FilterSize - 1; i > 0; i--)
|
||||
double sumX = 0;
|
||||
double sumY = 0;
|
||||
double sumXX = 0;
|
||||
double sumXY = 0;
|
||||
for (int i = FilterSize - 1; i > 0; i--)
|
||||
{
|
||||
fifo[i] = fifo[i - 1];
|
||||
sum1 += fifo[i];
|
||||
timeStamps[i] = timeStamps[i - 1];
|
||||
///
|
||||
sumX += timeStamps[i];
|
||||
sumY += fifo[i];
|
||||
sumXX += timeStamps[i] * timeStamps[i];
|
||||
sumXY += timeStamps[i] * fifo[i];
|
||||
}
|
||||
/// Insert the current value into FIFO, add it to the sum
|
||||
fifo[0] = value;
|
||||
sum1 += value;
|
||||
|
||||
timeStamps[0] = Convert.ToDouble(StateMachine.Time);
|
||||
///
|
||||
sumX += timeStamps[0];
|
||||
sumY += fifo[0];
|
||||
sumXX += timeStamps[0] * timeStamps[0];
|
||||
sumXY += timeStamps[0] * fifo[0];
|
||||
|
||||
fifoCount++;
|
||||
|
||||
|
||||
if (fifoCount < FilterSize)
|
||||
{
|
||||
/// FIFO not filled yet => Pass the input value to the output
|
||||
@@ -220,9 +275,18 @@ namespace TBF.BenchControl.Sequences
|
||||
}
|
||||
else
|
||||
{
|
||||
filteredValue = sum1 / FilterSize;
|
||||
filteredValue = sumY / FilterSize;
|
||||
}
|
||||
|
||||
if (calculateIncrease)
|
||||
{
|
||||
double D = FilterSize * sumXX - sumX * sumX;
|
||||
if (D != 0)
|
||||
{
|
||||
increasePerSecond = (FilterSize * sumXY - sumX * sumY) / D;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+13
@@ -102,6 +102,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced
|
||||
new List<Event> { Event.ConfigurationError };
|
||||
}
|
||||
}
|
||||
else if (outPath.FlowMeter is TBF.BenchControl.Dummy.FlowMeter.FlowMeter)
|
||||
{
|
||||
var flowm = outPath.FlowMeter as TBF.BenchControl.Dummy.FlowMeter.FlowMeter;
|
||||
flowm.MsrdValLimLo = test.Qfrom;
|
||||
flowm.MsrdValLimHi = test.Qto;
|
||||
}
|
||||
|
||||
IList<Event> e; /// Events from currently running operations
|
||||
int tMass1 = 0;
|
||||
@@ -1111,6 +1117,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced
|
||||
|
||||
stopTestWOTransitionAfter:
|
||||
|
||||
if (outPath.FlowMeter is TBF.BenchControl.Dummy.FlowMeter.FlowMeter)
|
||||
{
|
||||
var flowm = outPath.FlowMeter as TBF.BenchControl.Dummy.FlowMeter.FlowMeter;
|
||||
flowm.MsrdValLimLo = 0;
|
||||
flowm.MsrdValLimHi = flowm.NominalFlow;
|
||||
}
|
||||
|
||||
return new List<Event> { retVal };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("3.1.1593.0")]
|
||||
[assembly: AssemblyFileVersion("3.1.1593.0")]
|
||||
[assembly: AssemblyVersion("3.0.1637.0")]
|
||||
[assembly: AssemblyFileVersion("3.0.1637.0")]
|
||||
|
||||
@@ -120,7 +120,9 @@ namespace TBF.UI.Bench.EditSchDrawing
|
||||
drawingCtrl.PipesXL = pipesXLcfg.Pipes;
|
||||
|
||||
drawingCtrl.Route = 0;
|
||||
drawingCtrl.MsrmntAvailableFlags = new bool[measuredValuesCount];
|
||||
drawingCtrl.MeasuredValues = new double[measuredValuesCount];
|
||||
drawingCtrl.AltStrings = new string[measuredValuesCount];
|
||||
drawingCtrl.Setpoints = new double[setpointsCount];
|
||||
|
||||
drawingCtrl.SupressRedraws = false;
|
||||
|
||||
+20
-4
@@ -342,9 +342,9 @@ namespace TBF.UI
|
||||
string[] edgesLcfg = null;
|
||||
string[] edgesXLcfg = null;
|
||||
///
|
||||
foreach (var c in cmptnEntities)
|
||||
foreach (var c in BenchControl.StateMachine.Components)
|
||||
{
|
||||
TBF.BenchControl.Generic.IComponentCfg cmpCfg = TBF.BenchControl.TbfComponents.CmpntCfgFromCmpntEntity(c);
|
||||
TBF.BenchControl.Generic.IComponentCfg cmpCfg = c.Cfg;
|
||||
if (cmpCfg is IDrawingItem)
|
||||
{
|
||||
/// Component is an item to be drawn in the schematic drawing and added to the list box
|
||||
@@ -460,13 +460,29 @@ namespace TBF.UI
|
||||
drawingCtrl.SupressRedraws = true;
|
||||
|
||||
drawingCtrl.Route = args.Route;
|
||||
|
||||
|
||||
/// Duplicate measurement available flags
|
||||
if (drawingCtrl.MsrmntAvailableFlags == null || drawingCtrl.MsrmntAvailableFlags.Length != args.MsrmntAvailableFlags.Length)
|
||||
{
|
||||
drawingCtrl.MsrmntAvailableFlags = new bool[args.MsrmntAvailableFlags.Length];
|
||||
}
|
||||
for (int i = 0; i < args.MsrmntAvailableFlags.Length; i++) drawingCtrl.MsrmntAvailableFlags[i] = args.MsrmntAvailableFlags[i];
|
||||
|
||||
/// Duplicate measured values
|
||||
if (drawingCtrl.MeasuredValues == null || drawingCtrl.MeasuredValues.Length != args.MeasuredValues.Length)
|
||||
{
|
||||
drawingCtrl.MeasuredValues = new double[args.MeasuredValues.Length];
|
||||
}
|
||||
for (int i = 0; i < args.MeasuredValues.Length; i++) drawingCtrl.MeasuredValues[i] = args.MeasuredValues[i];
|
||||
|
||||
|
||||
/// Duplicate alternative strings
|
||||
if (drawingCtrl.AltStrings == null || drawingCtrl.AltStrings.Length != args.AltStrings.Length)
|
||||
{
|
||||
drawingCtrl.AltStrings = new string[args.AltStrings.Length];
|
||||
}
|
||||
for (int i = 0; i < args.AltStrings.Length; i++) drawingCtrl.AltStrings[i] = args.AltStrings[i];
|
||||
|
||||
/// Duplicate setpoints
|
||||
if (drawingCtrl.Setpoints == null || drawingCtrl.Setpoints.Length != args.Setpoints.Length)
|
||||
{
|
||||
drawingCtrl.Setpoints = new double[args.Setpoints.Length];
|
||||
|
||||
@@ -9,13 +9,17 @@ namespace TBF.UiBridge
|
||||
public class StateMachineTickEventArgs : EventArgs
|
||||
{
|
||||
public readonly UInt128 Route;
|
||||
public readonly bool[] MsrmntAvailableFlags;
|
||||
public readonly double[] MeasuredValues;
|
||||
public readonly string[] AltStrings;
|
||||
public readonly double[] Setpoints;
|
||||
|
||||
public StateMachineTickEventArgs(UInt128 route, double[] measuredValues, double[] setpoints)
|
||||
public StateMachineTickEventArgs(UInt128 route, bool[] msrmntAvailableFlags, double[] measuredValues, string[] altStrings, double[] setpoints)
|
||||
{
|
||||
Route = route;
|
||||
MsrmntAvailableFlags = msrmntAvailableFlags;
|
||||
MeasuredValues = measuredValues;
|
||||
AltStrings = altStrings;
|
||||
Setpoints = setpoints;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user