Merge branch 'master-3' into PoseidonCmd

# Conflicts:
#	TBF/Properties/AssemblyInfo.cs
This commit is contained in:
Michal Buzik 2025-09-07 22:36:46 +02:00
commit 8f02f4ff31
145 changed files with 12789 additions and 6220 deletions

19
AppDiagnostic/App.config Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<log4net>
<appender name="LogCacheAppender" type="Namespace.LogCacheAppender, AssemblyName">
<param name="Cache" value="YourCacheInstance" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="LogCacheAppender" />
</root>
</log4net>
</configuration>

View File

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FA9ABAD1-7184-4295-ADE8-D44F2E3DE6B2}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>AppDiagnostic</RootNamespace>
<AssemblyName>AppDiagnostic</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=3.0.3.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.3.0.3\lib\net462\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BufferedListView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="DiagApi.cs" />
<Compile Include="LogAdapter.cs" />
<Compile Include="LogFilter.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SharedComponents\SharedComponents.csproj">
<Project>{8f942729-f454-4c99-ba6c-746962065ae3}</Project>
<Name>SharedComponents</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
public class BufferedListView : ListView
{
public BufferedListView()
{
// Zapne dvojité bufferovanie pre ListView
this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
this.UpdateStyles();
}
}

32
AppDiagnostic/DiagApi.cs Normal file
View File

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AppDiagnostic
{
public class DiagApi
{
private static MainForm diagWindow; // Udržiava referenciu na existujúce okno
public DiagApi()
{
if (diagWindow == null || diagWindow.IsDisposed) // Ak okno neexistuje, vytvoríme ho
{
diagWindow = new MainForm();
diagWindow.FormClosing += (s, e) =>
{
diagWindow = null; // Keď sa zavrie, vyčistíme referenciu
};
diagWindow.Show();
}
else
{
diagWindow.BringToFront(); // Ak už beží, len ho presunieme na vrch
diagWindow.WindowState = FormWindowState.Normal; // Ak je minimalizované, obnovíme ho
}
}
}
}

174
AppDiagnostic/LogAdapter.cs Normal file
View File

@ -0,0 +1,174 @@
using SharedComponents;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AppDiagnostic
{
public class LogAdapter
{
private ListView _listView;
public string _filterText = string.Empty;
private bool _isUserScrolling = false; // Indikátor, že používateľ manuálne scrolluje
private bool _autoScrollEnabled = true; // Indikátor, že automatické scrollovanie je povolené
private Timer _refreshTimer;
private const int RefreshInterval = 1000;
public LogAdapter(ListView listView)
{
_listView = listView;
// Nastavenie ListView
_listView.View = View.Details;
_listView.Columns.Clear();
_listView.Columns.Add("Logs");
_listView.Scrollable = true;
// Nastavenie šírky stĺpca na celú šírku ListView
AdjustColumnWidth();
// Udalosť pre dynamickú zmenu veľkosti stĺpca pri zmene veľkosti ListView
_listView.Resize += (sender, args) => AdjustColumnWidth();
// Pridanie udalosti pre manuálne skrolovanie
_listView.MouseWheel += ListView_MouseWheel;
// Inicializácia časovača na pravidelný refresh
_refreshTimer = new Timer { Interval = RefreshInterval };
_refreshTimer.Tick += (sender, args) => RefreshListView();
_refreshTimer.Start();
}
private void ListView_MouseWheel(object sender, MouseEventArgs e)
{
_isUserScrolling = true;
// Ak sa manuálnym scrollovaním používateľ dostane na koniec, obnovíme automatické scrollovanie
if (IsOnLastItem())
{
_isUserScrolling = false;
_autoScrollEnabled = true;
}
else
{
_autoScrollEnabled = false;
}
}
public void RefreshListView()
{
//LiveLogCache.Instance.AddLog(string.Format("-------------------------------RunDeviceAfter()-------------------------------"));
if (_listView.InvokeRequired)
{
_listView.Invoke(new Action(RefreshListView));
return;
}
_listView.BeginUpdate();
try
{
// Získanie pozície prvého viditeľného prvku pre stabilizáciu scrollovania
int topIndexBeforeRefresh = _listView.TopItem?.Index ?? 0;
// Pred pridaním nových položiek si pamätáme, či bol používateľ na poslednej položke
bool wasOnLastItem = IsOnLastItem();
// Uchovanie aktuálne označených položiek (indexov)
var selectedIndices = _listView.SelectedIndices.Cast<int>().ToList();
// Načítanie logov
var logs = LiveLogCache.Instance.GetLogs(0, LiveLogCache.Instance.GetCount())
.Where(log => string.IsNullOrEmpty(_filterText) ||
log.IndexOf(_filterText, StringComparison.OrdinalIgnoreCase) >= 0)
.ToList();
// Vymazanie existujúcich položiek a pridanie nových
_listView.Items.Clear();
foreach (var log in logs)
{
var item = new ListViewItem(log)
{
BackColor = _listView.Items.Count % 2 == 0 ? Color.White : Color.FromArgb(240, 240, 240)
};
_listView.Items.Add(item);
}
// Obnovenie označených položiek
foreach (var index in selectedIndices)
{
if (index < _listView.Items.Count)
{
_listView.Items[index].Selected = true;
}
}
// Ak bol používateľ na poslednom prvku, nastavíme focus a scroll na posledný prvok
if (_autoScrollEnabled && wasOnLastItem && _listView.Items.Count > 0)
{
var lastItemIndex = _listView.Items.Count - 1;
_listView.EnsureVisible(lastItemIndex);
_listView.Items[lastItemIndex].Focused = true;
}
else
{
// Ak používateľ nebol na spodku, vrátime sa na predchádzajúcu pozíciu scrollu
if (topIndexBeforeRefresh < _listView.Items.Count)
{
_listView.TopItem = _listView.Items[topIndexBeforeRefresh];
}
}
}
finally
{
_listView.EndUpdate();
}
}
public void ApplyFilter(string filterText)
{
_filterText = filterText?.Trim() ?? string.Empty;
RefreshListView();
}
private bool IsOnLastItem()
{
if (_listView.Items.Count == 0)
return false;
// Získame poslednú položku
int lastItemIndex = _listView.Items.Count - 1;
var lastItem = _listView.Items[lastItemIndex];
// Overíme, či je posledná položka úplne viditeľná
return lastItem.Bounds.Bottom <= _listView.ClientRectangle.Bottom;
}
public void EnableAutoScroll()
{
_autoScrollEnabled = true;
}
public void DisableAutoScroll()
{
_autoScrollEnabled = false;
}
private void AdjustColumnWidth()
{
if (_listView.Columns.Count > 0)
{
_listView.Columns[0].Width = _listView.ClientSize.Width;
}
}
}
}

View File

@ -0,0 +1,91 @@
using SharedComponents;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AppDiagnostic
{
public class LogFilter
{
private ListView _listView;
private string _filterText = string.Empty; // Pre uloženie aktuálneho filtrovaného reťazca
// Konstruktor
public LogFilter(ListView listView)
{
_listView = listView;
}
// Metóda na aplikovanie filtra na ListView
public void ApplyFilter(string filterText)
{
_filterText = filterText.ToLower(); // Ukladáme text filtra bez ohľadu na veľkosť písmen
// Po aplikovaní filtra obnovíme zobrazenie
RefreshListView();
}
public void RefreshListView()
{
try
{
// Skontrolujeme, či sme na hlavnom vlákne a v prípade potreby použijeme Invoke
if (_listView.InvokeRequired)
{
// Použijeme Invoke, ak nie sme na hlavnom vlákne
_listView.Invoke(new Action(RefreshListView));
}
else
{
// Vymazanie existujúcich položiek
_listView.Items.Clear();
// Načítame všetky logy (ideálne z cache alebo databázy)
var logs = LiveLogCache.Instance.GetLogs(0, LiveLogCache.Instance.Logs.Count);
// Pridáme len tie logy, ktoré spĺňajú filter
foreach (var log in logs)
{
if (log.ToLower().Contains(_filterText)) // Kontrola, či log obsahuje filter text
{
var listViewItem = new ListViewItem(log);
// Striedanie farieb riadkov
if (_listView.Items.Count % 2 == 0) // Párny index => biela
{
listViewItem.BackColor = Color.White;
}
else // Nepárny index => svetlá sivá
{
listViewItem.BackColor = Color.FromArgb(240, 240, 240); // Veľmi svetlá sivá
}
// Pridanie efektu pre novú položku
ApplyNewItemEffect(listViewItem);
// Pridanie položky do ListView
_listView.Items.Add(listViewItem);
}
}
}
}
catch (Exception ex)
{
// Zachytíme výnimku, ak sa niečo pokazí, a zobrazíme ju užívateľovi
MessageBox.Show($"An error occurred while refreshing the log view: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
// Môžete pridať ďalšie metódy na zobrazenie alebo efekt pre nové položky, ak je to potrebné
private void ApplyNewItemEffect(ListViewItem item)
{
// Prípadný efekt pre nový pridaný log
// Môžete pridať animáciu alebo zmenu farby atď.
item.ForeColor = Color.Green; // Napríklad zmeníme farbu písma na zelenú
}
}
}

278
AppDiagnostic/MainForm.Designer.cs generated Normal file
View File

@ -0,0 +1,278 @@
using System.Windows.Forms;
namespace AppDiagnostic
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
//private BufferedListView memoListView;
private System.Windows.Forms.ColumnHeader columnHeaderTime;
private System.Windows.Forms.ColumnHeader columnHeaderMessage;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.columnHeaderTime = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderMessage = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.panel1 = new System.Windows.Forms.Panel();
this.refreshMemoButton = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.filterManagementPanel = new System.Windows.Forms.Panel();
this.button5 = new System.Windows.Forms.Button();
this.filterButton = new System.Windows.Forms.Button();
this.filterTextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.wndControlPanel = new System.Windows.Forms.Panel();
this.button2 = new System.Windows.Forms.Button();
this.flowControlsPanel = new System.Windows.Forms.Panel();
this.runButton = new System.Windows.Forms.Button();
this.stopButton = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.memoListView = new BufferedListView();
this.panel1.SuspendLayout();
this.filterManagementPanel.SuspendLayout();
this.wndControlPanel.SuspendLayout();
this.flowControlsPanel.SuspendLayout();
this.SuspendLayout();
//
// columnHeaderTime
//
this.columnHeaderTime.Text = "Time";
this.columnHeaderTime.Width = 150;
//
// columnHeaderMessage
//
this.columnHeaderMessage.Text = "Message";
this.columnHeaderMessage.Width = 350;
//
// panel1
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.panel1.Controls.Add(this.refreshMemoButton);
this.panel1.Controls.Add(this.button6);
this.panel1.Controls.Add(this.button7);
this.panel1.Location = new System.Drawing.Point(189, 356);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(283, 26);
this.panel1.TabIndex = 16;
//
// refreshMemoButton
//
this.refreshMemoButton.Location = new System.Drawing.Point(108, 0);
this.refreshMemoButton.Name = "refreshMemoButton";
this.refreshMemoButton.Size = new System.Drawing.Size(84, 26);
this.refreshMemoButton.TabIndex = 17;
this.refreshMemoButton.Text = "Refresh memo";
this.refreshMemoButton.UseVisualStyleBackColor = true;
this.refreshMemoButton.Click += new System.EventHandler(this.refreshMemoButton_Click);
//
// button6
//
this.button6.Location = new System.Drawing.Point(0, 0);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(102, 26);
this.button6.TabIndex = 4;
this.button6.Text = "Clean diag cache";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// button7
//
this.button7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button7.Location = new System.Drawing.Point(198, 0);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(72, 26);
this.button7.TabIndex = 5;
this.button7.Text = "Save logs";
this.button7.UseVisualStyleBackColor = true;
this.button7.Click += new System.EventHandler(this.button7_Click);
//
// filterManagementPanel
//
this.filterManagementPanel.Controls.Add(this.button5);
this.filterManagementPanel.Controls.Add(this.filterButton);
this.filterManagementPanel.Controls.Add(this.filterTextBox);
this.filterManagementPanel.Controls.Add(this.label2);
this.filterManagementPanel.Location = new System.Drawing.Point(127, 6);
this.filterManagementPanel.Name = "filterManagementPanel";
this.filterManagementPanel.Size = new System.Drawing.Size(393, 26);
this.filterManagementPanel.TabIndex = 15;
//
// button5
//
this.button5.Enabled = false;
this.button5.Location = new System.Drawing.Point(294, 4);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(81, 20);
this.button5.TabIndex = 11;
this.button5.Text = "Add new filter";
this.button5.UseVisualStyleBackColor = true;
//
// filterButton
//
this.filterButton.Location = new System.Drawing.Point(225, 4);
this.filterButton.Name = "filterButton";
this.filterButton.Size = new System.Drawing.Size(64, 20);
this.filterButton.TabIndex = 10;
this.filterButton.Text = "Set filter";
this.filterButton.UseVisualStyleBackColor = true;
this.filterButton.Click += new System.EventHandler(this.filterButton_Click_1);
//
// filterTextBox
//
this.filterTextBox.Location = new System.Drawing.Point(33, 4);
this.filterTextBox.Name = "filterTextBox";
this.filterTextBox.Size = new System.Drawing.Size(187, 20);
this.filterTextBox.TabIndex = 7;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(3, 8);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(29, 13);
this.label2.TabIndex = 6;
this.label2.Text = "Filter";
//
// wndControlPanel
//
this.wndControlPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.wndControlPanel.Controls.Add(this.button2);
this.wndControlPanel.Location = new System.Drawing.Point(831, 356);
this.wndControlPanel.Name = "wndControlPanel";
this.wndControlPanel.Size = new System.Drawing.Size(70, 26);
this.wndControlPanel.TabIndex = 14;
//
// button2
//
this.button2.Location = new System.Drawing.Point(3, 0);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(64, 26);
this.button2.TabIndex = 2;
this.button2.Text = "Close";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// flowControlsPanel
//
this.flowControlsPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.flowControlsPanel.Controls.Add(this.runButton);
this.flowControlsPanel.Controls.Add(this.stopButton);
this.flowControlsPanel.Location = new System.Drawing.Point(12, 356);
this.flowControlsPanel.Name = "flowControlsPanel";
this.flowControlsPanel.Size = new System.Drawing.Size(133, 26);
this.flowControlsPanel.TabIndex = 13;
//
// runButton
//
this.runButton.Enabled = false;
this.runButton.Location = new System.Drawing.Point(0, 0);
this.runButton.Name = "runButton";
this.runButton.Size = new System.Drawing.Size(64, 26);
this.runButton.TabIndex = 4;
this.runButton.Text = "Run";
this.runButton.UseVisualStyleBackColor = true;
this.runButton.Click += new System.EventHandler(this.runButton_Click);
//
// stopButton
//
this.stopButton.Location = new System.Drawing.Point(69, 0);
this.stopButton.Name = "stopButton";
this.stopButton.Size = new System.Drawing.Size(64, 26);
this.stopButton.TabIndex = 5;
this.stopButton.Text = "Stop";
this.stopButton.UseVisualStyleBackColor = true;
this.stopButton.Click += new System.EventHandler(this.stopButton_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 19);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(76, 13);
this.label1.TabIndex = 12;
this.label1.Text = "Flow of events";
//
// memoListView
//
this.memoListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.memoListView.FullRowSelect = true;
this.memoListView.GridLines = true;
this.memoListView.HideSelection = false;
this.memoListView.Location = new System.Drawing.Point(12, 38);
this.memoListView.Name = "memoListView";
this.memoListView.Size = new System.Drawing.Size(889, 312);
this.memoListView.TabIndex = 0;
this.memoListView.UseCompatibleStateImageBehavior = false;
this.memoListView.View = System.Windows.Forms.View.Details;
this.memoListView.DoubleClick += new System.EventHandler(this.MemoListView_DoubleClick);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(913, 388);
this.Controls.Add(this.memoListView);
this.Controls.Add(this.panel1);
this.Controls.Add(this.filterManagementPanel);
this.Controls.Add(this.wndControlPanel);
this.Controls.Add(this.flowControlsPanel);
this.Controls.Add(this.label1);
this.Name = "MainForm";
this.Text = "Application live diagnostic";
this.panel1.ResumeLayout(false);
this.filterManagementPanel.ResumeLayout(false);
this.filterManagementPanel.PerformLayout();
this.wndControlPanel.ResumeLayout(false);
this.flowControlsPanel.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Panel filterManagementPanel;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button filterButton;
private System.Windows.Forms.TextBox filterTextBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Panel wndControlPanel;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Panel flowControlsPanel;
private System.Windows.Forms.Button runButton;
private System.Windows.Forms.Button stopButton;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button refreshMemoButton;
private BufferedListView memoListView;
}
}

266
AppDiagnostic/MainForm.cs Normal file
View File

@ -0,0 +1,266 @@
using log4net.Config;
using log4net;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using log4net.Appender;
using SharedComponents;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using System.IO; // Pre File.WriteAllLines a prácu so súbormi
using System.Linq;
namespace AppDiagnostic
{
public partial class MainForm : Form
{
private bool stopUpdate = false; // Premenná na zastavenie aktualizácie
private int lastDisplayedLogIndex = 0;
private bool autoScrollEnabled = true; // Automatický posun, predvolene povolený
private MainForm appDiagnosticForm;
private Timer refreshTimer;
private LogAdapter _logAdapter; // Pre LogAdapter
private LogFilter _logFilter; // LogFilter objekt pre filtráciu
public MainForm()
{
InitializeComponent();
// Inicializujeme LogAdapter a priradíme ho k memoListView
_logAdapter = new LogAdapter(memoListView);
RefreshLogView();
// Pripojenie na udalosť pri pridaní nového logu
// nakoľko sa memo refreshuje cyklicky, tak refresh na udalosť nepotrebujem
//LiveLogCache.Instance.LogAdded += OnLogAdded;
// Vytvoríme LogFilter objekt
//_logFilter = new LogFilter(memoListView);
}
private void OnLogAdded(string log)
{
try
{
RefreshLogView();
}
catch (Exception ex)
{
MessageBox.Show($"Error in OnLogAdded: {ex.Message}");
throw;
}
}
private void RefreshLogView()
{
// Skontrolujte, či voláme z iného vlákna
if (InvokeRequired)
{
Invoke((Action)RefreshLogView);
return;
}
memoListView.BeginUpdate(); // Zabraňuje vizuálnym aktualizáciám počas vykresľovania
try
{
// Skontrolujte, či je užívateľ na poslednom viditeľnom zázname
if (memoListView.Items.Count > 0)
{
var lastVisibleIndex = memoListView.TopItem.Index + memoListView.ClientRectangle.Height / memoListView.Items[0].Bounds.Height;
autoScrollEnabled = lastVisibleIndex >= memoListView.Items.Count - 1;
}
// Získajte nové logy od posledného indexu
var logs = LiveLogCache.Instance.GetLogs(lastDisplayedLogIndex, LiveLogCache.Instance.Logs.Count - lastDisplayedLogIndex);
// Pridajte len nové logy
foreach (var log in logs)
{
memoListView.Items.Add(new ListViewItem(log));
}
// Aktualizujte posledný zobrazený index
lastDisplayedLogIndex = LiveLogCache.Instance.Logs.Count;
// Ak je autoScrollEnabled, posuňte sa na posledný záznam
if (autoScrollEnabled && memoListView.Items.Count > 0)
{
memoListView.EnsureVisible(memoListView.Items.Count - 1);
}
}
finally
{
memoListView.EndUpdate(); // Umožní vizuálne aktualizácie
}
}
// Táto metóda sa spustí pri scrollovaní v memoListView (tzn. ak sa používateľ dostane na spodok listu)
private void memoListView_Scroll(object sender, EventArgs e)
{
// Skontrolujte, či používateľ dosiahol spodok ListView
if (memoListView.Items.Count > 0 &&
memoListView.Items[memoListView.Items.Count - 1].Bounds.Bottom <= memoListView.ClientSize.Height)
{
// Ak áno, načítame ďalšie logy
RefreshLogView();
}
}
private void button6_Click(object sender, EventArgs e)
{
//LiveLogCache.Instance.AddLog("Nový log z hlavnej aplikácie");
LiveLogCache.Instance.ClearLogs();
ClearListView();
}
private void runButton_Click(object sender, EventArgs e)
{
if (stopUpdate) // Ak je časovač zastavený, spustíme ho
{
stopUpdate = false; // Zastav aktualizáciu
runButton.Enabled = false; // Zakážeme tlačidlo Start počas behu
stopButton.Enabled = true; // Povolenie tlačidla Stop
refreshTimer.Start();
}
}
private void stopButton_Click(object sender, EventArgs e)
{
if (!stopUpdate) // Ak časovač beží, môžeme ho zastaviť
{
stopUpdate = true; // Spusti aktualizáciu
runButton.Enabled = true; // Povolenie tlačidla Start
stopButton.Enabled = false; // Zakážeme tlačidlo Stop
refreshTimer.Stop();
}
}
private void ClearListView()
{
if (InvokeRequired)
{
Invoke(new Action(ClearListView));
return;
}
memoListView.Items.Clear();
}
private void refreshMemoButton_Click(object sender, EventArgs e)
{
}
private void button7_Click(object sender, EventArgs e)
{
SaveLogsToFile();
//LiveLogCache.Instance.AddLog("Toto je nový log.");
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
// Odpojenie udalosti, keď sa okno zatvára, inak môže po opätovnom spustení okna a pridaní nového itemu do listu zhhodiť program
// nakoľko sa memo refreshuje cyklicky, tak refresh na udalosť nepotrebujem
//LiveLogCache.Instance.LogAdded -= OnLogAdded;
_logAdapter = null;
base.OnFormClosing(e);
}
private void filterButton_Click_1(object sender, EventArgs e)
{
// Aplikujeme filter na základe textu z filterTextBox
string filterText = filterTextBox.Text;
//_logFilter.ApplyFilter(filterText); // Aplikovanie filtra
_logAdapter.ApplyFilter(filterText);
}
private void SubForm_FormClosing(object sender, FormClosingEventArgs e)
{
try
{
// Vaša logika pri uzatváraní formy
// this.Hide(); // Podforma sa len skryje
}
catch (Exception ex)
{
// Ošetrenie výnimky
MessageBox.Show("Chyba pri zatváraní pod-aplikácie: " + ex.Message);
}
}
private void SaveLogsToFile()
{
using (SaveFileDialog saveFileDialog = new SaveFileDialog())
{
saveFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
saveFileDialog.Title = "Save TBF live logs";
saveFileDialog.DefaultExt = "txt";
saveFileDialog.FileName = "TBFLiveLogs.txt";
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
try
{
// Načítanie všetkých logov z LiveLogCache
var logs = LiveLogCache.Instance.GetLogs(0, LiveLogCache.Instance.GetCount());
// Uloženie logov do vybraného súboru
File.WriteAllLines(saveFileDialog.FileName, logs);
MessageBox.Show("Logs saved successfully.", "Save TBF live logs", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show($"An error occurred while saving TBF live logs: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
//this.Hide(); // Podforma sa len skryje
}
private void MemoListView_DoubleClick(object sender, EventArgs e)
{
if (memoListView.SelectedItems.Count > 0)
{
var selectedItem = memoListView.SelectedItems[0];
int selectedIndex = memoListView.Items.IndexOf(selectedItem);
if (selectedIndex >= 0)
{
// Zrušenie filtra
_logAdapter._filterText = string.Empty;
// Načítanie logov od indexu vybraného riadku
var logs = LiveLogCache.Instance.GetLogs(selectedIndex, LiveLogCache.Instance.GetCount() - selectedIndex);
// Obnovenie ListView s novými údajmi
memoListView.BeginUpdate();
memoListView.Items.Clear();
foreach (var log in logs)
{
var item = new ListViewItem(log)
{
BackColor = memoListView.Items.Count % 2 == 0 ? Color.White : Color.FromArgb(240, 240, 240)
};
memoListView.Items.Add(item);
}
memoListView.EndUpdate();
}
}
}
}
}

120
AppDiagnostic/MainForm.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

22
AppDiagnostic/Program.cs Normal file
View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AppDiagnostic
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}

View File

@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AppDiagnostic")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AppDiagnostic")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fa9abad1-7184-4295-ade8-d44f2e3de6b2")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace AppDiagnostic.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AppDiagnostic.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace AppDiagnostic.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="3.0.3" targetFramework="net472" />
</packages>

View File

@ -68,6 +68,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="CalendarEvent\ICalendarEvent.cs" />
<Compile Include="Data.cs" />
<Compile Include="Entities\BenchPath.cs" />
<Compile Include="Entities\CustomEvent.cs" />
<Compile Include="Entities\Component.cs" />
@ -95,6 +96,7 @@
<Compile Include="Entities\VirtualBenchStep.cs" />
<Compile Include="CalendarEvent\Utils.cs" />
<Compile Include="FluentCommon.cs" />
<Compile Include="Formulas.cs" />
<Compile Include="Mappings\BenchPathMap.cs" />
<Compile Include="Mappings\ComponentMap.cs" />
<Compile Include="Mappings\ComponentProcedureMap.cs" />

103
Config/Data.cs Normal file
View File

@ -0,0 +1,103 @@
using System;
//formulas.cs has been added cause iPerl from master-2 ...MF
namespace Config
{
public class Data
{
public const string AdminUsername = "admin";
public const string AdminPassword = "staratura";
public const string SQLiteDbFName = "SQLite.db";
#if DN100 || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || CEVAK_200
public const int WMsCount = 3;
public const int LineSize = 3;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 1;
#elif MUNICH
public const int WMsCount = 3;
public const int LineSize = 3;
public const int CompoundWMsCount = 3;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 3;
#elif MALTA_WSD25
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 0;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 1;
#elif BADGER_MALA_TRAT || BERLIN || FUZHOU_150 || FUZHOU_300 || GELSENWASSER || GENESIS || IZRAEL_200 || PETERSBURG_200 || SENTEC || SLM_150 || TORINO_50
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 1;
#elif PUCHONG_200
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 3;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 3;
#elif RUM_MOB
public const int WMsCount = 8;
public const int LineSize = 8;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif TURA_SPECIAL
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif DEWA_300 || FUZHOU_100 || ROMA_200 || LUXEMBURG_40
public const int WMsCount = 10;
public const int LineSize = 10;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif DUBAJ_50
public const int WMsCount = 10;
public const int LineSize = 5;
public const int CompoundWMsCount = 0;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif SLM_END || WARSAW_END
public const int WMsCount = 10;
public const int LineSize = 5;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 4;
#elif SLM_50
public const int WMsCount = 12;
public const int LineSize = 12;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 6;
public const int MaxPartNr = WMsCount / LineSize;
#elif ALZIR_25 || BAHRAIN_50 || CEVAK_40 || FEWA_50 || FILIPINY_50 || FUZHOU_50 || HONGKONG_50 || IZRAEL_25 || JUZNA_AFRIKA_50 || KEMPNO_50 || KRAKOW_50 || MILWAUKEE || MURES_40 || PETERSBURG_50 || TORUN_50 || WARSAW_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 TURA_IPERL || TURA_IPERL_NEW
public const int WMsCount = 40;
public const int LineSize = 20;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif IZRAEL_50
public const int WMsCount = 40;
public const int LineSize = 10;
public const int CompoundWMsCount = 0;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#endif
public static double RealDensity = 0; /// true water density [kg/m3]
public static double AtTemperature = 0; /// measured at temperature [°C]
public static double Buoyancy = 0;
}
}

View File

@ -18,8 +18,9 @@ namespace Config.Entities
public virtual Unit FlowUnit { get; set; } /// Not mapped to database, used in UI
public virtual string Selector { get; set; }
public virtual string RegValve { get; set; }
public virtual string FlowMeter { get; set; }
public virtual float PidCoef { get; set; } /// PID coefficient for the regulation path
public virtual int RegulMinStep { get; set; }
public virtual string FlowMeter { get; set; }
public virtual float PidCoef { get; set; } /// PID coefficient for the regulation path
public virtual string StartValve { get; set; }
public virtual string Diverter { get; set; }
public virtual string TempMtrDiv { get; set; }
@ -39,6 +40,7 @@ namespace Config.Entities
{
ValvesOpen = string.Empty;
ValvesClose = string.Empty;
RegulMinStep = 0;
}
public OutputPath(string name, int itemNr)
@ -46,7 +48,9 @@ namespace Config.Entities
{
Name = name;
ItemNr = itemNr;
}
RegulMinStep = 0;
}
public virtual OutputPath Clone(string name, int itemNr)
{
@ -58,7 +62,8 @@ namespace Config.Entities
result.FlowUnit = FlowUnit;
result.Selector = Selector;
result.RegValve = RegValve;
result.FlowMeter = FlowMeter;
result.RegulMinStep = RegulMinStep;
result.FlowMeter = FlowMeter;
result.PidCoef = PidCoef;
result.StartValve = StartValve;
result.Diverter = Diverter;

410
Config/Formulas.cs Normal file
View File

@ -0,0 +1,410 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using Common;
//formulas.cs has been added cause iPerl from master-2 ...MF
namespace Config
{
public static class Formulas
{
private static readonly ILog log = LogManager.GetLogger(typeof(Formulas));
///
/// Wrappers
///
public static double RealDensity() { return Data.RealDensity; }
public static double AtTemperature() { return Data.AtTemperature; }
public static double Buoyancy() { return Data.Buoyancy; }
/// Private tables with coeficients to calculate specific enthalpy
static readonly int[] Ii;
static readonly int[] Ji;
static readonly double[] ni;
/// Private table with coeficients to calculate temperature of a platinum thermometer
static readonly double[] Di;
/// <summary>
/// Constructor
/// </summary>
static Formulas()
{
///
/// Initialize tables to calculate specific enthalpies
///
Ii = new int[34] { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 8, 8, 21, 23, 29, 30, 31, 32 };
Ji = new int[34] { -2, -1, 0, 1, 2, 3, 4, 5, -9, -7, -1, 0, 1, 3, -3, 0, 1, 3, 17, -4, 0, 6, -5, -2, 10, -8, -11, -6, -29, -31, -38, -39, -40, -41 };
ni = new double[34] {
0.14632971213167, /// 1
-0.84548187169114, /// 2
-0.37563603672040E1, /// 3
0.33855169168385E1, /// 4
-0.95791963387872, /// 5
0.15772038513228, /// 6
-0.16616417199501E-1, /// 7
0.81214629983568E-3, /// 8
0.28319080123804E-3, /// 9
-0.60706301565874E-3, /// 10
-0.18990068218419E-1, /// 11
-0.32529748770505E-1, /// 12
-0.21841717175414E-1, /// 13
-0.52838357969930E-4, /// 14
-0.47184321073267E-3, /// 15
-0.30001780793026E-3, /// 16
0.47661393906987E-4, /// 17
-0.44141845330846E-5, /// 18
-0.72694996297594E-15, /// 19
-0.31679644845054E-4, /// 20
-0.28270797985312E-5, /// 21
-0.85205128120103E-9, /// 22
-0.22425281908000E-5, /// 23
-0.65171222895601E-6, /// 24
-0.14341729937924E-12, /// 25
-0.40516996860117E-6, /// 26
-0.12734301741641E-8, /// 27
-0.17424871230634E-9, /// 28
-0.68762131295531E-18, /// 29
0.14478307828521E-19, /// 30
0.26335781662795E-22, /// 31
-0.11947622640071E-22, /// 32
0.18228094581404E-23, /// 33
-0.93537087292458E-25, /// 34
};
///
/// Initialize a table to calculate temperature of a platinum thermometer from resistance
///
Di = new double[]
{
439.932854,
472.418020,
37.684494,
7.472018,
2.920828,
0.005184,
-0.963864,
-0.188732,
0.191203,
0.049025,
};
}
/// <summary>
/// Calculate density of distilled water from temperature
/// </summary>
/// <param name="t">ITS-90 temperature in [°C]</param>
/// <returns>Density in [kg/m3]</returns>
public static double DistilledWaterDensityFromTemp(double t)
{
if (t <= 40)
{
const double c0 = 999.839564;
const double c1 = 0.067998613;
const double c2 = -0.0091101468;
const double c3 = 0.00010058299;
const double c4 = -0.0000011275659;
const double c5 = 6.5985371e-09;
return ((((c5 * t + c4) * t + c3) * t + c2) * t + c1) * t + c0;
}
else
{
const double a0 = 9.9983952E2;
const double a1 = 1.6952577E1;
const double a2 = -7.9905127E-3;
const double a3 = -4.6241757E-5;
const double a4 = 1.0584601E-7;
const double a5 = -2.8103006E-10;
const double b = 1.6887236E-2;
return (((((a5 * t + a4) * t + a3) * t + a2) * t + a1) * t + a0) / (1.0 + b * t);
}
}
/// <summary>
/// Calculate density of distilled water from temperature (obsolete)
/// </summary>
/// <param name="t">IPTS-68 temperature in [°C]</param>
/// <returns>Density in [kg/m3]</returns>
public static double DistilledWaterDensityFromTempIPTS68(double t)
{
const double a0 = 999.842594;
const double a1 = 0.06793952;
const double a2 = -0.009095290;
const double a3 = 0.0001001685;
const double a4 = -0.000001120083;
const double a5 = 6.536332e-09;
return ((((a5 * t + a4) * t + a3) * t + a2) * t + a1) * t + a0;
}
/// <summary>
/// Calculate density by comparing calculated data and data from a certificate
/// </summary>
/// <param name="realDensity">Density from a certificate in [kg/m3]</param>
/// <param name="atTemperature">Temperature from a certificate in [°C]</param>
/// <returns>Density correction in [kg/m3]</returns>
public static double DensityCorrection(double realDensity, double atTemperature)
{
/// Calculated data
double calculatedDensity = DistilledWaterDensityFromTemp(atTemperature);
return realDensity - calculatedDensity;
}
/// <summary>
/// Calculate corrected (real) water density from temperature
/// </summary>
/// <param name="t">Temperature in [°C]</param>
/// <returns>Density in [kg/m3]</returns>
public static double WaterDensityFromTemp(double t)
{
return DistilledWaterDensityFromTemp(t) + DensityCorrection(RealDensity(), AtTemperature());
}
/// <summary>
/// Calculate corrected (real) water density from temperature
/// </summary>
/// <param name="t">Temperature in [°C]</param>
/// <returns>Density in [kg/m3]</returns>
public static double WaterDensityFromTempPress(double temp, double pressure)
{
double x0 = 5.08821E-10;
double x1 = 1.2639418;
double x2 = 0.2660269;
double x3 = 0.3734838;
double x4 = 2.0205242;
double theta = temp / 100.0;
double B = x0 * (((x3 * theta + x2) * theta + x1) * theta + 1) / (1 + x4 * theta);
return WaterDensityFromTemp(temp) * (1 + B * Units.ConvertTo(Unit.Pa, pressure));
}
public static float AirDensityFromAmbientVales(float tempC, float pressureBar, float humiPct)
{
double pressurePa = 100000.0 * (double)pressureBar; /// [Pa]
double tempKelvin = 273.15 + (double)tempC;
double coef1 = 1.2811805 / 10000.0 * tempKelvin * tempKelvin
- 1.950987 / 100.0 * tempKelvin
+ 34.04926034
- 6.353631 * 1000.0 / tempKelvin;
double coef3 = humiPct / 100.0 * System.Math.Exp(coef1) / pressurePa;
double airDensityKgm3 = 0.00348353 * pressurePa * (1.0 - 0.378 * coef3) / tempKelvin; /// kg/m3
return (float)airDensityKgm3;
}
/// <summary>
/// Convert 'pulses' to 'volume', prevent division by zero
/// </summary>
public static double VolumeFromPulses(int pulses, double pulsesPerLiter)
{
if (pulsesPerLiter <= double.Epsilon) return 0;
return Convert.ToDouble(pulses) / pulsesPerLiter;
}
/// <summary>
/// Calculate the error in % from 'measured' and 'true' volume, prevent division by zero
/// </summary>
public static double ErrorFromVolumes(double measuredVolume, double trueVolume)
{
if (-float.Epsilon <= trueVolume && trueVolume <= float.Epsilon)
{
if (-float.Epsilon <= measuredVolume && measuredVolume <= float.Epsilon)
{
log.WarnFormat("ErrorFromVolumes({0},{1}) returns {2}", measuredVolume, trueVolume, -100.0);
return -100.0;
}
log.WarnFormat("ErrorFromVolumes({0},{1}) returns {2}", measuredVolume, trueVolume, 99.0);
return 99.0;
}
double error = 100.0 * (measuredVolume - trueVolume) / trueVolume;
log.InfoFormat("ErrorFromVolumes({0},{1}) returns {2}", measuredVolume, trueVolume, error);
return error;
}
/// <summary>
/// Calculates corrected value from a list of corrections by interpolation.
/// It is assumed that values in the list 'corrections' are sorted.
/// </summary>
/// <param name="rawMeasurement">Raw uncorrected value</param>
/// <param name="corrections">Sorted (value, correction) pairs</param>
/// <returns>Corrected value</returns>
public static double CorrectedValue(double rawValue, IList<IMeasurementCorrection> corrections)
{
return rawValue + GetCorrection(rawValue, corrections);
}
/// <summary>
/// Get a correction from a list of corrections by interpolation.
/// It is assumed that values in the list 'corrections' are sorted.
/// </summary>
/// <param name="rawMeasurement">Raw uncorrected value</param>
/// <param name="corrections">Sorted (value, correction) pairs</param>
/// <returns>Corrected value</returns>
public static double GetCorrection(double rawValue, IList<IMeasurementCorrection> corrections)
{
if ((corrections == null) || (corrections.Count == 0)) return 0; /// No correction
if (rawValue < corrections[0].Measurement)
{
/// rawValue is below the lowest value in the correction table
return corrections[0].Correction;
}
int count = corrections.Count;
for (int i = 1; i < count; i++)
{
if (rawValue < corrections[i].Measurement)
{
double d1 = rawValue - corrections[i - 1].Measurement;
double d2 = corrections[i].Measurement - rawValue;
if (d1 + d2 <= float.Epsilon)
{
/// Neigboring values in the corection table are close to each other -> calculate the average
return (corrections[i - 1].Correction + corrections[i].Correction) / 2.0;
}
else
{
/// Interpolate the correction from neigboring values in the corection table
return (corrections[i - 1].Correction * d2 + corrections[i].Correction * d1) / (d1 + d2);
}
}
}
/// rawValue is above the highest value in the correction table
return corrections[count - 1].Correction;
}
/// <summary>
/// Converts a measurement error to a correction (used when preparing correction tables).
/// </summary>
/// <param name="measuredValue">Measured value (in arbitrary units)</param>
/// <param name="error">Measurement error in %</param>
/// <returns>Correction in the same units as the measured value</returns>
public static double CorrectionFromError(double measuredValue, double error)
{
double trueValue = measuredValue / (1 + error/100);
double correction = trueValue - measuredValue;
return correction;
}
/// <summary>
/// Calculates the heat coefficient for water
/// </summary>
/// <param name="pressure">Pressure [bar]</param>
/// <param name="T_in">Inlet temperature [°C]</param>
/// <param name="T_out">Outlet temperature [°C]</param>
/// <param name="flowMeasuredAtInlet">true = flow measured @inlet, false = flow measured @outlet</param>
/// <returns> Heat coefficient for water [J/(m3 K)]</returns>
public static double HeatCoefficientWater(double pressure, double T_in, double T_out, bool flowMeasuredAtInlet)
{
if (T_in == T_out) return 0;
const double R = 461.526; /// [J kg^-1 K^-1]
const double p_star_Pa = 16.53E6; /// [Pa] (=16.53 MPa)
const double T_star = 1386.0; /// [K]
double T_in_K = Units.ConvertTo(Unit.K, T_in);
double T_out_K = Units.ConvertTo(Unit.K, T_out);
double tau_in = T_star / T_in_K;
double tau_out = T_star / T_out_K;
double pi = Units.ConvertTo(Unit.Pa, pressure) / p_star_Pa;
double h_in = tau_in * GammaTau(pi, tau_in) * R * T_in_K;
double h_out = tau_out * GammaTau(pi, tau_out) * R * T_out_K;
double ni = flowMeasuredAtInlet ? GammaPi(pi, tau_in) * R * T_in_K / p_star_Pa
: GammaPi(pi, tau_out) * R * T_out_K / p_star_Pa;
return (h_in - h_out) / (ni * (T_in - T_out));
}
/// <summary>
/// gamma(pi) see also STN EN 1434-1 Annex A (A.4)
/// </summary>
/// <param name="pi">pi = p / p* where p* = 16.53 MPa</param>
/// <param name="tau">tau = T* / T where T* = 1386 K</param>
/// <returns>gamma(pi)</returns>
static double GammaPi(double pi, double tau)
{
double result = 0;
for (int i = 0; i < 34; i++)
{
result -= ni[i] * Ii[i] * Math.Pow(7.1 - pi, Ii[i] - 1) * Math.Pow(tau - 1.222, Ji[i]);
}
return result;
}
/// <summary>
/// gamma(tau) see also STN EN 1434-1 Annex A (A.7)
/// </summary>
/// <param name="pi">pi = p / p* where p* = 16.53 MPa</param>
/// <param name="tau">tau = T* / T where T* = 1386 K</param>
/// <returns>gamma(tau)</returns>
static double GammaTau(double pi, double tau)
{
double result = 0;
for (int i = 0; i < 34; i++)
{
result += ni[i] * Math.Pow(7.1 - pi, Ii[i]) * Ji[i] * Math.Pow(tau - 1.222, Ji[i] - 1);
}
return result;
}
/// <summary>
/// Conversion of measured resistance of a platinum thermometer to temperature according to ITS-90
/// </summary>
/// <param name="R">Measured resistance in [°C]</param>
/// <param name="R001C">Calibrated resistance in Ohm at 0.01°C</param>
/// <param name="a7">Calibrated ITS-90 coefficient a7</param>
/// <param name="b7">Calibrated ITS-90 coefficient b7</param>
/// <param name="c7">Calibrated ITS-90 coefficient c7</param>
/// <returns>Temperature in [°C]</returns>
public static double PlatinumResistanceTM_ITS90_R2T(double R, double R001C, double a7, double b7, double c7)
{
double w = R / R001C; /// ratio
double r1 = w - 1.0;
double dw = r1 * (a7 + r1 * (b7 + r1 * c7)); /// = a7*r1 + b7*r1^2 + c7*r1^3
double wr = w - dw;
double x = (wr - 2.64) / 1.64;
double sum = 0;
for (int i = Di.Length - 1; i >= 0; i--)
{
sum = sum * x + Di[i];
}
return sum;
}
/// <summary>
/// Conversion of measured resistance of a platinum thermometer to temperature using Callendar-Van Dusen equations
/// </summary>
/// <param name="R">Measured resistance in [°C]</param>
/// <param name="R0">Calibrated resistance in Ohm at 0°C</param>
/// <param name="A">Calibration coefficient a</param>
/// <param name="B">Calibration coefficient b</param>
/// <returns>Temperature in [°C]</returns>
public static double PlatinumResistanceTM_ITS27_R2T(double R, double R0, double A, double B)
{
if (R0 * R0 * A * A - 4 * R0 * B * (R0 - R) <= 0) return 0; /// Out of range
return (-(R0 * A) + Math.Sqrt(R0 * R0 * A * A - 4 * R0 * B * (R0 - R))) / (2 * R0 * B);
}
}
}

View File

@ -17,7 +17,8 @@ namespace Config.Mappings
Map(x => x.Qto);
Map(x => x.Selector);
Map(x => x.RegValve);
Map(x => x.FlowMeter);
Map(x => x.RegulMinStep);
Map(x => x.FlowMeter);
Map(x => x.PidCoef);
Map(x => x.StartValve);
Map(x => x.Diverter);

View File

@ -29,8 +29,12 @@ namespace Results.Entities
public virtual long ErrorIndicators { get; set; } /// Not mapped to DB !!!, bit24=E25, bit25=E26, bit26=E27, bit27=E28 (error flags)
public virtual long InfoIndicators { get; set; } /// Not mapped to DB !!!, bit24=E25, bit25=E26, bit26=E27, bit27=E28 (info flags)
public virtual bool TestDone { get; set; } /// true = test was completed
public virtual bool Passed { get; set; } /// true = test passed, water meter is OK
public virtual bool Passed { get; set; } /// true = test passed, water meter is OK
#if IPERL
public virtual int CalibFactor { get; set; }
public virtual int CalibFactorLNA { get; set; }
public virtual int Q2CorrRL { get; set; }
public virtual int Q2CorrLR { get; set; }
public virtual string ExtraDataPath { get; set; } /// Relative path to a file with opto-data/raw-data
public virtual float X1 { get; set; }
public virtual float X2 { get; set; }
@ -166,6 +170,10 @@ namespace Results.Entities
TestDone = src.TestDone;
Passed = src.Passed;
#if IPERL
CalibFactor = src.CalibFactor;
CalibFactorLNA = src.CalibFactorLNA;
Q2CorrRL = src.Q2CorrRL;
Q2CorrLR = src.Q2CorrLR;
ExtraDataPath = src.ExtraDataPath;
X1 = src.X1;
X2 = src.X2;
@ -209,6 +217,10 @@ namespace Results.Entities
writer.Write(TestDone);
writer.Write(Passed);
#if IPERL
writer.Write(CalibFactor);
writer.Write(CalibFactorLNA);
writer.Write(Q2CorrRL);
writer.Write(Q2CorrLR);
writer.Write((ExtraDataPath != null) ? ExtraDataPath : string.Empty);
writer.Write(X1);
writer.Write(X2);
@ -249,6 +261,10 @@ namespace Results.Entities
TestDone = reader.ReadBoolean();
Passed = reader.ReadBoolean();
#if IPERL
CalibFactor = reader.ReadInt32();
CalibFactorLNA = reader.ReadInt32();
Q2CorrRL = reader.ReadInt32();
Q2CorrLR = reader.ReadInt32();
ExtraDataPath = reader.ReadString();
X1 = reader.ReadSingle();
X2 = reader.ReadSingle();

View File

@ -29,7 +29,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;IPERL</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
@ -241,7 +241,9 @@
</EmbeddedResource>
<EmbeddedResource Include="Resources\Strings.fr.resx" />
<EmbeddedResource Include="Resources\Strings.it.resx" />
<EmbeddedResource Include="Resources\Strings.pl.resx" />
<EmbeddedResource Include="Resources\Strings.pl.resx">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Strings.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.Designer.cs</LastGenOutput>

View File

@ -378,6 +378,40 @@ namespace SchematicDrawing
Properties.Resources.Valve_XL_closed,
Properties.Resources.Valve_XL_vacuum,
Properties.Resources.Valve_XL_open_dry);
/// ValveSw
Shapes[DrShIx(Shape.ValveSw, Sz.S)] = new DrawingShape(Shape.ValveSw, Sz.S, 2, 2,
new Node[] { new Node(0, 1, Orient.L), new Node(2, 1, Orient.R) },
new Edge[] { new Edge(0, 1, 20, RouteCouple.OpenWhen1), new Edge(1, 0, 20, RouteCouple.OpenWhen1) },
0, 0, 20, 20,
Properties.Resources.ValveSw_S_open,
Properties.Resources.ValveSw_S_closed,
Properties.Resources.ValveSw_S_vacuum,
Properties.Resources.ValveSw_S_open_dry);
Shapes[DrShIx(Shape.ValveSw, Sz.M)] = new DrawingShape(Shape.ValveSw, Sz.M, 3, 4,
new Node[] { new Node(0, 2, Orient.L), new Node(3, 2, Orient.R) },
new Edge[] { new Edge(0, 1, 30, RouteCouple.OpenWhen1), new Edge(1, 0, 30, RouteCouple.OpenWhen1) },
0, 5, 30, 30,
Properties.Resources.ValveSw_M_open,
Properties.Resources.ValveSw_M_closed,
Properties.Resources.ValveSw_M_vacuum,
Properties.Resources.ValveSw_M_open_dry);
Shapes[DrShIx(Shape.ValveSw, Sz.L)] = new DrawingShape(Shape.ValveSw, Sz.L, 4, 4,
new Node[] { new Node(0, 2, Orient.L), new Node(4, 2, Orient.R) },
new Edge[] { new Edge(0, 1, 40, RouteCouple.OpenWhen1), new Edge(1, 0, 40, RouteCouple.OpenWhen1) },
0, 0, 40, 40,
Properties.Resources.ValveSw_L_open,
Properties.Resources.ValveSw_L_closed,
Properties.Resources.ValveSw_L_vacuum,
Properties.Resources.ValveSw_L_open_dry);
Shapes[DrShIx(Shape.ValveSw, Sz.XL)] = new DrawingShape(Shape.ValveSw, Sz.XL, 5, 6,
new Node[] { new Node(0, 3, Orient.L), new Node(5, 3, Orient.R) },
new Edge[] { new Edge(0, 1, 50, RouteCouple.OpenWhen1), new Edge(1, 0, 50, RouteCouple.OpenWhen1) },
0, 5, 50, 50,
Properties.Resources.ValveSw_XL_open,
Properties.Resources.ValveSw_XL_closed,
Properties.Resources.ValveSw_XL_vacuum,
Properties.Resources.ValveSw_XL_open_dry);
/// Diverter
Shapes[DrShIx(Shape.Div, Sz.S)] = new DrawingShape(Shape.Div, Sz.S, 2, 2,
new Node[] { new Node(2, 0, Orient.Up), new Node(1, 2, Orient.Dn), new Node(3, 2, Orient.Dn) },
@ -523,12 +557,18 @@ namespace SchematicDrawing
Shapes[DrShIx(Shape.Scale, Sz.L)] = new DrawingShape(Shape.Scale, Sz.L, 12, 11, new Node[] { new Node(6, 11, Orient.Dn) }, null, 0, 0, 120, 110, Properties.Resources.Scale_L);
Shapes[DrShIx(Shape.Scale, Sz.XL)] = new DrawingShape(Shape.Scale, Sz.XL, 16, 13, new Node[] { new Node(8, 13, Orient.Dn) }, null, 0, 0, 160, 130, Properties.Resources.Scale_XL);
/// Tank
/// Tank uni
Shapes[DrShIx(Shape.Tank, Sz.S)] = new DrawingShape(Shape.Tank, Sz.S, 10, 8, new Node[] { new Node(0, 6, Orient.L) }, null, 0, 0, 100, 80, Properties.Resources.Tank_S);
Shapes[DrShIx(Shape.Tank, Sz.M)] = new DrawingShape(Shape.Tank, Sz.M, 12, 9, new Node[] { new Node(0, 7, Orient.L) }, null, 0, 0, 120, 90, Properties.Resources.Tank_M);
Shapes[DrShIx(Shape.Tank, Sz.L)] = new DrawingShape(Shape.Tank, Sz.L, 15, 11, new Node[] { new Node(0, 9, Orient.L) }, null, 0, 0, 150, 110, Properties.Resources.Tank_L);
Shapes[DrShIx(Shape.Tank, Sz.XL)] = new DrawingShape(Shape.Tank, Sz.XL, 20, 13, new Node[] { new Node(0, 11, Orient.L) }, null, 0, 0, 200, 130, Properties.Resources.Tank_XL);
/// Tank hot
Shapes[DrShIx(Shape.TankHot, Sz.S)] = new DrawingShape(Shape.TankHot, Sz.S, 10, 8, new Node[] { new Node(0, 6, Orient.L) }, null, 0, 0, 100, 80, Properties.Resources.Tank_S_hot);
Shapes[DrShIx(Shape.TankHot, Sz.M)] = new DrawingShape(Shape.TankHot, Sz.M, 12, 9, new Node[] { new Node(0, 7, Orient.L) }, null, 0, 0, 120, 90, Properties.Resources.Tank_M_hot);
Shapes[DrShIx(Shape.TankHot, Sz.L)] = new DrawingShape(Shape.TankHot, Sz.L, 15, 11, new Node[] { new Node(0, 9, Orient.L) }, null, 0, 0, 150, 110, Properties.Resources.Tank_L_hot);
Shapes[DrShIx(Shape.TankHot, Sz.XL)] = new DrawingShape(Shape.TankHot, Sz.XL, 20, 13, new Node[] { new Node(0, 11, Orient.L) }, null, 0, 0, 200, 130, Properties.Resources.Tank_XL_hot);
/// Junction
Shapes[DrShIx(Shape.Junction, Sz.None)] = new DrawingShape(Shape.Junction, Sz.None, 0, 0, new Node[] { new Node(0, 0, Orient.R) });
Shapes[DrShIx(Shape.Junction, Sz.S)] = new DrawingShape(Shape.Junction, Sz.S, 2, 2,

View File

@ -45,11 +45,13 @@ namespace SchematicDrawing
Scale,
Sink,
Tank,
TankHot,
Tee,
TempM,
UniCB,
Vacuum,
Valve,
ValveSw,
WaterM,
ElectricM,

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 894 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1018 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -19,7 +19,7 @@ namespace SchematicDrawing.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@ -730,6 +730,16 @@ namespace SchematicDrawing.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Tank_L_hot {
get {
object obj = ResourceManager.GetObject("Tank_L_hot", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -740,6 +750,16 @@ namespace SchematicDrawing.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Tank_M_hot {
get {
object obj = ResourceManager.GetObject("Tank_M_hot", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -750,6 +770,16 @@ namespace SchematicDrawing.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Tank_S_hot {
get {
object obj = ResourceManager.GetObject("Tank_S_hot", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -760,6 +790,16 @@ namespace SchematicDrawing.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Tank_XL_hot {
get {
object obj = ResourceManager.GetObject("Tank_XL_hot", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -970,6 +1010,166 @@ namespace SchematicDrawing.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ValveSw_L_closed {
get {
object obj = ResourceManager.GetObject("ValveSw_L_closed", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ValveSw_L_open {
get {
object obj = ResourceManager.GetObject("ValveSw_L_open", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ValveSw_L_open_dry {
get {
object obj = ResourceManager.GetObject("ValveSw_L_open_dry", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ValveSw_L_vacuum {
get {
object obj = ResourceManager.GetObject("ValveSw_L_vacuum", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ValveSw_M_closed {
get {
object obj = ResourceManager.GetObject("ValveSw_M_closed", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ValveSw_M_open {
get {
object obj = ResourceManager.GetObject("ValveSw_M_open", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ValveSw_M_open_dry {
get {
object obj = ResourceManager.GetObject("ValveSw_M_open_dry", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ValveSw_M_vacuum {
get {
object obj = ResourceManager.GetObject("ValveSw_M_vacuum", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ValveSw_S_closed {
get {
object obj = ResourceManager.GetObject("ValveSw_S_closed", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ValveSw_S_open {
get {
object obj = ResourceManager.GetObject("ValveSw_S_open", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ValveSw_S_open_dry {
get {
object obj = ResourceManager.GetObject("ValveSw_S_open_dry", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ValveSw_S_vacuum {
get {
object obj = ResourceManager.GetObject("ValveSw_S_vacuum", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ValveSw_XL_closed {
get {
object obj = ResourceManager.GetObject("ValveSw_XL_closed", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ValveSw_XL_open {
get {
object obj = ResourceManager.GetObject("ValveSw_XL_open", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ValveSw_XL_open_dry {
get {
object obj = ResourceManager.GetObject("ValveSw_XL_open_dry", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ValveSw_XL_vacuum {
get {
object obj = ResourceManager.GetObject("ValveSw_XL_vacuum", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View File

@ -319,6 +319,18 @@
<data name="Tank_XL" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\Tank-XL.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Tank_L_hot" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\Tank-L-hot.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Tank_M_hot" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\Tank-M-hot.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Tank_S_hot" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\Tank-S-hot.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Tank_XL_hot" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\Tank-XL-hot.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Vacuum_L_dry" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\Vacuum-L-dry.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -373,7 +385,66 @@
<data name="Valve_XL_vacuum" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\Valve-XL-vacuum.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="WaterM_L" type="System.Resources.ResXFileRef, System.Windows.Forms">
<data name="ValveSw_L_closed" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\ValveSw-L-closed.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ValveSw_L_open" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\ValveSw-L-open.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ValveSw_L_open_dry" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\ValveSw-L-open-dry.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ValveSw_L_vacuum" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\ValveSw-L-vacuum.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ValveSw_M_closed" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\ValveSw-M-closed.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ValveSw_M_open" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\ValveSw-M-open.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ValveSw_M_open_dry" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\ValveSw-M-open-dry.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ValveSw_M_vacuum" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\ValveSw-M-vacuum.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ValveSw_S_closed" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\ValveSw-S-closed.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ValveSw_S_open" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\ValveSw-S-open.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ValveSw_S_open_dry" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\ValveSw-S-open-dry.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ValveSw_S_vacuum" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\ValveSw-S-vacuum.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ValveSw_XL_closed" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\ValveSw-XL-closed.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ValveSw_XL_open" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\ValveSw-XL-open.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ValveSw_XL_open_dry" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\ValveSw-XL-open-dry.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ValveSw_XL_vacuum" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\ValveSw-XL-vacuum.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="WaterM_L" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Pictures\WaterM-L.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="EmergencyStop_XL_off" type="System.Resources.ResXFileRef, System.Windows.Forms">

View File

@ -98,6 +98,16 @@
<ItemGroup>
<Content Include="Pictures\Clamping-XL-off.png" />
<Content Include="Pictures\Clamping-XL-on.png" />
<Content Include="Pictures\ValveSw-L-open-dry.png" />
<Content Include="Pictures\ValveSw-L-vacuum.png" />
<Content Include="Pictures\ValveSw-M-open-dry.png" />
<Content Include="Pictures\ValveSw-M-vacuum.png" />
<Content Include="Pictures\ValveSw-S-open-dry.png" />
<Content Include="Pictures\ValveSw-S-vacuum.png" />
<Content Include="Pictures\ValveSw-XL-closed.png" />
<Content Include="Pictures\ValveSw-XL-open-dry.png" />
<Content Include="Pictures\ValveSw-XL-open.png" />
<Content Include="Pictures\ValveSw-XL-vacuum.png" />
<None Include="Pictures\Cover-XL-off.png" />
<None Include="Pictures\Cover-XL-on.png" />
<Content Include="Pictures\Div-L-sink-dry.png" />
@ -118,6 +128,10 @@
<Content Include="Pictures\Div-XL-tank-wet.png" />
<Content Include="Pictures\EmergencyStop-XL-off.png" />
<Content Include="Pictures\EmergencyStop-XL-on.png" />
<Content Include="Pictures\Tank-L-hot.png" />
<Content Include="Pictures\Tank-M-hot.png" />
<Content Include="Pictures\Tank-S-hot.png" />
<Content Include="Pictures\Tank-XL-hot.png" />
<Content Include="Pictures\UniCB-M-error.png" />
<Content Include="Pictures\UniCB-M-off.png" />
<Content Include="Pictures\UniCB-M-on.png" />
@ -187,6 +201,12 @@
<Content Include="Pictures\Valve-XL-closed.png" />
<Content Include="Pictures\Valve-XL-open-dry.png" />
<Content Include="Pictures\Valve-XL-open.png" />
<None Include="Pictures\ValveSw-L-closed.png" />
<None Include="Pictures\ValveSw-L-open.png" />
<None Include="Pictures\ValveSw-M-closed.png" />
<None Include="Pictures\ValveSw-M-open.png" />
<None Include="Pictures\ValveSw-S-closed.png" />
<None Include="Pictures\ValveSw-S-open.png" />
<None Include="Pictures\WaterM-L.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View File

@ -365,7 +365,7 @@ namespace SchematicDrawing
{
GNode gnode = new GNode(item, nid);
item.GNodes.Add(gnode);
graph.AddNode(gnode, dshape.Shape == Shape.Tank, dshape.Shape == Shape.Scale);
graph.AddNode(gnode, dshape.Shape == Shape.Tank || dshape.Shape == Shape.TankHot, dshape.Shape == Shape.Scale);
}
foreach (var edge in dshape.Edges)
@ -864,7 +864,7 @@ namespace SchematicDrawing
/// Draw the component image
Rectangle rect = dsh.GetRotatedFlippedImageRectangle(item);
if (item is IRouteBasedDrawingItem && routeBit == false /// closed
if (item is IRouteBasedDrawingItem && routeBit == false /// closed
&& item.GNodes.Count > 0 && item.GNodes[0].Dist < Const.Vacuum /// wet
&& dsh.HasClosedWet) /// has appropriate image
{

View File

@ -0,0 +1,234 @@
using System.IO.MemoryMappedFiles;
using System.Text;
namespace SharedComponents
{
public class LiveLogCache
{
/*// Staticka instancia pre singleton
private static readonly LiveLogCache _instance = new LiveLogCache();
// Uzamykaci objekt pre bezpecny pristup z viacerych vlakien
private static readonly object _lock = new object();
// Zoznam na ukladanie logov
private readonly List<string> _logs = new List<string>();
// Udalost pre notifikaciu pri zmene logov
public event Action<string> LogAdded;
// Sukromny konstruktor (singleton pattern)
private LiveLogCache() { }
// Metoda na ziskanie poctu logov
public int GetCount()
{
return _logs.Count;
}
// Staticka metoda na ziskanie instancie
public static LiveLogCache Instance
{
get
{
lock (_lock)
{
return _instance;
}
}
}
// Verejna vlastnost na ziskanie logov
public IReadOnlyList<string> Logs
{
get
{
lock (_lock)
{
return _logs.AsReadOnly();
}
}
}
// Metoda na pridanie logu
public void AddLog(string log)
{
// Ziskanie aktualneho casu v pozadovanom formate
string timeStamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:");
// Vytvorenie noveho logu s casovou peciatkou na zaciatku
string logWithTimeStamp = $"{timeStamp} {log}";
// Pridanie logu do zoznamu
lock (_lock)
{
_logs.Add(logWithTimeStamp);
}
// Spustenie udalosti pre notifikaciu
LogAdded?.Invoke(logWithTimeStamp);
}
// Metoda na vycistenie logov
public void ClearLogs()
{
lock (_lock)
{
_logs.Clear();
}
// Volitelne: Spusti udalost, ak by sme chceli notifikovat aj o vymazani logov
LogAdded?.Invoke("Logs were cleared.");
}
// Ziskanie vsetkych logov
public List<string> GetAllLogs()
{
return new List<string>(_logs); // Vratime kopiu logov
}
// Ziskanie logov medzi urcitou poziciou (s upravenym indexovanim)
public List<string> GetLogs(int startIndex, int count)
{
// Zabezpeci, ze indexy nebudu mimo rozsahu
return _logs.Skip(startIndex).Take(count).ToList();
}*/
// Zlepseny kod, ktory umoznuje pracu s MemoryMappedFile, namiesto len priestoru vo virtualnej pamati, navyse je tento subor velkostne obmedzeny na 1MB
// Staticka instancia pre singleton
private static readonly LiveLogCache _instance = new LiveLogCache(true);
// Uzamykaci objekt pre bezpecny pristup z viacerych vlakien
private static readonly object _lock = new object();
// Zoznam na ukladanie logov
private readonly List<string> _logs = new List<string>();
// Udalost pre notifikaciu pri zmene logov
public event Action<string> LogAdded;
// Memory-mapped file
private MemoryMappedFile _mmf;
private MemoryMappedViewAccessor _accessor;
private const int MaxLogSize = 1024 * 1024; // 1MB
// Sukromny konstruktor (singleton pattern)
private LiveLogCache(bool itsLogsCreator)
{
if (itsLogsCreator == true)
{
_mmf = MemoryMappedFile.CreateOrOpen("LiveLogCacheMMF", MaxLogSize);
}
else
{
_mmf = MemoryMappedFile.OpenExisting("LiveLogCacheMMF");
}
_accessor = _mmf.CreateViewAccessor();
}
// Metoda na ziskanie poctu logov
public int GetCount()
{
return _logs.Count;
}
// Staticka metoda na ziskanie instancie
public static LiveLogCache Instance
{
get
{
lock (_lock)
{
return _instance;
}
}
}
// Verejna vlastnost na ziskanie logov
public IReadOnlyList<string> Logs
{
get
{
lock (_lock)
{
return _logs.AsReadOnly();
}
}
}
// Metoda na pridanie logu
public void AddLog(string log)
{
// Ziskanie aktualneho casu v pozadovanom formate
string timeStamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:");
// Vytvorenie noveho logu s casovou peciatkou na zaciatku
string logWithTimeStamp = $"{timeStamp} {log}";
// Pridanie logu do zoznamu
lock (_lock)
{
_logs.Add(logWithTimeStamp);
WriteLogToMemoryMappedFile(logWithTimeStamp);
}
// Spustenie udalosti pre notifikaciu
LogAdded?.Invoke(logWithTimeStamp);
}
// Metoda na vycistenie logov
public void ClearLogs()
{
lock (_lock)
{
_logs.Clear();
ClearMemoryMappedFile();
}
// Volitelne: Spusti udalost, ak by sme chceli notifikovat aj o vymazani logov
LogAdded?.Invoke("Logs were cleared.");
}
// Ziskanie vsetkych logov
public List<string> GetAllLogs()
{
return new List<string>(_logs); // Vratime kopiu logov
}
// Ziskanie logov medzi urcitou poziciou (s upravenym indexovanim)
public List<string> GetLogs(int startIndex, int count)
{
// Zabezpeci, ze indexy nebudu mimo rozsahu
return _logs.Skip(startIndex).Take(count).ToList();
}
// Metoda na naplnenie ListView
/*public void PopulateListView(ListView listView)
{
listView.Items.Clear();
lock (_lock)
{
foreach (var log in _logs)
{
listView.Items.Add(new ListView Item(log));
}
}
}*/
// Write log to memory-mapped file
private void WriteLogToMemoryMappedFile(string log)
{
byte[] logBytes = Encoding.UTF8.GetBytes(log + Environment.NewLine);
_accessor.WriteArray(0, logBytes, 0, logBytes.Length);
}
// Clear memory-mapped file
private void ClearMemoryMappedFile()
{
byte[] emptyBytes = new byte[MaxLogSize];
_accessor.WriteArray(0, emptyBytes, 0, emptyBytes.Length);
}
}
}

View File

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<LangVersion>10.0</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,5 @@
is_global = true
build_property.RootNamespace = SharedComponents
build_property.ProjectDir = C:\Users\micha\git\tbf\SharedComponents\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =

View File

@ -0,0 +1,7 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Threading;
global using global::System.Threading.Tasks;

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\micha\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.14.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\micha\.nuget\packages\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View File

@ -25,7 +25,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;LANG_PL</DefineConstants>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

95
TBF.sln
View File

@ -5,16 +5,18 @@ VisualStudioVersion = 17.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TBF", "TBF\TBF.csproj", "{8648FD92-CDA1-4C3A-B5F9-FE547CE1FA48}"
ProjectSection(ProjectDependencies) = postProject
{7EBEEA14-91C4-48D7-AF0A-7A4BC3FF9A28} = {7EBEEA14-91C4-48D7-AF0A-7A4BC3FF9A28}
{C8939821-BA5C-4988-A3D0-BF53B74865C7} = {C8939821-BA5C-4988-A3D0-BF53B74865C7}
{211B5E3F-9996-48A7-ABDE-C878DD2D71C2} = {211B5E3F-9996-48A7-ABDE-C878DD2D71C2}
{0C0A1F4D-1363-4544-A7C5-196C76D26CCA} = {0C0A1F4D-1363-4544-A7C5-196C76D26CCA}
{0F79CA69-9DBC-41F3-A6FC-5A2937365343} = {0F79CA69-9DBC-41F3-A6FC-5A2937365343}
{439D0878-C76E-452B-B17D-209A89E91D36} = {439D0878-C76E-452B-B17D-209A89E91D36}
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB} = {9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}
{743DF7DB-C7B6-42EB-986D-0F485E5588E4} = {743DF7DB-C7B6-42EB-986D-0F485E5588E4}
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE} = {46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}
{211B5E3F-9996-48A7-ABDE-C878DD2D71C2} = {211B5E3F-9996-48A7-ABDE-C878DD2D71C2}
{32817BF9-E380-4467-9C7F-936F4B122BC7} = {32817BF9-E380-4467-9C7F-936F4B122BC7}
{439D0878-C76E-452B-B17D-209A89E91D36} = {439D0878-C76E-452B-B17D-209A89E91D36}
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE} = {46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}
{743DF7DB-C7B6-42EB-986D-0F485E5588E4} = {743DF7DB-C7B6-42EB-986D-0F485E5588E4}
{7EBEEA14-91C4-48D7-AF0A-7A4BC3FF9A28} = {7EBEEA14-91C4-48D7-AF0A-7A4BC3FF9A28}
{8F942729-F454-4C99-BA6C-746962065AE3} = {8F942729-F454-4C99-BA6C-746962065AE3}
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB} = {9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}
{C8939821-BA5C-4988-A3D0-BF53B74865C7} = {C8939821-BA5C-4988-A3D0-BF53B74865C7}
{FA9ABAD1-7184-4295-ADE8-D44F2E3DE6B2} = {FA9ABAD1-7184-4295-ADE8-D44F2E3DE6B2}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Results", "Results\Results.csproj", "{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}"
@ -26,8 +28,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Config", "Config\Config.csp
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResultsBrowser", "ResultsBrowser\ResultsBrowser.csproj", "{07BA543A-54CA-4A59-9AD9-DDE7038E1BF9}"
ProjectSection(ProjectDependencies) = postProject
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB} = {9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}
{8648FD92-CDA1-4C3A-B5F9-FE547CE1FA48} = {8648FD92-CDA1-4C3A-B5F9-FE547CE1FA48}
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB} = {9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceTest", "DeviceTest\DeviceTest.csproj", "{6D3384DC-4638-4A92-91A8-F39D900377C6}"
@ -104,6 +106,19 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LabelPrinting", "LabelPrint
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TBFTests", "TBFTests\TBFTests.csproj", "{77EB589F-C670-4489-AAD6-2A3C02061FD1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppDiagnostic", "AppDiagnostic\AppDiagnostic.csproj", "{FA9ABAD1-7184-4295-ADE8-D44F2E3DE6B2}"
ProjectSection(ProjectDependencies) = postProject
{8F942729-F454-4C99-BA6C-746962065AE3} = {8F942729-F454-4C99-BA6C-746962065AE3}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedComponents", "SharedComponents\SharedComponents.csproj", "{8F942729-F454-4C99-BA6C-746962065AE3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sensus.iPerl.RfidCom", "..\iPerlHead\Sensus.iPerl.RfidCom\Sensus.iPerl.RfidCom.csproj", "{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sensus.iPerl.TestConsole", "..\iPerlHead\Sensus.iPerl.TestConsole\Sensus.iPerl.TestConsole.csproj", "{5025ED8B-A94F-4E58-8BE0-68481B061609}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NfcS5_DLL", "..\NfcS5_DLL\NfcS5_DLL.csproj", "{5954D496-CAAB-4F7A-BDE2-BDC8F47DAB19}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -127,15 +142,15 @@ Global
{8648FD92-CDA1-4C3A-B5F9-FE547CE1FA48}.Release|x86.ActiveCfg = Release|x86
{8648FD92-CDA1-4C3A-B5F9-FE547CE1FA48}.Release|x86.Build.0 = Release|x86
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}.Debug|x86.ActiveCfg = Debug|Any CPU
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}.Release|Any CPU.Build.0 = Release|Any CPU
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}.Release|x86.ActiveCfg = Release|Any CPU
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}.Release|Any CPU.Build.0 = Release|Any CPU
{743DF7DB-C7B6-42EB-986D-0F485E5588E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{743DF7DB-C7B6-42EB-986D-0F485E5588E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{743DF7DB-C7B6-42EB-986D-0F485E5588E4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@ -464,6 +479,66 @@ Global
{77EB589F-C670-4489-AAD6-2A3C02061FD1}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{77EB589F-C670-4489-AAD6-2A3C02061FD1}.Release|x86.ActiveCfg = Release|Any CPU
{77EB589F-C670-4489-AAD6-2A3C02061FD1}.Release|x86.Build.0 = Release|Any CPU
{FA9ABAD1-7184-4295-ADE8-D44F2E3DE6B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA9ABAD1-7184-4295-ADE8-D44F2E3DE6B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA9ABAD1-7184-4295-ADE8-D44F2E3DE6B2}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{FA9ABAD1-7184-4295-ADE8-D44F2E3DE6B2}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{FA9ABAD1-7184-4295-ADE8-D44F2E3DE6B2}.Debug|x86.ActiveCfg = Debug|Any CPU
{FA9ABAD1-7184-4295-ADE8-D44F2E3DE6B2}.Debug|x86.Build.0 = Debug|Any CPU
{FA9ABAD1-7184-4295-ADE8-D44F2E3DE6B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA9ABAD1-7184-4295-ADE8-D44F2E3DE6B2}.Release|Any CPU.Build.0 = Release|Any CPU
{FA9ABAD1-7184-4295-ADE8-D44F2E3DE6B2}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{FA9ABAD1-7184-4295-ADE8-D44F2E3DE6B2}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{FA9ABAD1-7184-4295-ADE8-D44F2E3DE6B2}.Release|x86.ActiveCfg = Release|Any CPU
{FA9ABAD1-7184-4295-ADE8-D44F2E3DE6B2}.Release|x86.Build.0 = Release|Any CPU
{8F942729-F454-4C99-BA6C-746962065AE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8F942729-F454-4C99-BA6C-746962065AE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8F942729-F454-4C99-BA6C-746962065AE3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{8F942729-F454-4C99-BA6C-746962065AE3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{8F942729-F454-4C99-BA6C-746962065AE3}.Debug|x86.ActiveCfg = Debug|Any CPU
{8F942729-F454-4C99-BA6C-746962065AE3}.Debug|x86.Build.0 = Debug|Any CPU
{8F942729-F454-4C99-BA6C-746962065AE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8F942729-F454-4C99-BA6C-746962065AE3}.Release|Any CPU.Build.0 = Release|Any CPU
{8F942729-F454-4C99-BA6C-746962065AE3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{8F942729-F454-4C99-BA6C-746962065AE3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{8F942729-F454-4C99-BA6C-746962065AE3}.Release|x86.ActiveCfg = Release|Any CPU
{8F942729-F454-4C99-BA6C-746962065AE3}.Release|x86.Build.0 = Release|Any CPU
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Debug|x86.ActiveCfg = Debug|Any CPU
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Debug|x86.Build.0 = Debug|Any CPU
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Release|Any CPU.Build.0 = Release|Any CPU
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Release|x86.ActiveCfg = Release|Any CPU
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Release|x86.Build.0 = Release|Any CPU
{5025ED8B-A94F-4E58-8BE0-68481B061609}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5025ED8B-A94F-4E58-8BE0-68481B061609}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5025ED8B-A94F-4E58-8BE0-68481B061609}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{5025ED8B-A94F-4E58-8BE0-68481B061609}.Debug|Mixed Platforms.Build.0 = Debug|x86
{5025ED8B-A94F-4E58-8BE0-68481B061609}.Debug|x86.ActiveCfg = Debug|x86
{5025ED8B-A94F-4E58-8BE0-68481B061609}.Debug|x86.Build.0 = Debug|x86
{5025ED8B-A94F-4E58-8BE0-68481B061609}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5025ED8B-A94F-4E58-8BE0-68481B061609}.Release|Any CPU.Build.0 = Release|Any CPU
{5025ED8B-A94F-4E58-8BE0-68481B061609}.Release|Mixed Platforms.ActiveCfg = Release|x86
{5025ED8B-A94F-4E58-8BE0-68481B061609}.Release|Mixed Platforms.Build.0 = Release|x86
{5025ED8B-A94F-4E58-8BE0-68481B061609}.Release|x86.ActiveCfg = Release|x86
{5025ED8B-A94F-4E58-8BE0-68481B061609}.Release|x86.Build.0 = Release|x86
{5954D496-CAAB-4F7A-BDE2-BDC8F47DAB19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5954D496-CAAB-4F7A-BDE2-BDC8F47DAB19}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5954D496-CAAB-4F7A-BDE2-BDC8F47DAB19}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{5954D496-CAAB-4F7A-BDE2-BDC8F47DAB19}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{5954D496-CAAB-4F7A-BDE2-BDC8F47DAB19}.Debug|x86.ActiveCfg = Debug|Any CPU
{5954D496-CAAB-4F7A-BDE2-BDC8F47DAB19}.Debug|x86.Build.0 = Debug|Any CPU
{5954D496-CAAB-4F7A-BDE2-BDC8F47DAB19}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5954D496-CAAB-4F7A-BDE2-BDC8F47DAB19}.Release|Any CPU.Build.0 = Release|Any CPU
{5954D496-CAAB-4F7A-BDE2-BDC8F47DAB19}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{5954D496-CAAB-4F7A-BDE2-BDC8F47DAB19}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{5954D496-CAAB-4F7A-BDE2-BDC8F47DAB19}.Release|x86.ActiveCfg = Release|Any CPU
{5954D496-CAAB-4F7A-BDE2-BDC8F47DAB19}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -401,6 +401,24 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Application diagnostic.
/// </summary>
internal static string AppDiagnostic {
get {
return ResourceManager.GetString("AppDiagnostic", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Application diagnostic.
/// </summary>
internal static string Application_Diagnostic {
get {
return ResourceManager.GetString("Application_Diagnostic", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Approval.
/// </summary>
@ -4775,6 +4793,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Reg. min step.
/// </summary>
internal static string RegulMinStep {
get {
return ResourceManager.GetString("RegulMinStep", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Relative Q from.
/// </summary>

View File

@ -197,6 +197,12 @@
</data>
<data name="Reg_valve" xml:space="preserve">
<value>Reg. valve</value>
</data>
<data name="RegulMinStep" xml:space="preserve">
<value>Reg. min step</value>
</data>
<data name="Application_Diagnostic" xml:space="preserve">
<value>Application diagnostic</value>
</data>
<data name="Balance" xml:space="preserve">
<value>Scale</value>
@ -2442,6 +2448,9 @@
</data>
<data name="Upgrade_DB" xml:space="preserve">
<value>Upgrade database</value>
</data>
<data name="AppDiagnostic" xml:space="preserve">
<value>Application diagnostic</value>
</data>
<data name="About" xml:space="preserve">
<value>About</value>

View File

@ -8,6 +8,7 @@ using Dirichlet.Numerics;
using TBF.Boxes;
using TBF.Rig.ControlBoard;
using TBF.Rig.GenericDevices;
using System.Windows.Forms;
namespace TBF.Rig.BuiltIn
{
@ -194,66 +195,79 @@ namespace TBF.Rig.BuiltIn
/// <remarks>Only Elde.Valve valves are used, other valves on the lists are ignored</remarks>
public SetValvesOp(IControlBoard cb, bool open, OutputPath outPath, DateTimeBox timeStamp, FloatBox switchTime)
{
this.cb = cb;
if (this.cb == null) throw new ArgumentNullException("ctrlBoard");
this.timeStamp = timeStamp;
this.switchTime = switchTime;
this.startStopValveBitNr = outPath.StartValve1 is Valve.Valve ? (outPath.StartValve1 as Valve.Valve).BitPosition : 0;
IList<IValve> none = new List<IValve>(); /// An empty list of valves
switchPointsRaw = new List<SwitchPoint>();
if (open)
try
{
if (outPath.InvertSV1)
AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve1), 0); /// close SV1
this.cb = cb;
if (this.cb == null) throw new ArgumentNullException("ctrlBoard");
this.timeStamp = timeStamp;
this.switchTime = switchTime;
this.startStopValveBitNr = outPath.StartValve1 is Valve.Valve ? (outPath.StartValve1 as Valve.Valve).BitPosition : 0;
IList<IValve> none = new List<IValve>(); /// An empty list of valves
switchPointsRaw = new List<SwitchPoint>();
if (open)
{
if (outPath.InvertSV1)
AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve1), 0); /// close SV1
else
AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve1), none, 0); /// open SV1
if (outPath.StartValve2 != null)
{
if (outPath.InvertSV2)
AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve2), -outPath.LagSV2); /// close SV2 after lag
else
AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve2), none, -outPath.LagSV2); /// open SV2 after lag
}
if (outPath.StartValve3 != null)
{
if (outPath.InvertSV3)
AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve3), -outPath.LagSV3); /// close SV3 after lag
else
AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve3), none, -outPath.LagSV3); /// open SV3 after lag
}
}
else
AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve1), none, 0); /// open SV1
if (outPath.StartValve2 != null)
{
if (outPath.InvertSV2)
AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve2), -outPath.LagSV2); /// close SV2 after lag
if (outPath.InvertSV1)
AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve1), none, 0); /// open SV1
else
AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve2), none, -outPath.LagSV2); /// open SV2 after lag
AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve1), 0); /// close SV1
if (outPath.StartValve2 != null)
{
if (outPath.InvertSV2)
AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve2), none, outPath.LagSV2); /// open SV2 after lag
else
AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve2), outPath.LagSV2); /// close SV2 after lag
}
if (outPath.StartValve3 != null)
{
if (outPath.InvertSV3)
AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve3), none, outPath.LagSV3); /// open SV3 after lag
else
AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve3), outPath.LagSV3); /// close SV3 after lag
}
}
if (outPath.StartValve3 != null)
{
if (outPath.InvertSV3)
AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve3), -outPath.LagSV3); /// close SV3 after lag
else
AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve3), none, -outPath.LagSV3); /// open SV3 after lag
}
switchPoints = SortAndMergeSwitchPoints(switchPointsRaw);
timeShift = -switchPoints[0].TimeSec;
MakeMasks(switchPoints, timeShift);
}
else
catch (Exception ex)
{
if (outPath.InvertSV1)
AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve1), none, 0); /// open SV1
else
AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve1), 0); /// close SV1
if (outPath.StartValve2 != null)
{
if (outPath.InvertSV2)
AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve2), none, outPath.LagSV2); /// open SV2 after lag
else
AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve2), outPath.LagSV2); /// close SV2 after lag
}
if (outPath.StartValve3 != null)
{
if (outPath.InvertSV3)
AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve3), none, outPath.LagSV3); /// open SV3 after lag
else
AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve3), outPath.LagSV3); /// close SV3 after lag
}
MessageBox.Show(
$"Chyba počas zastavenia regulácie prietoku, v ramci SetValvesOp():\n{ex.Message}\n\nStack trace:\n{ex.StackTrace}",
"Chyba",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
throw;
}
switchPoints = SortAndMergeSwitchPoints(switchPointsRaw);
timeShift = -switchPoints[0].TimeSec;
MakeMasks(switchPoints, timeShift);
}
/// <summary>Start this operation</summary>

View File

@ -93,7 +93,7 @@ namespace TBF.Rig.ControlBoard
/// <returns>Operation</returns>
IOperation QueryMeasurementEndOp();
void StopFlowControl(bool isFromUI, int regVId);
void StopFlowControl(bool isFromUI, int regVId, int regulationMinStep = 0);
void StopAll(bool isFromUI);
}

View File

@ -492,7 +492,7 @@ namespace TBF.Rig.ControlBoard.Papouch
return null;
}
public void StopFlowControl(bool isFromUI, int rvId)
public void StopFlowControl(bool isFromUI, int rvId, int regulationMinStep = 0)
{
}

View File

@ -55,6 +55,9 @@ namespace TBF.Rig.ControlBoard.Uni
public int StabTime { get; set; } /// SetFlow
public int InitDacVal { get; set; } /// SetFlow
public int DivThreshold { get; set; } /// StartTest argument
public int RegulationMinStep { get;
set;
}
public Action()
@ -78,6 +81,7 @@ namespace TBF.Rig.ControlBoard.Uni
RVMovePar1 = 0;
RVMovePar2 = 0;
InitDacVal = 0;
RegulationMinStep = 0;
}
@ -123,7 +127,7 @@ namespace TBF.Rig.ControlBoard.Uni
}
///----------------------------------------------------------------------------------------------
public static Action MeasureFlow(bool isFromUI, int flowMeterId)
public static Action MeasureFlow(bool isFromUI, int flowMeterId, int regulationMinStep = 0)
{
return new Action
{
@ -163,7 +167,7 @@ namespace TBF.Rig.ControlBoard.Uni
///----------------------------------------------------------------------------------------------
public static Action SetFlow(bool isFromUI, int regValveId, double freqLo, double freqHi,
int pid, int stabTime_ms)
int pid, int stabTime_ms, int regulationMinStep = 0)
{
int rvMovePar1 = Convert.ToInt32(Math.Round(13.1072 * freqLo));
int rvMovePar2 = Convert.ToInt32(Math.Round(13.1072 * freqHi));
@ -178,6 +182,7 @@ namespace TBF.Rig.ControlBoard.Uni
RegVMode = RegValveMode.TargetFrequency,
RVMovePar1 = rvMovePar1,
RVMovePar2 = rvMovePar2,
//RegulationMinStep = regulationMinStep,
PID = pid,
TolerRV = (regValveId == TBF.Rig.Uni.RegValveAnalog.RegValve.RVAnalogIdx)
? Convert.ToInt32(Math.Round(13.1072 * 0.015 * freqLo)) : 0,
@ -207,7 +212,7 @@ namespace TBF.Rig.ControlBoard.Uni
///----------------------------------------------------------------------------------------------
public static Action StartTest(bool isFromUI, int flowMId, int divId, int divThreshold,
bool isSyncMethod, bool isDivUsed, bool isDelayedStart, bool isStartStop,
bool isProlonged, int totalPulsesCount, int massPulsesCount = 0)
bool isProlonged, int totalPulsesCount, int massPulsesCount = 0, int regulationMinStep = 0)
{
return new Action
{
@ -225,6 +230,7 @@ namespace TBF.Rig.ControlBoard.Uni
TotalPulsesCount = totalPulsesCount,
MassPulsesCount = (massPulsesCount <= 0) ? totalPulsesCount : massPulsesCount,
StartStop = Command.Start,
//RegulationMinStep = regulationMinStep,
};
}
void SetStartTestArgs(Action action)
@ -272,7 +278,7 @@ namespace TBF.Rig.ControlBoard.Uni
}
///----------------------------------------------------------------------------------------------
public static Action RegVlvIncrMove(bool isFromUI, int regValveId, double timeSec)
public static Action RegVlvIncrMove(bool isFromUI, int regValveId, double timeSec, int regulationMinStep = 0)
{
int rvMovePar = Math.Abs(Convert.ToInt32(Math.Round(timeSec / 0.050))); /// Step is 50 ms
@ -285,6 +291,7 @@ namespace TBF.Rig.ControlBoard.Uni
RegVMode = (timeSec >= 0) ? RegValveMode.PulseWidth : (RegValveMode.PulseWidth | RegValveMode.NegPulseWidth),
RVMovePar1 = rvMovePar,
RVMovePar2 = rvMovePar,
//RegulationMinStep = regulationMinStep,
};
}
void SetRegVlvIncrMoveArgs(Action action)
@ -293,6 +300,7 @@ namespace TBF.Rig.ControlBoard.Uni
RegVMode = action.RegVMode;
RVMovePar1 = action.RVMovePar1;
RVMovePar2 = action.RVMovePar2;
//RegulationMinStep = action.RegulationMinStep;
}
/// Check whether new action arguments are compatible with alredy collected arguments (true = yes)
bool CheckSharedRegVlvIncrMoveArgs(Action newAction)
@ -302,7 +310,7 @@ namespace TBF.Rig.ControlBoard.Uni
}
///----------------------------------------------------------------------------------------------
public static Action RegVlvMoveToPos(bool isFromUI, int regValveId, int adcValLo, int adcValHi = -1)
public static Action RegVlvMoveToPos(bool isFromUI, int regValveId, int adcValLo, int adcValHi = -1, int regulationMinStep = 0)
{
int rvMovePar1, rvMovePar2;
@ -318,7 +326,7 @@ namespace TBF.Rig.ControlBoard.Uni
rvMovePar1 = Math.Max(adcValLo - 5, 0);
rvMovePar2 = Math.Min(adcValLo + 5, 1023);
}
return new Action
{
ActionId = ActionID.RegVlvMoveToPos,
@ -328,6 +336,7 @@ namespace TBF.Rig.ControlBoard.Uni
RegVMode = RegValveMode.TargetPosition,
RVMovePar1 = rvMovePar1,
RVMovePar2 = rvMovePar2,
//RegulationMinStep = regulationMinStep,
};
}
void SetRegVlvMoveToPosArgs(Action action)
@ -336,6 +345,7 @@ namespace TBF.Rig.ControlBoard.Uni
RegVMode = action.RegVMode;
RVMovePar1 = action.RVMovePar1;
RVMovePar2 = action.RVMovePar2;
//RegulationMinStep = action.RegulationMinStep;
}
/// Check whether new action arguments are compatible with alredy collected arguments (true = yes)
bool CheckSharedRegVlvMoveToPosArgs(Action newAction)
@ -345,7 +355,7 @@ namespace TBF.Rig.ControlBoard.Uni
}
///----------------------------------------------------------------------------------------------
public static Action RegVlvStop(bool isFromUI, int regValveId)
public static Action RegVlvStop(bool isFromUI, int regValveId, int RegulationMinStep = 0)
{
return new Action
{
@ -356,6 +366,7 @@ namespace TBF.Rig.ControlBoard.Uni
RegVMode = RegValveMode.Stop,
RVMovePar1 = 0,
RVMovePar2 = 0,
//RegulationMinStep = RegulationMinStep
};
}
void SetRegVlvStopArgs(Action action)
@ -364,6 +375,7 @@ namespace TBF.Rig.ControlBoard.Uni
RegVMode = action.RegVMode;
RVMovePar1 = action.RVMovePar1;
RVMovePar2 = action.RVMovePar2;
//RegulationMinStep = action.RegulationMinStep;
}
/// Check whether new action arguments are compatible with alredy collected arguments (true = yes)
bool CheckSharedRegVlvStopArgs(Action newAction)
@ -604,7 +616,8 @@ namespace TBF.Rig.ControlBoard.Uni
combinedAction.TolerRV,
combinedAction.StabTime,
combinedAction.InitDacVal,
combinedAction.DivThreshold);
combinedAction.DivThreshold,
combinedAction.RegulationMinStep);
return combinedAction;
}

View File

@ -5,6 +5,8 @@ using System;
using System.Diagnostics;
using log4net;
using Dirichlet.Numerics;
using Common;
using System.Web.Routing;
namespace TBF.Rig.ControlBoard.Uni
{
@ -88,7 +90,7 @@ namespace TBF.Rig.ControlBoard.Uni
message[30] = (byte)(action.RVMovePar2 & 0xFF);
message[31] = (byte)((action.RVMovePar2 >> 8) & 0xFF);
message[32] = GetRVStopParam(action);
/// DA1
message[33] = (byte)(arguments.InitDacVal & 0xFF);
message[34] = (byte)((arguments.InitDacVal >> 8) & 0xFF);
@ -98,8 +100,21 @@ namespace TBF.Rig.ControlBoard.Uni
message[37] = (byte)Math.Max(0, Math.Min(255, arguments.StabTime)); /// StabRV
message[38] = (byte)((arguments.DivThreshold >> 2) & 0xFF);
message[39] = 0;
message[40] = 0;
//---
message[39] = (byte)((action.RegulationMinStep << 4) & 0xFF); // ak 0 = koli kompatibilite, 1-6 = hodnoty prislusne pre spodnu saturaciu vypinacej periody casu
message[40] = (byte)((action.RegulationMinStep << 4) & 0xFF);
//---
/*int x = 0;
if (action.RegVId == 1 || action.RegVId == 2) x = 3;
else if (action.RegVId == 3 || action.RegVId == 4) x = 5;
else if (action.RegVId == 5 || action.RegVId == 5) x = 3;
message[39] = (byte)((x << 4) & 0xFF);
message[40] = (byte)((x << 4) & 0xFF);*/
/*//---
message[39] = 0x50; // ak 0 = koli kompatibilite, 1-6 = hodnoty prislusne pre spodnu saturaciu vypinacej periody casu
message[40] = 0x50;
//---*/
Debug.Assert(40 == PayloadLen + 2);
/// Checksum (2 bytes)
@ -108,6 +123,8 @@ namespace TBF.Rig.ControlBoard.Uni
message[PayloadLen + 3] = (byte)(checksum & 0xFF);
message[PayloadLen + 4] = (byte)((checksum >> 8) & 0xFF);
log.Info("");
return message;
}
@ -151,11 +168,16 @@ namespace TBF.Rig.ControlBoard.Uni
return (byte)0x20;
}
if ((a.ActionId & ActionID.SetFlow) != 0 && a.RegVId == TBF.Rig.Uni.RegValveAnalog.RegValve.RVAnalogIdx)
else if ((a.ActionId & ActionID.SetFlow) != 0 && a.RegVId == TBF.Rig.Uni.RegValveAnalog.RegValve.RVAnalogIdx)
{
return (byte)0x42;
}
/*else
{
return (a.RegulationMinStep >= 0 || a.RegulationMinStep <= 6)?(byte)(a.RegulationMinStep << 4):(byte)(7<<4);
}*/
return 0;
}
}

View File

@ -2,6 +2,9 @@
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using System;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using log4net;
using TBF.Rig.GenericDevices;
@ -16,7 +19,8 @@ namespace TBF.Rig.ControlBoard.Uni
/// Set by the constructor
///
readonly UniCB uniCB;
readonly TBF.Rig.Uni.FlowMeter.FlowMeter flowMeter;
readonly object flowMeter;
readonly TBF.Rig.Uni.FlowMetersInParallel.FlowMeter flowMeterInParallel;
readonly TBF.Rig.Uni.Diverter.Diverter diverter;
readonly int pulsesCount; /// Number of reference pulses for a complete test
readonly bool withDiverter; /// Test with diverter (and scale)
@ -50,36 +54,119 @@ namespace TBF.Rig.ControlBoard.Uni
public StandingStartStopTestOp(UniCB cb, OutputPath devices, int pulsesCount, bool withDiverter)
{
this.uniCB = cb;
try
{
flowMeter = devices.FlowMeter as TBF.Rig.Uni.FlowMeter.FlowMeter;
if(flowMeter == null) flowMeter = devices.FlowMeter as TBF.Rig.Uni.FlowMetersInParallel.FlowMeter;
flowMeter = devices.FlowMeter as TBF.Rig.Uni.FlowMeter.FlowMeter;
if (flowMeter == null) throw new ArgumentNullException("Invalid flow meter");
if (flowMeter == null) throw new ArgumentNullException("Invalid flow meter");
}
catch (Exception ex)
{
string deviceInfo = GetAllDevicesInfo(devices);
string flowMeterStatus = devices.FlowMeter == null
? "devices.FlowMeter je NULL"
: $"devices.FlowMeter je typu: {devices.FlowMeter.GetType().FullName}";
MessageBox.Show(
$"Chyba počas zastavenia regulácie prietoku, v ramci StandingStartStopTestOp() pre flowMeter:\n" +
$"{ex.Message}\n\n" +
$"Diagnostika:\n{flowMeterStatus}\n\n" +
$"{deviceInfo}\n\n" +
$"Stack trace:\n{ex.StackTrace}",
"Chyba",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
throw;
}
this.pulsesCount = pulsesCount;
this.withDiverter = withDiverter;
if (withDiverter)
{
diverter = devices.Diverter as TBF.Rig.Uni.Diverter.Diverter;
if (diverter == null) throw new ArgumentNullException("Invalid diverter");
try
{
diverter = devices.Diverter as TBF.Rig.Uni.Diverter.Diverter;
if (diverter == null) throw new ArgumentNullException("Invalid diverter");
}
catch (Exception ex)
{
string deviceInfo = GetAllDevicesInfo(devices);
MessageBox.Show(
$"Chyba počas zastavenia regulácie prietoku, v ramci StandingStartStopTestOp() pre diverter:\n" +
$"{ex.Message}\n\n{deviceInfo}\n\nStack trace:\n{ex.StackTrace}",
"Chyba",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
throw;
}
}
log.Debug(this.ToString());
}
/// <summary>
string GetAllDevicesInfo(object obj)
{
if (obj == null) return "devices objekt je null.";
StringBuilder sb = new StringBuilder();
sb.AppendLine("Zoznam zariadení v devices:");
var props = obj.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
foreach (var prop in props)
{
try
{
object value = prop.GetValue(obj);
string valueStr = value != null ? value.ToString() : "null";
sb.AppendLine($"{prop.Name}: {valueStr}");
}
catch (Exception ex)
{
sb.AppendLine($"{prop.Name}: [Chyba pri načítaní - {ex.Message}]");
}
}
return sb.ToString();
}
/// <summary>
/// Start this operation
/// </summary>
public void Start()
public void Start()
{
log.InfoFormat("Start() Et#={0} pulses={1} withDiverter={2}", flowMeter.Idx1, pulsesCount, withDiverter);
if (flowMeter is TBF.Rig.Uni.FlowMeter.FlowMeter)
{
log.InfoFormat("Start() Et#={0} pulses={1} withDiverter={2}", ((TBF.Rig.Uni.FlowMeter.FlowMeter)flowMeter).Idx1, pulsesCount, withDiverter);
/// Start the test (and the flow measurement)
if (withDiverter) { uniCB.DivResolution = diverter.Resolution; }
uniCB.SetActivity(Activity.StandingStartStopTest);
uniCB.StartTest(false, flowMeter.Idx1, (withDiverter ? diverter.DiverterNr : 0), 0,
false, withDiverter, false, true, false, pulsesCount);
/// Start the test (and the flow measurement)
if (withDiverter) { uniCB.DivResolution = diverter.Resolution; }
uniCB.SetActivity(Activity.StandingStartStopTest);
uniCB.StartTest(false, ((TBF.Rig.Uni.FlowMeter.FlowMeter)flowMeter).Idx1, (withDiverter ? diverter.DiverterNr : 0), 0,
false, withDiverter, false, true, false, pulsesCount);
opState = OpState.StartingTest;
opState = OpState.StartingTest;
}
else if (flowMeter is TBF.Rig.Uni.FlowMetersInParallel.FlowMeter)
{
log.InfoFormat("Start() Et#={0} pulses={1} withDiverter={2}", ((TBF.Rig.Uni.FlowMetersInParallel.FlowMeter)flowMeter).Idx1, pulsesCount, withDiverter);
/// Start the test (and the flow measurement)
if (withDiverter) { uniCB.DivResolution = diverter.Resolution; }
uniCB.SetActivity(Activity.StandingStartStopTest);
uniCB.StartTest(false, ((TBF.Rig.Uni.FlowMetersInParallel.FlowMeter)flowMeter).Idx1, (withDiverter ? diverter.DiverterNr : 0), 0,
false, withDiverter, false, true, false, pulsesCount);
opState = OpState.StartingTest;
}
}
/// <summary>

View File

@ -17,6 +17,8 @@ using TBF.Boxes;
using TBF.Rig.GenericDevices;
using TBF.Rig.Sequences;
using TBF.UiBridge;
using AppDiagnostic;
using SharedComponents;
namespace TBF.Rig.ControlBoard.Uni
{
@ -547,7 +549,7 @@ namespace TBF.Rig.ControlBoard.Uni
if (!outputsInitialized || (outputLatch & routeMask) != (route & routeMask)) /// || (StateMachine.Time - lastStateMachineTime) >= 15)
{
var actionsToModify = actionQueue.Where(x => (x.ActionId == ActionID.ChangeRoute));
var actionsToModify = actionQueue.Where(x => (x.ActionId == ActionID.ChangeRoute));
bool oneModified = false;
foreach (var a in actionsToModify)
{
@ -573,7 +575,11 @@ namespace TBF.Rig.ControlBoard.Uni
var combinedAction = Action.FetchNonConflictingActions(actionQueue); /// Default action is RequestDataOnly
combinedAction.RegulationMinStep = devices.RegulMinStep;
byte[] outData = OutputMessage.GetMessage(combinedAction, config, (ulong)valvesToInvert);
if (outData != null && outData.Length > 0)
{
if ((combinedAction.ActionId & ActionID.ChangeRoute) != 0)
@ -595,7 +601,7 @@ namespace TBF.Rig.ControlBoard.Uni
{
serialPort.Write(outData, 0, outData.Length);
lastSentTime = DateTime.Now;
}
}
log.Debug(" " + OutputMessage.Caption());
log.Debug(Telegram.LogTelegram(string.Format("Sent {0}: ", lastSentTime.ToString("HH:mm:ss")), outData));
@ -615,7 +621,7 @@ namespace TBF.Rig.ControlBoard.Uni
{
}
#endregion
#endregion
#region IControlBoard interface
@ -781,12 +787,13 @@ namespace TBF.Rig.ControlBoard.Uni
#endregion
public void MeasureFlow(bool isFromUI, int flowMeterId)
public void MeasureFlow(bool isFromUI, int flowMeterId, int regulationMinStep = 0)
{
if (IsUIBlocked && isFromUI) return;
actionQueue.Enqueue(Action.MeasureFlow(isFromUI, flowMeterId));
actionQueue.Enqueue(Action.MeasureFlow(isFromUI, flowMeterId, regulationMinStep));
log.InfoFormat("Enqueue( MeasureFlow(fm={0}) )", flowMeterId);
foreach (var a in actionQueue) log.DebugFormat(" {0}", a);
}
@ -794,12 +801,13 @@ namespace TBF.Rig.ControlBoard.Uni
/// To be used with a regulation valve controlled by incremental pulses.
/// Stability time is fixed: 200 ms
/// </summary>
public void SetFlow(bool isFromUI, int regVId, double freqLo, double freqHi)
public void SetFlow(bool isFromUI, int regVId, double freqLo, double freqHi, int regulationMinStep = 0)
{
if (IsUIBlocked && isFromUI) return;
actionQueue.Enqueue(Action.SetFlow(isFromUI, regVId, freqLo, freqHi, Convert.ToInt32(Math.Round(Devices.PidCoef)), 200));
actionQueue.Enqueue(Action.SetFlow(isFromUI, regVId, freqLo, freqHi, Convert.ToInt32(Math.Round(Devices.PidCoef)), 200, regulationMinStep));
log.InfoFormat("Enqueue( SetFlow(rv={0}, fLo={1}, fHi={2}, pid={3}) )", regVId, freqLo, freqHi, Convert.ToInt32(Math.Round(Devices.PidCoef)));
foreach (var a in actionQueue) log.DebugFormat(" {0}", a);
}
@ -814,22 +822,23 @@ namespace TBF.Rig.ControlBoard.Uni
totalPulsesCount, massPulsesCount));
log.InfoFormat("Enqueue( StartTest(fm={0}, div={1}, Sync={2}, withDiv={3}, s/s={4}, prolonged={5} pulsesCount={6} massPulsesCount={7}) )",
flowMId, divId, isSyncMethod, isDivUsed, isStartStop, isProlonged, totalPulsesCount, massPulsesCount);
foreach (var a in actionQueue) log.DebugFormat(" {0}", a);
}
public void StopFlowControl(bool isFromUI, int regVId)
public void StopFlowControl(bool isFromUI, int regVId, int regulationMinStep = 0)
{
if (IsUIBlocked && isFromUI) return;
if (regVId < TBF.Rig.Uni.RegValveAnalog.RegValve.RVAnalogIdx)
{
actionQueue.Enqueue(Action.RegVlvStop(isFromUI, regVId));
actionQueue.Enqueue(Action.RegVlvStop(isFromUI, regVId, regulationMinStep));
log.InfoFormat("Enqueue( RegVlvStop(rv={0}) )", regVId);
}
else if (regVId == TBF.Rig.Uni.RegValveAnalog.RegValve.RVAnalogIdx)
{
int dacVal = Data.StavDA[0];
actionQueue.Enqueue(Action.RegVlvMoveToPos(isFromUI, regVId, dacVal));
actionQueue.Enqueue(Action.RegVlvMoveToPos(isFromUI, regVId, dacVal, regulationMinStep));
log.InfoFormat("Enqueue( RegVlvMoveToPos(rv={0}, positionLo={1}) )", regVId, dacVal);
}
foreach (var a in actionQueue) log.DebugFormat(" {0}", a);
@ -841,6 +850,7 @@ namespace TBF.Rig.ControlBoard.Uni
actionQueue.Enqueue(Action.Stop(isFromUI));
log.InfoFormat("Enqueue( Stop() )");
foreach (var a in actionQueue) log.DebugFormat(" {0}", a);
}
@ -849,11 +859,11 @@ namespace TBF.Rig.ControlBoard.Uni
/// </summary>
/// <param name="rvId">Reg. valve ID</param>
/// <param name="time">Time in seconds, positive value opens the reg. valve</param>
public void RegVlvIncrMove(bool isFromUI, int regVId, double time)
public void RegVlvIncrMove(bool isFromUI, int regVId, double time, int regulationMinStep = 0)
{
if (IsUIBlocked && isFromUI || regVId >= TBF.Rig.Uni.RegValveAnalog.RegValve.RVAnalogIdx) return;
var newAction = Action.RegVlvIncrMove(isFromUI, regVId, time);
var newAction = Action.RegVlvIncrMove(isFromUI, regVId, time, regulationMinStep);
var actionsToModify = actionQueue.Where(x => (x.ActionId == ActionID.RegVlvIncrMove && x.RegVId == newAction.RegVId));
bool oneModified = false;
@ -870,7 +880,7 @@ namespace TBF.Rig.ControlBoard.Uni
oneModified = true;
log.InfoFormat("RegVlvIncrMove(UI={0}, RV={1}, time={2}) ... an action in the queue modified", isFromUI, regVId, time);
}
if (!oneModified)
{
actionQueue.Enqueue(newAction);
@ -885,12 +895,13 @@ namespace TBF.Rig.ControlBoard.Uni
/// </summary>
/// <param name="rvId">Reg. valve ID</param>
/// <param name="position">Reg. valve position (0 .. 1.0)</param>
public void RegVlvMoveToPos(bool isFromUI, int regVId, int adcValLo, int adcValHi = -1)
public void RegVlvMoveToPos(bool isFromUI, int regVId, int adcValLo, int adcValHi = -1, int regulationMinStep = 0)
{
if (IsUIBlocked && isFromUI || regVId > TBF.Rig.Uni.RegValveAnalog.RegValve.RVAnalogIdx) return;
actionQueue.Enqueue(Action.RegVlvMoveToPos(isFromUI, regVId, adcValLo, adcValHi));
actionQueue.Enqueue(Action.RegVlvMoveToPos(isFromUI, regVId, adcValLo, adcValHi, regulationMinStep));
log.InfoFormat("Enqueue( RegVlvMoveToPos(rv={0}, positionLo={1}, positionHi={2}) )", regVId, adcValLo, adcValHi);
foreach (var a in actionQueue) log.DebugFormat(" {0}", a);
}
@ -907,6 +918,7 @@ namespace TBF.Rig.ControlBoard.Uni
actionQueue.Enqueue(Action.Stop(isFromUI));
}
log.InfoFormat("Enqueue( SwitchDiverter(div#={0}, toTank={1}) )", divNr1, toTank);
foreach (var a in actionQueue) log.DebugFormat(" {0}", a);
}
@ -916,6 +928,7 @@ namespace TBF.Rig.ControlBoard.Uni
actionQueue.Enqueue(Action.DelayStartOrStop(isFromUI));
log.InfoFormat("Enqueue( DelayStartOrStop() )");
foreach (var a in actionQueue) log.DebugFormat(" {0}", a);
}
@ -930,6 +943,7 @@ namespace TBF.Rig.ControlBoard.Uni
DivTransitionData.DiverterAssociationValidUntil = StateMachine.Time + 5;
actionQueue.Enqueue(Action.GetDiverterTransitionData(isFromUI));
log.InfoFormat("Enqueue( GetDiverterTransitionData(div#={0}, toTank={1}) )", diverter.DiverterNr, toTank);
foreach (var a in actionQueue) log.DebugFormat(" {0}", a);
}
@ -939,6 +953,7 @@ namespace TBF.Rig.ControlBoard.Uni
actionQueue.Enqueue(Action.GetScopeAnalyzerData(isFromUI));
log.InfoFormat("Enqueue( GetScopeAnalyzerData() )");
foreach (var a in actionQueue) log.DebugFormat(" {0}", a);
}
@ -948,6 +963,7 @@ namespace TBF.Rig.ControlBoard.Uni
actionQueue.Enqueue(Action.ResetScopeAnalyzer(isFromUI));
log.InfoFormat("Enqueue( ResetScopeAnalyzer() )");
foreach (var a in actionQueue) log.DebugFormat(" {0}", a);
}
@ -957,6 +973,7 @@ namespace TBF.Rig.ControlBoard.Uni
actionQueue.Enqueue(Action.GetSwitchCounterData(isFromUI));
log.InfoFormat("Enqueue( GetSwitchCounterData() )");
foreach (var a in actionQueue) log.DebugFormat(" {0}", a);
}

View File

@ -33,10 +33,9 @@ namespace TBF.Rig.DataEntry.iPerl
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleBeginningForm));
this.okButton = new System.Windows.Forms.Button();
this.orderGroupBox = new System.Windows.Forms.GroupBox();
this.orderComboBox = new System.Windows.Forms.ComboBox();
this.pictureBox = new System.Windows.Forms.PictureBox();
this.orderGroupBox.SuspendLayout();
this.orderComboBox = new TBF.UI.Shared.SuggestComboBox();
this.labelOrder = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
this.SuspendLayout();
//
@ -48,50 +47,53 @@ namespace TBF.Rig.DataEntry.iPerl
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// orderGroupBox
//
this.orderGroupBox.Controls.Add(this.orderComboBox);
resources.ApplyResources(this.orderGroupBox, "orderGroupBox");
this.orderGroupBox.ForeColor = System.Drawing.Color.Black;
this.orderGroupBox.Name = "orderGroupBox";
this.orderGroupBox.TabStop = false;
//
// orderComboBox
//
this.orderComboBox.FormattingEnabled = true;
resources.ApplyResources(this.orderComboBox, "orderComboBox");
this.orderComboBox.Name = "orderComboBox";
//
// pictureBox
//
resources.ApplyResources(this.pictureBox, "pictureBox");
this.pictureBox.Name = "pictureBox";
this.pictureBox.TabStop = false;
//
// orderComboBox
//
this.orderComboBox.DropDownHeight = 530;
this.orderComboBox.FilterRule = null;
resources.ApplyResources(this.orderComboBox, "orderComboBox");
this.orderComboBox.FormattingEnabled = true;
this.orderComboBox.Name = "orderComboBox";
this.orderComboBox.PropertySelector = null;
this.orderComboBox.SuggestBoxHeight = 192;
this.orderComboBox.SuggestListOrderRule = null;
//
// labelOrder
//
resources.ApplyResources(this.labelOrder, "labelOrder");
this.labelOrder.Name = "labelOrder";
//
// CycleBeginningForm
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.DarkGray;
this.Controls.Add(this.labelOrder);
this.Controls.Add(this.orderComboBox);
this.Controls.Add(this.pictureBox);
this.Controls.Add(this.orderGroupBox);
this.Controls.Add(this.okButton);
this.ForeColor = System.Drawing.Color.Black;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "CycleBeginningForm";
this.TopMost = true;
this.Load += new System.EventHandler(this.CycleBeginningForm_Load);
this.orderGroupBox.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.GroupBox orderGroupBox;
private System.Windows.Forms.ComboBox orderComboBox;
private System.Windows.Forms.PictureBox pictureBox;
private UI.Shared.SuggestComboBox orderComboBox;
private System.Windows.Forms.Label labelOrder;
}
}

View File

@ -11,7 +11,6 @@ using TBF.Rig.Sequences;
using TBF.Rig.Output.DB.SensusOracle;
using TBF.Resources;
using System.Drawing;
using NHibernate;
namespace TBF.Rig.DataEntry.iPerl
{
@ -24,8 +23,7 @@ namespace TBF.Rig.DataEntry.iPerl
readonly EntryFormCfg cfg;
/// Loaded from database beforethe form is open
IList<IOrderInfo> listOfOrders;
string preselectedOrder;
IList<OrderDetails> listOfOrders;
/// To be retrieved after the form is closed
public string PurchaseOrder;
@ -42,7 +40,6 @@ namespace TBF.Rig.DataEntry.iPerl
{
InitializeComponent();
ControlBox = false;
preselectedOrder = null;
completed = false;
StartForceCloseHandler();
@ -53,12 +50,11 @@ namespace TBF.Rig.DataEntry.iPerl
/// Constructor
/// </summary>
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public CycleBeginningForm(int waterMetersCount, EntryFormCfg cfg, string preselectedOrder = null)
public CycleBeginningForm(int waterMetersCount, EntryFormCfg cfg)
: this()
{
this.WaterMetersCount = waterMetersCount;
this.cfg = cfg;
this.preselectedOrder = preselectedOrder;
SNText = null;
Disabled = null;
}
@ -67,49 +63,12 @@ namespace TBF.Rig.DataEntry.iPerl
private void CycleBeginningForm_Load(object sender, EventArgs e)
{
Text = Strings.Data;
orderGroupBox.Text = Strings.Purchase_order;
labelOrder.Text = Strings.Purchase_order;
okButton.Text = Strings.OkBtnText;
listOfOrders = new List<IOrderInfo>();
if ((cfg.Orders == Orders.FromOracle || cfg.Orders == Orders.CombinedAndFromOracle)
&& ProcessData.OracleDB != null)
{
foreach (var o in ProcessData.OracleDB.ReadOrders())
{
listOfOrders.Add(o);
}
}
if ((cfg.Orders == Orders.FromTracingDB || cfg.Orders == Orders.CombinedAndFromTracingDB)
&& ProcessData.TracingDB != null
&& ProcessData.TracingDB.DebugLevel == DebugMode.Normal)
{
foreach (var o in ProcessData.TracingDB.ReadOrders())
{
listOfOrders.Add(o);
}
}
string insertFirst = null;
if (!string.IsNullOrEmpty(preselectedOrder))
{
insertFirst = preselectedOrder;
}
else
{
if (Program.LocalSettings.PurchaseOrderHistoryCount > 0)
{
foreach (var o in listOfOrders)
{
if (o.POName == Program.LocalSettings.PurchaseOrderHistory[0])
{
insertFirst = o.POName;
break;
}
}
}
}
listOfOrders = ((cfg.Orders == Orders.FromOracle || cfg.Orders == Orders.CombinedAndFromOracle) && ProcessData.OracleDB != null)
? ProcessData.OracleDB.ReadOrders()
: new List<OrderDetails>();
switch (cfg.Orders)
{
@ -117,71 +76,25 @@ namespace TBF.Rig.DataEntry.iPerl
PrepareOrderCombo(orderComboBox);
break;
case Orders.FromOracle:
case Orders.FromTracingDB:
if (insertFirst != null)
{
orderComboBox.Items.Add(insertFirst);
orderComboBox.Text = insertFirst;
}
foreach (var o in listOfOrders)
if (o.POName != insertFirst)
orderComboBox.Items.Add(o.POName);
break;
case Orders.CombinedAndFromOracle:
case Orders.CombinedAndFromTracingDB:
if (insertFirst != null)
{
orderComboBox.Items.Add(insertFirst);
orderComboBox.Text = insertFirst;
}
orderComboBox.Items.Add("BBAAMMXX");
orderComboBox.Items.Add("BBAAOMXX");
orderComboBox.Items.Add("BBAAQMXX");
orderComboBox.Items.Add("BBAATMFR");
orderComboBox.Items.Add("BBAATMXX");
orderComboBox.Items.Add("CCAAMMXX");
orderComboBox.Items.Add("CCAAOMXX");
orderComboBox.Items.Add("CCAAQMXX");
orderComboBox.Items.Add("CCAATMFR");
orderComboBox.Items.Add("CCAATMXX");
orderComboBox.Items.Add("DDAAMMXX");
orderComboBox.Items.Add("DDAAOMXX");
orderComboBox.Items.Add("DDAAQMXX");
orderComboBox.Items.Add("DDAATMXX");
orderComboBox.Items.Add("DEAAMMXX");
orderComboBox.Items.Add("DEAAOMXX");
orderComboBox.Items.Add("DEAAQMXX");
orderComboBox.Items.Add("DEAATMXX");
orderComboBox.Items.Add("EEAAMMXX");
orderComboBox.Items.Add("EEAAOMXX");
orderComboBox.Items.Add("EEAAQMXX");
orderComboBox.Items.Add("EEAATMFR");
orderComboBox.Items.Add("EEAATMXX");
orderComboBox.Items.Add("FFAAMMXX");
orderComboBox.Items.Add("FFAAOMXX");
orderComboBox.Items.Add("FFAAQMXX");
orderComboBox.Items.Add("FFAATMFR");
orderComboBox.Items.Add("FFAATMXX");
orderComboBox.Items.Add("GFAAMMXX");
orderComboBox.Items.Add("GFAAOMXX");
orderComboBox.Items.Add("GFAAQMXX");
orderComboBox.Items.Add("GFAATMXX");
case Orders.FromOracle:
foreach (var o in listOfOrders)
if (o.POName != insertFirst)
orderComboBox.Items.Add(o.POName);
{
orderComboBox.Items.Add(o.POName + " - " + o.SNPrefix);
}
if (Program.LocalSettings.PurchaseOrderHistoryCount > 0)
orderComboBox.SelectedIndex = orderComboBox.FindString(Program.LocalSettings.PurchaseOrderHistory[0]);
break;
}
///
/// Draw an appropriate test bench picture
///
Side side = (TBF.Rig.Sequences.ProcessData.BenchInfo is DataContainer.iPerlBenchInfo.Component)
? (TBF.Rig.Sequences.ProcessData.BenchInfo as DataContainer.iPerlBenchInfo.Component).Side
: Side.Left;
Side side = (ProcessData.BenchInfo is DataContainer.iPerlBenchInfo.Component)
? (ProcessData.BenchInfo as DataContainer.iPerlBenchInfo.Component).Side
: Side.Left;
if ((cfg.Direction == Direction.Reversed_LR) && (side == Side.Left))
{
/// direction L->R (reversed), left side
@ -202,7 +115,9 @@ namespace TBF.Rig.DataEntry.iPerl
/// direction R->L (forward), left side
pictureBox.Image = Image.FromFile(string.Format("{0}\\Pictures\\forward_dir_left.jpg", Program.ExecutableDir, true));
}
}
pictureBox.SendToBack();
}
/// <summary>
/// Load Purchase order combo box items from the LocalSettings PurchaseOrderHistory array
@ -223,45 +138,20 @@ namespace TBF.Rig.DataEntry.iPerl
private void okButton_Click(object sender, EventArgs e)
{
if (orderComboBox.Text.Length > 8 ||
(cfg.Orders != Orders.Arbitrary && !orderComboBox.Items.Contains(orderComboBox.Text)))
PurchaseOrder = orderComboBox.Text.Split(' ')[0].Trim();
if (PurchaseOrder.Length > 10 ||
(cfg.Orders != Orders.Arbitrary && orderComboBox.FindString(PurchaseOrder) < 0))
{
MessageBox.Show(Strings.Invalid_order_number, Strings.Error, MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
return;
}
IOrderInfo oInfo = (listOfOrders == null) ? null : listOfOrders.FirstOrDefault<IOrderInfo>(x => x.POName == orderComboBox.Text);
///
if (oInfo is Output.DB.SensusOracle.OrderDetails)
{
ProcessData.OrderInfo = oInfo;
}
else if (oInfo is SharedDatabase.Entities.OrderInfo && ProcessData.TracingDB != null)
{
try
{
using (var session = ProcessData.TracingDB.SessionFactory.OpenSession())
{
var list = session.QueryOver<SharedDatabase.Entities.OrderInfo>()
.Where(x => (x.POName == Program.MainWnd.SelectedProcedure.OrderInfo.POName))
.List();
ProcessData.OrderInfo = (list.Count == 1) ? list[0] : null;
string workflow = (list.Count == 1) ? list[0].Workflow : null;
ProcessData.WorkflowSummary = SharedDatabase.WorkflowSummary.ReadFromDB(workflow, "test", session);
session.Close();
}
}
catch (Exception ex)
{
log.ErrorFormat("Unable to load an order, workflow or workstep: {0}", ex);
ProcessData.OrderInfo = null;
ProcessData.WorkflowSummary = null;
}
}
ProcessData.OrderDetails = (listOfOrders == null) ? null : listOfOrders.FirstOrDefault<OrderDetails>(x => x.POName == orderComboBox.Text);
PurchaseOrder = orderComboBox.Text;
Program.LocalSettings.UpdateHistory(orderComboBox.Text, ref Program.LocalSettings.PurchaseOrderHistory);
Program.LocalSettings.UpdateHistory(PurchaseOrder, ref Program.LocalSettings.PurchaseOrderHistory);
completed = true;
Close();
@ -285,6 +175,6 @@ namespace TBF.Rig.DataEntry.iPerl
Close();
}
#endregion
}
#endregion
}
}

View File

@ -122,10 +122,14 @@
<value>Verdana, 14.25pt</value>
</data>
<data name="okButton.Location" type="System.Drawing.Point, System.Drawing">
<value>627, 26</value>
<value>836, 32</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="okButton.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
</data>
<data name="okButton.Size" type="System.Drawing.Size, System.Drawing">
<value>112, 63</value>
<value>149, 78</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="okButton.TabIndex" type="System.Int32, mscorlib">
@ -144,61 +148,16 @@
<value>$this</value>
</data>
<data name="&gt;&gt;okButton.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="orderComboBox.Location" type="System.Drawing.Point, System.Drawing">
<value>90, 32</value>
</data>
<data name="orderComboBox.Size" type="System.Drawing.Size, System.Drawing">
<value>432, 31</value>
</data>
<data name="orderComboBox.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;orderComboBox.Name" xml:space="preserve">
<value>orderComboBox</value>
</data>
<data name="&gt;&gt;orderComboBox.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;orderComboBox.Parent" xml:space="preserve">
<value>orderGroupBox</value>
</data>
<data name="&gt;&gt;orderComboBox.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="orderGroupBox.Font" type="System.Drawing.Font, System.Drawing">
<value>Verdana, 14.25pt</value>
</data>
<data name="orderGroupBox.Location" type="System.Drawing.Point, System.Drawing">
<value>28, 12</value>
</data>
<data name="orderGroupBox.Size" type="System.Drawing.Size, System.Drawing">
<value>565, 82</value>
</data>
<data name="orderGroupBox.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="orderGroupBox.Text" xml:space="preserve">
<value>Order</value>
</data>
<data name="&gt;&gt;orderGroupBox.Name" xml:space="preserve">
<value>orderGroupBox</value>
</data>
<data name="&gt;&gt;orderGroupBox.Type" xml:space="preserve">
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;orderGroupBox.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;orderGroupBox.ZOrder" xml:space="preserve">
<value>1</value>
<value>4</value>
</data>
<data name="pictureBox.Location" type="System.Drawing.Point, System.Drawing">
<value>28, 118</value>
<value>37, 145</value>
</data>
<data name="pictureBox.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
</data>
<data name="pictureBox.Size" type="System.Drawing.Size, System.Drawing">
<value>711, 497</value>
<value>948, 612</value>
</data>
<data name="pictureBox.TabIndex" type="System.Int32, mscorlib">
<value>8</value>
@ -213,19 +172,79 @@
<value>$this</value>
</data>
<data name="&gt;&gt;pictureBox.ZOrder" xml:space="preserve">
<value>0</value>
<value>3</value>
</data>
<data name="orderComboBox.Font" type="System.Drawing.Font, System.Drawing">
<value>Verdana, 14.25pt</value>
</data>
<data name="orderComboBox.IntegralHeight" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="orderComboBox.Location" type="System.Drawing.Point, System.Drawing">
<value>37, 73</value>
</data>
<data name="orderComboBox.Size" type="System.Drawing.Size, System.Drawing">
<value>777, 37</value>
</data>
<data name="orderComboBox.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="&gt;&gt;orderComboBox.Name" xml:space="preserve">
<value>orderComboBox</value>
</data>
<data name="&gt;&gt;orderComboBox.Type" xml:space="preserve">
<value>TBF.UI.Shared.SuggestComboBox, TBF, Version=2.33.2152.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;orderComboBox.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;orderComboBox.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="labelOrder.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="labelOrder.Font" type="System.Drawing.Font, System.Drawing">
<value>Verdana, 14.25pt</value>
</data>
<data name="labelOrder.Location" type="System.Drawing.Point, System.Drawing">
<value>32, 32</value>
</data>
<data name="labelOrder.Size" type="System.Drawing.Size, System.Drawing">
<value>83, 29</value>
</data>
<data name="labelOrder.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
</data>
<data name="labelOrder.Text" xml:space="preserve">
<value>label1</value>
</data>
<data name="&gt;&gt;labelOrder.Name" xml:space="preserve">
<value>labelOrder</value>
</data>
<data name="&gt;&gt;labelOrder.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;labelOrder.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;labelOrder.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 13</value>
<value>8, 16</value>
</data>
<data name="$this.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>769, 639</value>
<value>1025, 786</value>
</data>
<data name="$this.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Batch data</value>

View File

@ -7,7 +7,6 @@ using log4net;
using Config.Entities;
using TBF.Rig;
using TBF.Rig.GenericDevices;
using TBF.Rig.Sequences;
namespace TBF.Rig.DataEntry.iPerl
{
@ -85,7 +84,7 @@ namespace TBF.Rig.DataEntry.iPerl
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.waterMeters = ProcessData.BatchRslts.Batch.WaterMeters;
this.waterMeters = TBF.Rig.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
return this;
}
@ -98,10 +97,6 @@ namespace TBF.Rig.DataEntry.iPerl
return this;
}
/// <returns>null (not implemented)</returns>
public IOperation ShowAdvancedTestStartFormOp(IRegReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
public IOperation ShowTestCollectFormOp(IRegReader[] regReaders, double volumeRef, double errLimLo, double errLimHi) { return null; }
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
{
@ -118,8 +113,7 @@ namespace TBF.Rig.DataEntry.iPerl
///
void OpenBeginningDlg(EntryForm myRef)
{
myRef.modelessDlg = new CycleBeginningForm(TBF.Data.WMsCount, myRef.entryFormCfg,
ProcessData.SelectedProcedure.OrderInfo != null ? ProcessData.SelectedProcedure.OrderInfo.POName : string.Empty);
myRef.modelessDlg = new CycleBeginningForm(TBF.Data.WMsCount, myRef.entryFormCfg);
modelessDlg.Show();
}
///
@ -142,16 +136,7 @@ namespace TBF.Rig.DataEntry.iPerl
switch (currentOp)
{
case CurrentOp.ShowFormAtCycleBeginning:
if (ProcessData.SelectedProcedure.OrderInfo == null || entryFormCfg.Direction != Direction.S640)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
else
{
/// Only in case of 640 meters and an order information entered during the procedure selection
/// this DataEntry form at the beginning of the cycle is skipped
modelessDlg = null;
}
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
break;
case CurrentOp.EnterTestStartStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestStartStatesDlg), this);
@ -166,17 +151,7 @@ namespace TBF.Rig.DataEntry.iPerl
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
if (ProcessData.SelectedProcedure.OrderInfo != null && entryFormCfg.Direction == Direction.S640)
{
for (int i = 0; i < waterMeters.Count; i++)
{
if (waterMeters[i] != null)
waterMeters[i].PurchaseOrder = ProcessData.SelectedProcedure.OrderInfo.POName;
}
return Event.ModelessFormClosed;
}
if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed)
if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed)
{
return Event.ModelessFormIsOpen;
}
@ -239,5 +214,26 @@ namespace TBF.Rig.DataEntry.iPerl
}
currentOp = CurrentOp.None;
}
}
public IOperation ShowAdvancedTestStartFormOp(IRegReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp = false)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestStartStates;
this.regReaders = regReaders;
this.waterMeters = waterMeters;
// Handle isCondOp if necessary
return this;
}
public IOperation ShowTestCollectFormOp(IRegReader[] regReaders, double volumeRef, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.EnterTestEndStates;
this.regReaders = regReaders;
this.refVolume = volumeRef;
this.errLimLo = errLimLo;
this.errLimHi = errLimHi;
return this;
}
}
}

View File

@ -32,23 +32,17 @@ namespace TBF.Rig.DataEntry.iPerl
public enum Orders
{
#if LANG_SK
[Description("Ľubovolné")] Arbitrary,
[Description("Z Oracle databázy")] FromOracle,
[Description("Zo sledovacej databázy")] FromTracingDB,
[Description("Združené a z Oracle")] CombinedAndFromOracle,
[Description("Združené a zo sledovacej databázy")] CombinedAndFromTracingDB,
#elif LANG_CZ
[Description("Libovolné")] Arbitrary,
[Description("Z Oracle databáze")] FromOracle,
[Description("Ze sledovací databáze")] FromTracingDB,
[Description("Sdružené a z Oracle")] CombinedAndFromOracle,
[Description("Sdružené a ze sledovací databáze")] CombinedAndFromTracingDB,
[Description("Ľubovolné")] Arbitrary,
[Description("Aktívne z Oracle")] FromOracle,
[Description("Združené a aktívne z Oracle")] CombinedAndFromOracle,
#elif LANG_DE
[Description("Arbitrary")] Arbitrary,
[Description("Active from Oracle")] FromOracle,
[Description("Combined and active from Oracle")] CombinedAndFromOracle,
#else
[Description("Arbitrary")] Arbitrary,
[Description("From Oracle")] FromOracle,
[Description("From Tracing DB")] FromTracingDB,
[Description("Combined and from Oracle")] CombinedAndFromOracle,
[Description("Combined and from Tracing DB")] CombinedAndFromTracingDB,
[Description("Arbitrary")] Arbitrary,
[Description("Active from Oracle")] FromOracle,
[Description("Combined and active from Oracle")] CombinedAndFromOracle,
#endif
Count,
}
@ -99,15 +93,22 @@ namespace TBF.Rig.DataEntry.iPerl
public ICollection<string> ParamValues(int i)
{
var list = new List<string>();
switch (i)
{
case 0:
for (Direction d = 0; d < Direction.Count; d++) list.Add(d.ToDescription());
return list;
return new string[]
{
Direction.Forward_RL.ToDescription(),
Direction.Reversed_LR.ToDescription(),
Direction.S640.ToDescription(),
};
case 1:
for (Orders o = 0; o < Orders.Count; o++) list.Add(o.ToDescription());
return list;
return new string[]
{
Orders.Arbitrary.ToDescription(),
Orders.FromOracle.ToDescription(),
Orders.CombinedAndFromOracle.ToDescription(),
};
default:
return null;
}

View File

@ -8,7 +8,7 @@ namespace TBF.Rig.DataEntry.iPerl
{
public class Factory : IComponentFactory
{
public string ClassName { get { return GetType().Namespace.Substring(8); } }
public string ClassName { get { return "DataEntry-iPerl"; } }
public override string ToString() { return ClassName; }
public IComponent DummyComponent() { return new EntryForm(); }

View File

@ -22,7 +22,8 @@ namespace TBF.Rig.Dummy.RegValve
public bool IsCoax { get { return false; } }
public double Position { get { return 50.0; } }
///
public int RegulationMinStep { get { return 0; } }
IDictionary<double, double> dict;
public IDictionary<double, double> Dict { get { return dict; } }

View File

@ -15,7 +15,8 @@ namespace TBF.Rig
public string Selector;
public IFlowMeter FlowMeter;
public IRegValve RegValve;
public float PidCoef;
public int RegulMinStep;
public float PidCoef;
public IDiverter Diverter;
public ITempMeter TempMtrDiv;
public IScaleOrTank Scale;
@ -39,7 +40,7 @@ namespace TBF.Rig
RegVPositions = new List<RegValvePosition>();
ValvesOpen = new List<IValve>();
ValvesClose = new List<IValve>();
}
}
/// Constructor from data entity
public OutputPath(Config.Entities.OutputPath entity, IList<Rig.Generic.IComponent> components)
@ -50,7 +51,8 @@ namespace TBF.Rig
Selector = entity.Selector;
FlowMeter = TbfComponents.FindComponent(entity.FlowMeter, components) as IFlowMeter;
RegValve = TbfComponents.FindComponent(entity.RegValve, components) as IRegValve;
PidCoef = entity.PidCoef;
RegulMinStep = entity.RegulMinStep;
PidCoef = entity.PidCoef;
Diverter = TbfComponents.FindComponent(entity.Diverter, components) as IDiverter;
TempMtrDiv = TbfComponents.FindComponent(entity.TempMtrDiv, components) as ITempMeter;
Scale = TbfComponents.FindComponent(entity.Scale, components) as IScaleOrTank;

View File

@ -18,6 +18,8 @@ using TBF.Rig.Network.RestAPI;
using TBF.Rig.Network.RestAPI.facade;
using TBF.Rig.Output.Printers.GroupPrinting.Single;
using TBF.UiBridge;
using SharedComponents;
using System.Text;
namespace TBF.Rig.Sequences
{
@ -33,6 +35,7 @@ namespace TBF.Rig.Sequences
int simultWithPurgingCount;
Generic.IComponentCfg simultWithPurgingCfg;
Generic.IComponent simultWithPurging;
Generic.IProcedureParams simultWithPurgingProcParams;
IList<Config.Entities.Test> simultWithPurgingTests;
IList<Generic.ITestParams> simultWithPurgingTestParams;
@ -44,10 +47,10 @@ namespace TBF.Rig.Sequences
IList<Generic.ITestParams> simultWithEvacuationTestParams;
System.Windows.Forms.Form modelessDlg;
///
delegate void CommunicationFormDlgt(MainSeq myRef, Generic.IComponentCfg cfg, Generic.IProcedureParams procParams, IList<Test> tests, IList<Generic.ITestParams> multiTestParams);
///
void OpenIPerlCommForm(MainSeq myRef, Generic.IComponentCfg cfg, Generic.IProcedureParams procParams, IList<Test> tests, IList<Generic.ITestParams> multiTestParams)
delegate void CommunicationFormDlgt(MainSeq myRef, Generic.IComponent testMethod, Generic.IComponentCfg cfg, Generic.IProcedureParams procParams, IList<Test> tests, IList<Generic.ITestParams> multiTestParams);
///
void OpenIPerlCommForm(MainSeq myRef, Generic.IComponent testMethod, Generic.IComponentCfg cfg, Generic.IProcedureParams procParams, IList<Test> tests, IList<Generic.ITestParams> multiTestParams)
{
try
{
@ -60,9 +63,13 @@ namespace TBF.Rig.Sequences
IList<TestMethods.iPerlCommunication.iPerlCommunicationParams> iPerlCommParams = new List<TestMethods.iPerlCommunication.iPerlCommunicationParams>();
foreach (var tp in multiTestParams) iPerlCommParams.Add(tp as TestMethods.iPerlCommunication.iPerlCommunicationParams);
myRef.modelessDlg = new TestMethods.iPerlCommunication.iPerlCommunicationForm(iPerlCfg, tests, iPerlCommParams);
myRef.modelessDlg.Show();
}
/*myRef.modelessDlg = new TestMethods.iPerlCommunication.iPerlCommunicationForm(iPerlCfg, tests, iPerlCommParams);
myRef.modelessDlg.Show();*/
myRef.modelessDlg = new TestMethods.iPerlCommunication.iPerlCommunicationForm(
testMethod as TBF.Rig.TestMethods.iPerlCommunication.TestMethod, tests, iPerlCommParams);
myRef.modelessDlg.Show();
}
catch (Exception e)
{
log.FatalFormat("---------------( MainSeq : OpenIperlCommForm crashed !!! )---------------");
@ -76,7 +83,7 @@ namespace TBF.Rig.Sequences
}
}
///
void OpenS640CommForm(MainSeq myRef, Generic.IComponentCfg cfg, Generic.IProcedureParams procParams, IList<Test> tests, IList<Generic.ITestParams> multiTestParams)
void OpenS640CommForm(MainSeq myRef, Generic.IComponent testMethod, Generic.IComponentCfg cfg, Generic.IProcedureParams procParams, IList<Test> tests, IList<Generic.ITestParams> multiTestParams)
{
try
{
@ -1494,13 +1501,45 @@ namespace TBF.Rig.Sequences
goto error;
}
}
catch (Exception exc)
/*catch (Exception exc)
{
string msg = string.Format("Unable to update Batch.RsltsSent in local MySQL DB, BatchNr = {0}",
ProcessData.BatchRslts.Batch.BatchNr);
Bridge.OnError(this, msg);
log.FatalFormat("{0}: {1}", msg, exc.Message);
goto error;
}*/
catch (Exception exc)
{
var batch = ProcessData.BatchRslts.Batch;
// ⚠️ Skladanie detailného logu do jedného reťazca
var logBuilder = new StringBuilder();
logBuilder.AppendLine("----------------- Unable to update Batch.RsltsSent in local MySQL DB, BatchNr = {0} ------------------");
logBuilder.AppendLine("❌ Chyba pri UPDATE `batch` SET `RsltsSent` = '1'");
logBuilder.AppendLine($"BatchNr = {batch.BatchNr}");
logBuilder.AppendLine($"SQL príkaz: UPDATE `batch` SET `RsltsSent` = '1' WHERE `batch`.`BatchNr` = {batch.BatchNr};");
logBuilder.AppendLine();
logBuilder.AppendLine("💥 Výnimka:");
logBuilder.AppendLine($" - Message: {exc.Message}");
logBuilder.AppendLine($" - StackTrace: {exc.StackTrace}");
logBuilder.AppendLine($" - InnerException: {(exc.InnerException != null ? exc.InnerException.Message : "null")}");
logBuilder.AppendLine();
logBuilder.AppendLine("📦 Batch obsah:");
// 💡 Dynamický výpis vlastností objektu Batch
var props = batch.GetType().GetProperties();
foreach (var prop in props)
{
object value = prop.GetValue(batch, null);
logBuilder.AppendLine($" - {prop.Name}: {value}");
}
// ✍️ Uloženie do vlastného logu
LiveLogCache.Instance.AddLog(logBuilder.ToString());
Bridge.OnError(this, "Chyba pri aktualizácii výsledkov v MySQL.");
goto error;
}
}

View File

@ -26,6 +26,7 @@ namespace TBF.Rig.Sequences
public static IErrorFlags ErrorFlagsComp;
public static IStatisticsMonitoring StatisticsMonitoringComp;
public static Output.DB.SensusOracle.Database OracleDB;
public static Output.DB.SensusOracle.OrderDetails OrderDetails;
public static Output.DB.ProductionTracing.Tracing TracingDB;
///
@ -528,17 +529,21 @@ namespace TBF.Rig.Sequences
StateMachine.ControlBoardMain.TestTime.ToString("F3"),/// test time in s
StateMachine.ControlBoardMain.RefPulses, /// reference flow meter pulses count
outPath.FlowMeter != null ? Formulas.VolumeFromPulses(StateMachine.ControlBoardMain.RefPulses, 1 / outPath.FlowMeter.LtrPerPulse).ToString("F3") : "0.000", /// volume in l
benchPath.TempMtrUp != null ? benchPath.TempMtrUp.ReadTemperature() : 0, /// temp. at the beginning of line in degree C
benchPath.TempMtrUp != null ? benchPath.TempMtrUp.ReadTemperature() : 0, /// temp. at the beginning of line in degree C
benchPath.TempMtrDown != null ? benchPath.TempMtrDown.ReadTemperature() : 0, /// temp. at the end of line in degree C
outPath.TempMtrDiv != null ? outPath.TempMtrDiv.ReadTemperature() : 0, /// temp. at the diverter in degree C
PressUp, /// water pressure at the beginning of test line in bar (= 100 kPa)
PressDown, /// water pressure at the end of test line in bar (= 100 kPa)
PressDelta,
outPath.TempMtrDiv != null ? outPath.TempMtrDiv.ReadTemperature() : 0, /// temp. at the diverter in degree C
//---new2
PressUp.ToString(), /// water pressure at the beginning of test line in bar (= 100 kPa)
PressDown.ToString(), /// water pressure at the end of test line in bar (= 100 kPa)
PressDelta.ToString(),
//---endnew2
(outPath.Scale is IScale) ? (outPath.Scale as IScale).Mass : 0, /// collected water mass in kg
"VolMM",
AmbTemp, /// ambient temperature in degree C
AmbHumi, /// ambient humidity in R%
AmbPress, /// ambient pressure in mbar (= 1 hPa)
//---new2
AmbTemp.ToString(), /// ambient temperature in degree C
AmbHumi.ToString(), /// ambient humidity in R%
AmbPress.ToString(), /// ambient pressure in mbar (= 1 hPa)
//---endnew2
outPath.RegValve.Position.ToString("F1")); /// regulation valve position in % (0=closed / 100=open)
}
@ -561,19 +566,25 @@ namespace TBF.Rig.Sequences
benchPath.TempMtrUp != null ? benchPath.TempMtrUp.ReadTemperature() : 0, /// temp. at the beginning of line in degree C
benchPath.TempMtrDown != null ? benchPath.TempMtrDown.ReadTemperature() : 0, /// temp. at the end of test in degree C
outPath.TempMtrDiv != null ? outPath.TempMtrDiv.ReadTemperature() : 0, /// temp. at the diverter in degree C
PressUp,
PressDown,
PressDelta,
//---new2
PressUp.ToString(),
PressDown.ToString(),
PressDelta.ToString(),
//---endnew2
(outPath.Scale is IScale) ? (outPath.Scale as IScale).Mass : 0, /// collected water mass in kg
"VolMM",
AmbTemp,
AmbHumi,
AmbPress,
//---new2
AmbTemp.ToString(),
AmbHumi.ToString(),
AmbPress.ToString(),
//---endnew2
outPath.RegValve.Position.ToString("F1"),
TempRefHi1,
TempRefHi2,
TempRefLo1,
TempRefLo2);
//---new2
TempRefHi1.ToString(),
TempRefHi2.ToString(),
TempRefLo1.ToString(),
TempRefLo2.ToString());
//---endnew2
}
///

View File

@ -135,6 +135,7 @@ namespace TBF.Rig
new RegisterReaders.KPackE.Radio.Factory(), /// Radio for KPackE register readers
new Uni.RegValve.Factory(),
new Uni.RegValveAnalog.Factory(),
new Uni.RegValveLowRegulTimeSaturation.Factory(),
new Scales.MettlerToledo.Factory(),
new TestMethods.Adjustment.Factory(),
new TestMethods.ChangeFlowDirection.Factory(),

View File

@ -28,7 +28,7 @@ namespace TBF.Rig.TestMethods.Endurance
/// Auxiliary public lists used also by user controls in tab pages
public IList<Rig.Generic.IComponent> TbfComponents;
public IList<IValve> Valves;
public IList<Rig.BuiltIn.Valve.Valve> Valves = new List<Rig.BuiltIn.Valve.Valve>();
ITabWithListViewEx seqStepsCtrl;
@ -39,8 +39,9 @@ namespace TBF.Rig.TestMethods.Endurance
EnduranceCycle = new List<CycleStep>();
}
public CycleDlg(IList<CycleStep> cycle)
public CycleDlg(IList<CycleStep> cycle, IList<Rig.BuiltIn.Valve.Valve> valves)
{
this.Valves = valves;
/// Detect display setting: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi.
Dpi = (int)this.CreateGraphics().DpiX;
@ -64,25 +65,9 @@ namespace TBF.Rig.TestMethods.Endurance
seqStepsCtrl = new CycleStepsCtrl() as ITabWithListViewEx;
/// Prepare a list of valves for the endurance test
/// ... list is set by user
/// Load the list of components from the database
NHibernate.ISession session = TBF.DB.CreateSession(DBKind.Config);
var cmptnEntities = session.QueryOver<Config.Entities.Component>().OrderBy(x => x.ItemNr).Asc .List();
TbfComponents = TBF.Rig.TbfComponents.LoadComponentsFromDB(cmptnEntities);
Valves = new List<IValve>();
for (int bitNr = 0; bitNr < 8; bitNr++)
{
foreach (var vlv in TbfComponents)
{
if (vlv is TBF.Rig.BuiltIn.Valve.Valve && (vlv as TBF.Rig.BuiltIn.Valve.Valve).BitPosition == bitNr)
{
Valves.Add(vlv as IValve);
break;
}
}
}
EnduranceCycle = (cycle != null) ? cycle : new List<CycleStep>(); /// TODO: Load from component parameters
EnduranceCycle = (cycle != null) ? cycle : new List<CycleStep>(); /// TODO: Load from component parameters
/// Create a tab with sequence steps for each sequence ordered by ItemNr.
AddCycleStepsTab(EnduranceCycle);

View File

@ -2,17 +2,28 @@
/// Copyright (c) 2016 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
using TBF.Resources;
using TBF.Rig.Generic;
using TBF.Rig.GenericDevices;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
using TBF.Resources;
using System.Linq;
using TBF.Rig.Sequences;
using NHibernate;
using log4net;
namespace TBF.Rig.TestMethods.Endurance
{
public partial class TestMethodCfgCtrl : UserControl, IComponentCfgCtrl
{
public bool ShowMore { get { return false; } }
IList<Rig.BuiltIn.Valve.Valve> valvesFromDB = new List<Rig.BuiltIn.Valve.Valve>();
public bool ShowMore { get { return false; } }
string cycle;
@ -30,7 +41,9 @@ namespace TBF.Rig.TestMethods.Endurance
public TestMethodCfgCtrl()
{
InitializeComponent();
}
valvesFromDB = LoadValvesFromDB();
CreateValveRows(valvesFromDB.Count, valvesFromDB); // toľko riadkov, koľko ventilov
}
private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
{
@ -76,11 +89,109 @@ namespace TBF.Rig.TestMethods.Endurance
private void enduranceCycleButton_Click(object sender, EventArgs e)
{
CycleDlg dlg = new CycleDlg(CycleStep.StringToCycle(cycle));
CycleDlg dlg = new CycleDlg(CycleStep.StringToCycle(cycle), GetSelectedValves());
if (dlg.ShowDialog() == DialogResult.OK)
{
cycle = CycleStep.CycleToString(dlg.EnduranceCycle);
}
}
}
private void CreateValveRows(int numberOfRows, IList<Rig.BuiltIn.Valve.Valve> valves)
{
tableLayoutPanel1.RowCount = numberOfRows;
tableLayoutPanel1.ColumnCount = 2;
tableLayoutPanel1.Controls.Clear();
tableLayoutPanel1.ColumnStyles.Clear();
tableLayoutPanel1.RowStyles.Clear();
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100));
for (int i = 0; i < numberOfRows; i++)
{
tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.AutoSize));
var label = new Label
{
Text = $"Valve {i + 1}",
Anchor = AnchorStyles.Left,
AutoSize = true,
Margin = new Padding(5)
};
var comboBox = new ComboBox
{
DropDownStyle = ComboBoxStyle.DropDownList,
Anchor = AnchorStyles.Left | AnchorStyles.Right,
Dock = DockStyle.Fill,
Margin = new Padding(5),
Name = $"comboValve{i + 1}",
DisplayMember = "Name" // zobrazenie názvu ventilu
};
comboBox.Items.Add("None");
foreach (var valve in valves)
{
comboBox.Items.Add(valve.Name/* + " (bit nr = " + valve.BitPosition + ")"*/);
}
comboBox.SelectedIndex = 0;
tableLayoutPanel1.Controls.Add(label, 0, i);
tableLayoutPanel1.Controls.Add(comboBox, 1, i);
}
}
private IList<Rig.BuiltIn.Valve.Valve> LoadValvesFromDB()
{
/// Load the list of components from the database
IList<Rig.BuiltIn.Valve.Valve> valves = new List<Rig.BuiltIn.Valve.Valve>();
using (NHibernate.ISession session = TBF.DB.CreateSession(DBKind.Config))
{
IList<IComponent> TbfComponents = Rig.TbfComponents.LoadComponentsFromDB(session);
valves = getAllValves(TbfComponents);
}
/// Find all master valvesFromDB
return valves;
}
/// <summary>
/// Process the list of components and return all valvesFromDB (masters and coupled)
/// </summary>
public static IList<Rig.BuiltIn.Valve.Valve> getAllValves(IList<Generic.IComponent> cmpnts)
{
IList<Rig.BuiltIn.Valve.Valve> result = new List<Rig.BuiltIn.Valve.Valve>();
foreach (var cmpnt in cmpnts) if (cmpnt is Rig.BuiltIn.Valve.Valve) result.Add(cmpnt as Rig.BuiltIn.Valve.Valve);
return result;
}
private List<Rig.BuiltIn.Valve.Valve> GetSelectedValves()
{
var selectedValves = new List<Rig.BuiltIn.Valve.Valve>();
foreach (Control control in tableLayoutPanel1.Controls)
{
if (control is ComboBox comboBox)
{
var selectedName = comboBox.SelectedItem?.ToString();
if (!string.IsNullOrEmpty(selectedName) && selectedName != "None")
{
// Nájdeme ventil podľa mena v zozname všetkých
var valve = valvesFromDB.FirstOrDefault(v => v.Name == selectedName);
if (valve != null)
{
selectedValves.Add(valve);
}
}
}
}
return selectedValves;
}
}
}

View File

@ -31,62 +31,85 @@ namespace TBF.Rig.TestMethods.Endurance
/// </summary>
private void InitializeComponent()
{
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.enduranceCycleButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(137, 57);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 5;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(27, 60);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 4;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(134, 33);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 3;
this.classNameLabel.Text = "ComonentName";
//
// enduranceCycleButton
//
this.enduranceCycleButton.Enabled = false;
this.enduranceCycleButton.Location = new System.Drawing.Point(137, 83);
this.enduranceCycleButton.Name = "enduranceCycleButton";
this.enduranceCycleButton.Size = new System.Drawing.Size(130, 31);
this.enduranceCycleButton.TabIndex = 6;
this.enduranceCycleButton.Text = "Endurance cycle";
this.enduranceCycleButton.UseVisualStyleBackColor = true;
this.enduranceCycleButton.Click += new System.EventHandler(this.enduranceCycleButton_Click);
//
// TestMethodCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.enduranceCycleButton);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "TestMethodCfgCtrl";
this.Size = new System.Drawing.Size(300, 200);
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.enduranceCycleButton = new System.Windows.Forms.Button();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(137, 57);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 5;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(27, 60);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 4;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(134, 33);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 3;
this.classNameLabel.Text = "ComonentName";
//
// enduranceCycleButton
//
this.enduranceCycleButton.Enabled = false;
this.enduranceCycleButton.Location = new System.Drawing.Point(137, 83);
this.enduranceCycleButton.Name = "enduranceCycleButton";
this.enduranceCycleButton.Size = new System.Drawing.Size(130, 31);
this.enduranceCycleButton.TabIndex = 6;
this.enduranceCycleButton.Text = "Endurance cycle";
this.enduranceCycleButton.UseVisualStyleBackColor = true;
this.enduranceCycleButton.Click += new System.EventHandler(this.enduranceCycleButton_Click);
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.AutoSize = true;
this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 37.5F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 62.5F));
this.tableLayoutPanel1.Location = new System.Drawing.Point(30, 120);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 8;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(0, 120);
this.tableLayoutPanel1.TabIndex = 8;
//
// TestMethodCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.enduranceCycleButton);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "TestMethodCfgCtrl";
this.Size = new System.Drawing.Size(300, 502);
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
@ -96,5 +119,6 @@ namespace TBF.Rig.TestMethods.Endurance
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.Button enduranceCycleButton;
}
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
}
}

View File

@ -224,7 +224,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
///
State.Create(string.Format("{0}({1}) : Starting pump {2}", test.Method, test.Name, (inPath.Pump != null) ? inPath.Pump.Name : "?"))
.AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)

View File

@ -11,6 +11,7 @@ using TBF.Rig;
using TBF.Boxes;
using TBF.Resources;
using TBF.UiBridge;
//using AppDiagnostic;
namespace TBF.Rig.TestMethods.PMaxTest
{
@ -179,11 +180,24 @@ namespace TBF.Rig.TestMethods.PMaxTest
Bridge.OnActivity(this, Strings.Test_in_progress);
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.Test));
//------------------------------------------------
/*//---new1
LogProcessDataTestInfo(processDataLogger, test.Procedure.Name, test.Name);
if (heatMetersPath == null) LogProcessDataHeader(processDataLogger, "Start mass");
else LogProcessDataHeaderHeatMeters(processDataLogger, "Start mass");
//---endNew1*/
//DiagApi.addLog();
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(testParams.DurationPMax))
.EnterState();
//---new1
.AddOperation(processDataLoggingOp)
//---endNew1
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();

View File

@ -0,0 +1,131 @@
using Config.Resources;
using log4net;
using Sensus.iPerl.RfidCom.Helper;
using Sensus.iPerl.RfidCom.Services;
using Sensus.iPerl.RfidCom.Structures;
using System;
using System.Threading;
using TBF.Rig.Hart.Common;
using TBF.Rig.TestMethods.iPerlCommunication.iPerlHead;
using static Sensus.iPerl.NfcHandler.MCI_Protocol;
namespace TBF.Rig.TestMethods.iPerlCommunication
{
internal class OpticalHeadTest
{
protected static readonly ILog rfidDataLogger = LogManager.GetLogger("RfidData");
internal static string OpenSealing(IperlHead iHead)
{
if (RfidCommands.OpenSealing($"COM{iHead.RfidComPortNr}")) return "OK";
return "Error Open Sealing";
}
internal static string ReadRequest_PCB(IperlHead iHead)
{
try
{
byte[] pcb = null;
int readRetVal = iPerlCommunicationForm.ReadRequestPort(iHead, MessageID.Configuration, Sensus.iPerl.NfcHandler.MCI_Protocol.StructName.Configuration, 16, 5, out pcb);
if (readRetVal == 0)
{
return RfidHelper.HexLiteral2Unsigned(RfidHelper.SwapHexcode(BitConverter.ToString(pcb).Replace("-", string.Empty))).ToString();
}
rfidDataLogger.Error($"COM{iHead.RfidComPortNr}: ReadRequest_PCB ({MessageID.Configuration},16,5...) <- Error: {readRetVal}");
return "Error";
}
catch (Exception ex)
{
return (ex.Message.ToString());
}
}
internal static string SetActiveMode(IperlHead iHead)
{
byte[] cmd = new byte[1] { (byte)Command.SetActiveMode };
if (0 == iPerlCommunicationForm.WriteRequestPort(iHead, MessageID.Command, StructName.Command, 0, 1, cmd))
{
return "OK";
}
else
{
return "Error Set Active Mode";
}
}
internal static string SetTestMode(IperlHead iHead)
{
byte[] cmd = new byte[1] { (byte)Command.SetTestMode };
if (0 == iPerlCommunicationForm.WriteRequestPort(iHead, MessageID.Command, StructName.Command, 0, 1, cmd))
{
return "OK";
}
else
{
return "Error Set Test Mode";
}
}
#if IPERL
internal static string TurnOffRadio(IperlHead iHead)
{
try
{
int retValue = iPerlCommunicationForm.WriteRequestPort(iHead, MessageID.RadioPassthrough, StructName.RadioParams, 0x1898, 1, new byte[] { (byte)3 }); // WakeUpInterval
return 0 == retValue ? "OK" : "Error";
}
catch (Exception ex)
{
return (ex.Message.ToString());
}
}
internal static string SetProductionMode(IperlHead iHead)
{
try
{
int retValue = iPerlCommunicationForm.WriteRequestPort(iHead, MessageID.RadioPassthrough, StructName.RadioInfo, 0x1804, 1, new byte[] { (byte)1 }); // System Status
return 0 == retValue ? "OK" : "Error";
}
catch (Exception ex)
{
return (ex.Message.ToString());
}
}
internal static string WriteRequestPort_u8_Customer_Text(IperlHead iHead)
{
string custText = "FF0123456789ABCDEF"; // Sample text to test write function
/*try
{
byte[] cmd = RfidHelper.HexStringToByteArray(custText);
if (0 == iPerlCommunicationForm.WriteRequestPort(iHead, MessageID.RadioPassthrough, Sensus.iPerl.NfcHandler.MCI_Protocol.StructName.RadioParams, 0x1899, 9, cmd))
{
RfidCommunicationService rfidCommunicationService = new RfidCommunicationService { ComPort = $"COM{iHead.RfidComPortNr}", WaitTimeAfterFailure = 2200, PassThroughWaitTime = 1500, MaxRetries = 3, TimeOut = 5000 };
//rfidCommunicationService.RfidWrite(Params.u8_Customer_Text, custText);
return rfidCommunicationService.RfidRead<string>(Params.u8_Customer_Text).ToString();
}
}
catch (Exception ex)
{
return (ex.Message.ToString());
}*/
return $"Error COM{iHead.RfidComPortNr}";
}
internal static string SetRfidMode(IperlHead iHead)
{
iHead.SetRfidInterface();
iHead.SetCommunicationInterface(CommunicationInterface.RFID);
return ($"OK - {Strings.Program_restart_is_required_to_apply_some_settings}");
}
internal static string SetNfcMode(IperlHead iHead)
{
iHead.SetNfcInterface();
iHead.SetCommunicationInterface(CommunicationInterface.NFC);
return ($"OK - {Strings.Program_restart_is_required_to_apply_some_settings}");
}
#endif /// IPERL
}
}

View File

@ -0,0 +1,44 @@
///
/// Copyright (c) 2022 Sensus Slovensko a.s.
///
using TBF.Resources;
namespace TBF.Rig.TestMethods.iPerlCommunication
{
public enum ConditionID
{
A,
B,
C,
Count,
}
public class SequenceConditionOp : IOperation
{
public const string ConditionNameFmt = "iPERL communication milestone {0}";
ConditionID id;
TestMethod testMethodComponent;
public SequenceConditionOp(TestMethod testMethodComponent, ConditionID id)
{
this.testMethodComponent = testMethodComponent;
this.id = id;
}
public void Start() { }
public Event Run()
{
bool conditionMet = testMethodComponent.IperlCommMilestone[(int)id];
return conditionMet ? Event.ConditionMet : Event.ConditionNotMet;
}
public void Stop() { }
public override string ToString()
{
return string.Format(ConditionNameFmt, id);
}
}
}

View File

@ -1,19 +1,18 @@
///
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
/// Copyright (c) 2015-2022 Sensus Slovensko a.s.
///
using System;
using System.IO.Ports;
using System.Collections.Generic;
using log4net;
using Common;
using Config.Entities;
using TBF.Rig;
using TBF.Rig.GenericDevices;
using TBF.Rig.Sequences;
using TBF.UiBridge;
namespace TBF.Rig.TestMethods.iPerlCommunication
{
public class TestMethod : ComponentBase, GenericDevices.ISimultTestMethod
public class TestMethod : ComponentBase, ISimultTestMethod, ISequenceCondition, ISessionDataMngmnt
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
protected static readonly ILog rfidDataLogger = LogManager.GetLogger("RfidData");
@ -22,12 +21,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return false; }
public bool CheckDeviceCaps(Test test, OutputPath devices, out string message)
{
message = string.Format("{0}: CheckDeviceCaps() is not implemented yet", Name);
return false;
}
public bool SimultWithPrevious { get { return testMethodCfg.TestParams.SimultWithPrevious; } }
public bool SimultWithNext { get { return testMethodCfg.TestParams.SimultWithNext; } }
@ -68,14 +61,32 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
readonly TestMethodCfg testMethodCfg;
public bool[] IperlCommMilestone;
IList<IOperation> sequenceConditionOps;
public TestMethod() { }
public TestMethod()
{
CreateMilestonesAndConditions();
}
public TestMethod(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
}
CreateMilestonesAndConditions();
}
void CreateMilestonesAndConditions()
{
IperlCommMilestone = new bool[(int)ConditionID.Count];
sequenceConditionOps = new List<IOperation>();
for (ConditionID id = ConditionID.A; id < ConditionID.Count; id++)
{
sequenceConditionOps.Add(new SequenceConditionOp(this, id));
}
}
/// IDevice interface - only Initialize() is used
public override void Initialize()
@ -97,16 +108,60 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
{
if (DebugLevel == DebugMode.Normal)
{
return (new iPerlCommunicationSeq()).Execute(test, repetNr, testMethodCfg, testMethodCfg.TestParams);
return (new iPerlCommunicationSeq()).Execute(test, repetNr, this, testMethodCfg.TestParams);
}
else
{
/// DebugLevel == DebugMode.Simulate
(new iPerlCommunicationSeq()).MakeSimulatedTrivial(test, repetNr, test.Part);
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Progress.Completed));
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(Results.Utils.GetTestName(test.Name, 1, 1), 0)));
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(Common.Utils.GetTestName(test.Name, 1, 1), 0)));
return new List<Event> { Event.Done };
}
}
}
public int ConditionsCount { get { return (int)ConditionID.Count; } }
public string ConditionName(int i)
{
return (i >= 0 && i < (int)ConditionID.Count) ? ConditionOp(i).ToString() : string.Empty;
}
public IOperation ConditionOp(int i)
{
return (i >= 0 && i < (int)ConditionID.Count) ? sequenceConditionOps[i] : null;
}
public void StartSession()
{
/// Clear milestones
if (IperlCommMilestone != null)
{
for (int i = 0; i < IperlCommMilestone.Length; i++)
{
IperlCommMilestone[i] = false;
}
}
}
public void SaveMark(object o)
{
/// No marks
}
public void EndSession()
{
/// Nothing at the end of session
}
public bool CheckDeviceCaps(Test test, OutputPath devices, out string message)
{
// Implement the method to satisfy the ITestMethod interface.
// For now, provide a basic implementation.
message = "Device capabilities check not implemented.";
return true;
}
}
}

View File

@ -2,6 +2,8 @@
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using System.IO.Ports;
using System.Threading;
using System.Xml.Serialization;
using Common;
using Config.Entities;
@ -22,9 +24,20 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
public int CommTimeout; /// Communication timeout in ms (500 .. 5000)
public int DelayBetweenRetries; /// Delay between communication retries in ms (0 .. 5000)
public int MaxCommRetries; /// Max. number of retries (1 .. 10)
public int WaitTimeAfterFailure; /// Wait time after communication failure in ms
public int PassThroughWaitTime; /// Pass Through wait time for radio parameters in ms
public int NrThreads; /// Numbwr of parallel threads (1, 2 or 4)
public int IperlCheckErrorsToStop;
///
/// NFC S4.5 Combihead params
///
public int MciTimeoutMs;
public int BaudRate;
public int DataBits;
public Parity ParityBit;
public StopBits StopBits;
public int DfltQ2c_15_rl;
public int DfltQ2c_15_lr;
public int DfltQ2c_20_rl;
@ -59,10 +72,17 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
ParentName = string.Empty;
CommTimeout = 1800; /// ms
MaxCommRetries = 4;
NrThreads = 2; /// 1, 2 or 4 threads
WaitTimeAfterFailure = 2200;
PassThroughWaitTime = 1500;
NrThreads = 2; /// 1, 2 or 4 threads
IperlCheckErrorsToStop = 10;
MciTimeoutMs = 4000; // ms, NFC interface
BaudRate = 57600; // NFC Interface
DataBits = 8; // NFC Interface
ParityBit = Parity.None; // NFC Interface
StopBits = StopBits.Two; // NFC Interface
TestParams = CreateTestParamsProvider() as iPerlCommunicationParams;
TestParams = CreateTestParamsProvider() as iPerlCommunicationParams;
}
public TestMethodCfg(IComponentFactory factory)

View File

@ -9,7 +9,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
public class TestMethodFactory : IComponentFactory
{
public string ClassName { get { return GetType().Namespace.Substring(8); } }
public override string ToString() { return ClassName; }
public IComponent DummyComponent() { return new TestMethod(); }

View File

@ -178,54 +178,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.checkBoxImage1 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage2 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage3 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage4 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage5 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage6 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage7 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage8 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage9 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage10 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage11 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage12 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage13 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage14 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage15 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage16 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage17 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage18 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage19 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage20 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage21 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage22 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage23 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage24 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage25 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage26 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage27 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage28 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage29 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage30 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage31 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage32 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage33 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage34 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage35 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage36 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage37 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage38 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage39 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage40 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage41 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage42 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage43 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage44 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage45 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage46 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage47 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage48 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.saveButton = new System.Windows.Forms.Button();
this.samplePictureBox1 = new System.Windows.Forms.PictureBox();
this.samplePictureBox2 = new System.Windows.Forms.PictureBox();
@ -233,6 +185,54 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
this.sampleLabel1 = new System.Windows.Forms.Label();
this.sampleLabel2 = new System.Windows.Forms.Label();
this.sampleLabel3 = new System.Windows.Forms.Label();
this.checkBoxImage48 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage47 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage46 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage45 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage44 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage43 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage42 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage41 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage40 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage39 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage38 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage37 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage36 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage35 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage34 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage33 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage32 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage31 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage30 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage29 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage28 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage27 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage26 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage25 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage24 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage23 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage22 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage21 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage20 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage19 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage18 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage17 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage16 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage15 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage14 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage13 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage12 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage11 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage10 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage9 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage8 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage7 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage6 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage5 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage4 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage3 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage2 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage1 = new TBF.Rig.TestMethods.iPerlCommunication.CheckBoxImage();
((System.ComponentModel.ISupportInitialize)(this.pictureBox48)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox47)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox46)).BeginInit();
@ -281,57 +281,57 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage6)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage7)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage8)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage9)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage10)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage11)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage12)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage13)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage14)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage15)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage16)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage17)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage18)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage19)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage20)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage21)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage22)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage23)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage24)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage25)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage26)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage27)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage28)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage29)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage30)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage31)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage32)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage33)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage34)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage35)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage36)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage37)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage38)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage39)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage40)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage41)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage42)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage43)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage44)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage45)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage46)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage47)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage48)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.samplePictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.samplePictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.samplePictureBox3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage48)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage47)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage46)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage45)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage44)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage43)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage42)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage41)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage40)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage39)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage38)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage37)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage36)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage35)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage34)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage33)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage32)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage31)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage30)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage29)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage28)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage27)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage26)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage25)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage24)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage23)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage22)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage21)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage20)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage19)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage18)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage17)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage16)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage15)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage14)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage13)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage12)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage11)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage10)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage9)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage8)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage7)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage6)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage1)).BeginInit();
this.SuspendLayout();
//
// wmTextBox2
@ -2639,57 +2639,57 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage4)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage5)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage6)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage7)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage8)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage9)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage10)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage11)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage12)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage13)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage14)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage15)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage16)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage17)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage18)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage19)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage20)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage21)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage22)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage23)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage24)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage25)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage26)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage27)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage28)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage29)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage30)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage31)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage32)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage33)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage34)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage35)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage36)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage37)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage38)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage39)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage40)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage41)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage42)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage43)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage44)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage45)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage46)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage47)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage48)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.samplePictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.samplePictureBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.samplePictureBox3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage48)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage47)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage46)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage45)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage44)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage43)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage42)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage41)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage40)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage39)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage38)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage37)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage36)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage35)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage34)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage33)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage32)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage31)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage30)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage29)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage28)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage27)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage26)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage25)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage24)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage23)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage22)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage21)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage20)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage19)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage18)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage17)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage16)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage15)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage14)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage13)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage12)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage11)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage10)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage9)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage8)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage7)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage6)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage5)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage4)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkBoxImage1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -65,6 +65,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionLRStr);
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionIncl05Str);
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionAltIncl05Str);
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionPlusIncl05Str);
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionPlusAltIncl05Str);
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionGreeceIncl05Str);
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionRLIncl05Str);
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionLRIncl05Str);
@ -86,9 +88,16 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
retVal.Add(iPerlCommunicationForm.Write2HzCorrectionStr);
retVal.Add(iPerlCommunicationForm.DewaReworkRLStr);
retVal.Add(iPerlCommunicationForm.DewaReworkLRStr);
retVal.Add(iPerlCommunicationForm.StartTestingSealedMetersStr);
retVal.Add(iPerlCommunicationForm.EndTestingSealedMetersStr);
retVal.Add(string.Format("{0} if enabled", iPerlCommunicationForm.ReadConfigurationStr));
retVal.Add(string.Format("{0} 80", iPerlCommunicationForm.SetTestModeStr));
retVal.Add("iPerl_check prevWorkStep direction q2factors");
for (ConditionID id = ConditionID.A; id < ConditionID.Count; id++)
{
retVal.Add(string.Format(SequenceConditionOp.ConditionNameFmt, id));
}
return retVal;
}
else

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2022 Sensus Slovensko a.s.
/// Copyright (c) 2015-2023 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -11,6 +11,9 @@ using RestClient;
using TBF.Rig.Sequences;
using TBF.Resources;
using TBF.UiBridge;
using Results;
using Results.Entities;
using TBF.Rig.TestMethods.iPerlCommunication.iPerlHead;
namespace TBF.Rig.TestMethods.iPerlCommunication
{
@ -22,15 +25,16 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
public const string StrictQ2ErrorCheckStr = "Strict Q2 error check ";
public const string Q2correctionCheckCmd = "Q2 correction check ";
public const string IperlCheckCmd = "iPERL_check ";
public const string SimulateCmd = "simulate ";
System.Windows.Forms.Form modelessDlg;
System.Windows.Forms.Form modelessDlg;
///
delegate void iPerlCommFormDlgt(iPerlCommunicationSeq myRef, TestMethodCfg cfg, Test test, iPerlCommunicationParams testParams);
delegate void iPerlCommFormDlgt(iPerlCommunicationSeq myRef, TestMethod method, Test test, iPerlCommunicationParams testParams);
///
void OpenIPerlCommForm(iPerlCommunicationSeq myRef, TestMethodCfg cfg, Test test, iPerlCommunicationParams testParams)
void OpenIPerlCommForm(iPerlCommunicationSeq myRef, TestMethod method, Test test, iPerlCommunicationParams testParams)
{
myRef.modelessDlg = new iPerlCommunicationForm(cfg, test, testParams);
myRef.modelessDlg = new iPerlCommunicationForm(method, test, testParams);
myRef.modelessDlg.Show();
}
@ -52,8 +56,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
/// </returns>
public IList<Event> Execute(Test test, int repetitionNr, TestMethodCfg cfg, iPerlCommunicationParams testParams)
public IList<Event> Execute(Test test, int repetitionNr, TestMethod method, iPerlCommunicationParams testParams)
{
TestMethodCfg cfg = method.Cfg as TestMethodCfg;
IList<Event> e; /// Events from currently running operations
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
modelessDlg = null;
@ -69,17 +75,16 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Get 'wmType' from IperlHead procedure parameters
int wmType = 0;
if (IperlHeads != null)
#if IPERL
/*foreach (var wm in ProcessData.BatchRslts.Batch.WaterMeters)
{
foreach (var ih in IperlHeads)
if (wm != null && !wm.Disabled && wm.WMTypeId() > 0)
{
if (ih.WMType_ID > 0)
{
wmType = ih.WMType_ID;
break;
}
wmType = wm.WMTypeId();
break;
}
}
}*/
#endif
if (cfg.UseWebService)
{
@ -121,9 +126,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.JustStarted));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.FlowSetting));
string fromTestName = testParams.Activity.Substring(cmd.Length);
MakeQ2CorrectedFrom(test.Name, fromTestName);
string[] args = testParams.Activity.Substring(cmd.Length).Split(new char[] { ' ' });
string fromTestName = (args.Length >= 1) ? args[0] : string.Empty;
bool isPlus = (args.Length >= 2) ? args[1].ToLower().Contains("plus") : false;
MakeQ2CorrectedFrom(test.Name, fromTestName, isPlus);
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.Completed));
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(test.Name, 0)));
@ -174,9 +180,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
string[] args = testParams.Activity.Substring(cmd.Length).Split(new char[] { ' ' });
int maxTestIndex = (ProcessData.BenchInfo is DataContainer.iPerlBenchInfo.Component)
? (ProcessData.BenchInfo as DataContainer.iPerlBenchInfo.Component).MaxTestIndex
: int.MaxValue;
//int maxTestIndex = (ProcessData.BenchInfo is TBF.Rig.DataContainer.BenchInfo.Component)
// ? (ProcessData.BenchInfo as TBF.Rig.DataContainer.BenchInfo.Component).MaxTestIndex
// : int.MaxValue;
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(test.Name, 0);
@ -285,7 +291,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
return new List<Event> { Event.Done };
}
else if (testParams.Activity.ToLower().Contains(cmd = "simulate "))
else if (testParams.Activity.ToLower().Contains(cmd = SimulateCmd))
{
TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 });
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.JustStarted));
@ -298,9 +304,49 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
else if (testParams.Activity.Substring(cmd.Length).ToLower() == "compound nok") MakeSimulatedCompound(test, 1, 0, 4.7f, 0.9f);
else if (testParams.Activity.Substring(cmd.Length).ToLower() == "compound rise") MakeSimulatedCompound(test, 1, 0, 0.7f, 0.0f);
else if (testParams.Activity.Substring(cmd.Length).ToLower() == "compound fall") MakeSimulatedCompound(test, 1, 0, 0.7f, 0.9f);
else if (testParams.Activity.Substring(cmd.Length).ToLower() == "iperls")
{
string[] pcbNrs = new string[] { "831232435539", "831232435562", "831232435587",
"831232432141", "831232432497", "831232763641" };
TestRslt tstRslt = BatchRslts.GetTestRslt(test.Name, test.Part);
if (tstRslt != null)
{
Results.Utils.GetCounterStates(tstRslt, Program.LocalSettings.Counters);
/// Auxiliary results ... not required
/// Main results
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
tstRslt.TestDone = true;
tstRslt.StartTime = tstRslt.Batch.StartTime;
tstRslt.EndTime = DateTime.Now;
tstRslt.FlowSetTime = 0;
tstRslt.MassOfEvapWater = 0;
tstRslt.TestTime = 1;
for (int i = 0; i < BatchRslts.Batch.WaterMeters.Count; i++)
{
MeterTestRslt meterRslt =
BatchRslts.GetMeterTestRslt(test.Name, i, CompoundMeterId.Single);
if (meterRslt != null)
{
meterRslt.WaterMeter.SerialNr = pcbNrs[i % pcbNrs.Length];
meterRslt.Passed = true;
meterRslt.TestDone = true;
}
//if (iperlHeads[i] != null)
//{
// iperlHeads[i].CommFailed = iperlHeads[i].Disabled = false;
// iperlHeads[i].SerialNr = pcbNrs[i % pcbNrs.Length];
//}
}
}
}
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.Completed));
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(Results.Utils.GetTestName(test.Name, 1, 1), 0)));
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(Common.Utils.GetTestName(test.Name, 1, 1), 0)));
allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
//------------------------------------------------
@ -308,8 +354,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
//------------------------------------------------
State.Create(string.Format("iPerlCommunicationSeq : {0}", testParams.Activity))
.AddOperation(checkUiOp)
.EnterState();
.AddOperation(checkUiOp)
.EnterState();
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e))
@ -322,7 +368,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
///
/// Show the modeless dialog with error indication
///
Program.MainWnd.Invoke(new iPerlCommFormDlgt(OpenIPerlCommForm), new object[] { this, cfg, test, testParams });
Program.MainWnd.Invoke(new iPerlCommFormDlgt(OpenIPerlCommForm), new object[] { this, method, test, testParams });
//------------------------------------------------
Bridge.OnActivity(this, Strings.iPerl_Communication_in_progress);
@ -332,10 +378,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
bool completed = false;
State.Create("iPerlCommunicationSeq : Wait until the entry form is closed")
.AddOperation(checkUiOp)
.EnterState();
do
{
.AddOperation(checkUiOp)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
stopPressed = TestAndLogUiCmdStop(test, e);
completed = (modelessDlg is GenericDevices.IHasCompleted)
@ -475,7 +520,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="testName">This test name</param>
/// <param name="oriTestRslt">Name of Q2 test done before Q2 correction (Q2adj)</param>
/// <remarks>Assuming this test does not have multiple parts (part = 0)</remarks>
void MakeQ2CorrectedFrom(string testName, string oriTestName)
void MakeQ2CorrectedFrom(string testName, string oriTestName, bool isPlus = false)
{
Results.Entities.TestRslt oriTestRslt = ProcessData.BatchRslts.GetTestRslt(oriTestName, 0);
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(testName, 0);
@ -551,8 +596,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
tstRslt.MassEndRaw = oriTestRslt.MassEndRaw;
tstRslt.MassEnd = oriTestRslt.MassEnd;
tstRslt.MassOfEvapWater = oriTestRslt.MassOfEvapWater;
tstRslt.Qdetected = oriTestRslt.Qdetected;
tstRslt.Flow = oriTestRslt.Flow;
//tstRslt.FlowMass = oriTestRslt.FlowMass;
//tstRslt.FlowVolume = oriTestRslt.FlowVolume;
tstRslt.VolumeCTV = oriTestRslt.VolumeCTV;
tstRslt.VolumeMaster = oriTestRslt.VolumeMaster;
tstRslt.ErrorMaster = oriTestRslt.ErrorMaster;
@ -572,15 +617,19 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
for (int i = 0; i < ProcessData.BatchRslts.WMPositionsCount; i++)
{
Results.Entities.MeterTestRslt oriMeterRslt = ProcessData.BatchRslts.GetMeterTestRslt(oriTestName, i, CompoundMeterId.Single);
Results.Entities.MeterTestRslt meterRslt = ProcessData.BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
// Fix for CS7036: Added the missing 'meterId' argument to the GetMeterTestRslt method call.
var q3mtr = ProcessData.BatchRslts.GetMeterTestRslt("Q3", i, CompoundMeterId.SingleOrCompound);
double q3error = (q3mtr != null) ? q3mtr.Error : 0;
Results.Entities.MeterTestRslt oriMeterRslt = ProcessData.BatchRslts.GetMeterTestRslt(oriTestName, i, CompoundMeterId.SingleOrCompound);
Results.Entities.MeterTestRslt meterRslt = ProcessData.BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.SingleOrCompound);
/// Reference to iPerl water meter or null:
TestMethods.iPerlCommunication.iPerlHead.IperlHead iPerl = ((sensPath != null) && (sensPath.RegisterReaders != null) && (i < sensPath.RegisterReaders.Length))
? (sensPath.RegisterReaders[i] as TestMethods.iPerlCommunication.iPerlHead.IperlHead)
: null;
if (meterRslt != null && oriMeterRslt != null)
if (iPerl != null && meterRslt != null && oriMeterRslt != null)
{
#if ORACLE_DB
meterRslt.ErrorBC = oriMeterRslt.Error;
@ -591,33 +640,27 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
meterRslt.VolumeRef = oriMeterRslt.VolumeRef;
meterRslt.TestTime = oriMeterRslt.TestTime;
if (iPerl == null || ((iPerl.Q2CorrRL == 0) && (iPerl.Q2CorrLR == 0)))
if (q3error * oriMeterRslt.Error < 0)
{
/// Either no iPerl head or no Q2 correction
meterRslt.Error = oriMeterRslt.Error;
meterRslt.VolumeMeter = oriMeterRslt.VolumeMeter;
meterRslt.VolumeStart = oriMeterRslt.VolumeStart;
meterRslt.VolumeEnd = oriMeterRslt.VolumeEnd;
meterRslt.Passed = (meterRslt.Error >= tstRslt.ErrLimLo() + tstRslt.ErrLimMargin()
&& meterRslt.Error <= tstRslt.ErrLimHi() - tstRslt.ErrLimMargin());
meterRslt.TestDone = true;
tstRslt.TestDone = true;
/// iPerl with Q2 correction => generate an artificial error equal to +1/10 of the original one (relative to Q2 target error)
meterRslt.Error = 0.1 * oriMeterRslt.Error;
}
else
{
/// iPerl with Q2 correction => generate an artificial error equal to -1/10 of the original one (relative to Q2 target error)
double targetError = iPerl.CalibTargetQ2;
meterRslt.Error = targetError - 0.1 * (oriMeterRslt.Error - targetError);
meterRslt.VolumeMeter = oriMeterRslt.VolumeRef * (100.0 + meterRslt.Error) / 100.0;
meterRslt.VolumeStart = oriMeterRslt.VolumeStart;
double signature = (oriMeterRslt.VolumeEnd > oriMeterRslt.VolumeStart) ? (+1) : (-1);
meterRslt.VolumeEnd = meterRslt.VolumeStart + signature * meterRslt.VolumeMeter;
meterRslt.Passed = (meterRslt.Error >= tstRslt.ErrLimLo() + tstRslt.ErrLimMargin()
&& meterRslt.Error <= tstRslt.ErrLimHi() - tstRslt.ErrLimMargin());
meterRslt.TestDone = true;
tstRslt.TestDone = true;
meterRslt.Error = - 0.1 * oriMeterRslt.Error;
}
}
meterRslt.VolumeMeter = meterRslt.VolumeRef * (100.0 + meterRslt.Error) / 100.0;
double signature = (oriMeterRslt.VolumeEnd > oriMeterRslt.VolumeStart) ? (+1) : (-1);
meterRslt.VolumeStart = oriMeterRslt.VolumeStart;
meterRslt.VolumeEnd = meterRslt.VolumeStart + signature * meterRslt.VolumeMeter;
meterRslt.Passed = (meterRslt.Error >= tstRslt.ErrLimLo() + tstRslt.ErrLimMargin()
&& meterRslt.Error <= tstRslt.ErrLimHi() - tstRslt.ErrLimMargin());
meterRslt.TestDone = true;
tstRslt.TestDone = true;
}
}
}
@ -703,8 +746,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
tstRslt.MassEndRaw = oriTestRslt.MassEndRaw;
tstRslt.MassEnd = oriTestRslt.MassEnd;
tstRslt.MassOfEvapWater = oriTestRslt.MassOfEvapWater;
tstRslt.Qdetected = oriTestRslt.Qdetected;
tstRslt.Flow = oriTestRslt.Flow;
//tstRslt.FlowMass = oriTestRslt.FlowMass;
//tstRslt.FlowVolume = oriTestRslt.FlowVolume;
tstRslt.VolumeCTV = oriTestRslt.VolumeCTV;
tstRslt.VolumeMaster = oriTestRslt.VolumeMaster;
tstRslt.ErrorMaster = oriTestRslt.ErrorMaster;
@ -752,7 +795,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
meterRslt.VolumeStart = oriMeterRslt.VolumeStart;
meterRslt.VolumeEnd = oriMeterRslt.VolumeEnd;
#if ORACLE_DB
if (ProcessData.BatchRslts.Batch.WaterMeters[i].Pruefindex == 1)
if ((ProcessData.BatchRslts.Batch.WaterMeters[i].Pruefindex % 100) == 1)
{
meterRslt.Passed = (oriMeterRslt.Error >= tstRslt.ErrLimLo() + tstRslt.ErrLimMargin()
&& oriMeterRslt.Error <= tstRslt.ErrLimHi() - tstRslt.ErrLimMargin());
@ -855,8 +898,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
tstRslt.MassEndRaw = testRsltQ2ac.MassEndRaw;
tstRslt.MassEnd = testRsltQ2ac.MassEnd;
tstRslt.MassOfEvapWater = testRsltQ2ac.MassOfEvapWater;
tstRslt.Qdetected = testRsltQ2ac.Qdetected;
tstRslt.Flow = testRsltQ2ac.Flow;
//tstRslt.FlowMass = testRsltQ2ac.FlowMass;
//tstRslt.FlowVolume = testRsltQ2ac.FlowVolume;
tstRslt.VolumeCTV = testRsltQ2ac.VolumeCTV;
tstRslt.VolumeMaster = testRsltQ2ac.VolumeMaster;
tstRslt.ErrorMaster = testRsltQ2ac.ErrorMaster;
@ -894,14 +937,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
meterRslt.TestDone = meterRsltQ2ac.TestDone;
tstRslt.TestDone = true;
double targetError = 0;
if ((sensPath != null) && (sensPath.RegisterReaders != null) && (sensPath.RegisterReaders.Length > i) && (sensPath.RegisterReaders[i] is iPerlHead.IperlHead))
{
targetError = (sensPath.RegisterReaders[i] as iPerlHead.IperlHead).CalibTargetQ2;
}
if ((((meterRsltQ2bc.Error - targetError) < -0.51) && (meterRsltQ2ac.Error < meterRsltQ2bc.Error)) ||
(((meterRsltQ2bc.Error - targetError) > +0.51) && (meterRsltQ2ac.Error > meterRsltQ2bc.Error)))
if (((meterRsltQ2bc.Error < -0.51) && (meterRsltQ2ac.Error < meterRsltQ2bc.Error)) ||
((meterRsltQ2bc.Error > +0.51) && (meterRsltQ2ac.Error > meterRsltQ2bc.Error)))
{
meterRslt.Passed = false; /// Q2 correction check failed
}

View File

@ -2,19 +2,22 @@
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using TBF.Rig.TestMethods.iPerlCommunication.iPerlHead;
using static Sensus.iPerl.NfcHandler.MCI_Protocol;
namespace TBF.Rig.TestMethods.iPerlCommunication
{
public class iPerlDataWrite
{
public MessageID MessageID;
public StructName StructName;
public int Offset;
public byte[] Data;
public string Description;
public iPerlDataWrite(MessageID mesageID, int offset, byte[] data, string description)
public iPerlDataWrite(MessageID mesageID, StructName structName, int offset, byte[] data, string description)
{
MessageID = mesageID;
StructName = structName;
Offset = offset;
Data = data;
Description = description;

View File

@ -17,7 +17,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
RL,
LR,
Standard_incl_05,
Standard_plus_incl_05,
Dewa_incl_05,
Dewa_plus_incl_05,
Greece_incl_05,
RL_incl_05,
LR_incl_05,

View File

@ -104,4 +104,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
Flush = 0,
ProcessAndSave,
}
public enum CommunicationInterface
{
RFID,
NFC
}
}

View File

@ -9,7 +9,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
public class Factory : IComponentFactory
{
public string ClassName { get { return "RegisterReader for iPerl"; } }
public override string ToString() { return ClassName; }
public IComponent DummyComponent() { return new IperlHead(); }

View File

@ -2,25 +2,28 @@
/// Copyright (c) 2015-2022 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Ports;
using System.Linq;
using log4net;
using Common;
using Common.Iperl;
using Config.Entities;
using TBF.Rig.Generic;
using TBF.Rig.GenericDevices;
using TBF.Rig.Output;
using TBF.Rig.Sequences;
using Sensus.iPerl.NfcHandler;
using NHibernate;
using Renci.SshNet;
using System.Linq;
using System.Xml;
using System.Xml.Linq; // This line is correct and does not need to be changed.
using System.Windows;
namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
{
/// <summary>
/// This component = instance of this class is a placeholder for a combined main watermeter
/// </summary>
public class IperlHead : ComponentBase, IDevice, IRegReaderDatastream, ISessionDataMngmnt, IOperation
public class IperlHead : ComponentBase, IDevice,IRegReaderDatastream, ISessionDataMngmnt, IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(IperlHead));
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
@ -40,9 +43,11 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
readonly IperlHeadCfg iperlHeadCfg;
public int RfidComPortNr { get { return iperlHeadCfg.RfidComPortNr; } }
public int OptoComPortNr { get { return iperlHeadCfg.OptoComPortNr; } }
public int MuxBoardNrOrGroup14 { get { return iperlHeadCfg.MuxBoardNr; } }
public int Group { get { return iperlHeadCfg.Group; } }
public iPerlHead.MeterType MeterType { get { return iperlHeadCfg.MeterType; } }
public CommunicationInterface CommInterface { get { return iperlHeadCfg.CommunicationInterface; } }
public int Position
{
@ -58,11 +63,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
public double LtrsPerPulse { get { return 1 / PulsesPerLtr; } }
public double CalibTarget { get { return iperlHeadCfg.ProcParams.CalibTarget; } }
public double CalibTargetQ2 { get { return iperlHeadCfg.ProcParams.CalibTargetQ2; } }
public ushort FactorLimitLo { get { return (ushort)iperlHeadCfg.ProcParams.FactorLimitLo; } }
public ushort FactorLimitHi { get { return (ushort)iperlHeadCfg.ProcParams.FactorLimitHi; } }
public Counting InitFlowDir { get { return (iperlHeadCfg != null && iperlHeadCfg.ProcParams != null) ? iperlHeadCfg.ProcParams.Counting : Counting.Arbitrary; } }
public int WMType_ID { get { return iperlHeadCfg.ProcParams.WMType_ID; } } /// Required by Oracle DB
/// Properties set by the Begin and the End form
@ -70,10 +73,17 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
{
get
{
if (ConfigStruct != null) return ConfigStruct.GetPcbNrString();
else return string.Empty;
if (ConfigStruct != null)
return ConfigStruct.GetPcbNrString();
else if (simulatedPcbNr != null)
return simulatedPcbNr;
else
return string.Empty;
}
set
{
simulatedPcbNr = value;
}
set { }
}
public bool Disabled;
@ -103,6 +113,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
public CalibrationStruct CalibrationStruct; /// CalibrationStruct of WM obtained or updated by iPerlCommunication
public CalibrationStructV4 CalibrationStructV4; /// CalibrationStruct of WM obtained or updated by iPerlCommunication
public Byte OrigTestModeConfig; /// Written to by StartTestingSealedMeter(), read from by EndTestingSealedMeter()
public ushort OrigCalibFactor;
public ushort CalibFactor
{
@ -152,6 +164,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
public double WMVolume { get { return wmVolume; } }
public double WMTestTime { get { return wmTestTime; } }
string simulatedPcbNr = null;
int wmPulses;
int wmRefPulses;
double beginWMState;
@ -213,11 +227,11 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
/// <param name="nominalFlow">Nominal flow in m3/h</param>
/// <param name="currentFactor">0 or the current Q2 correction factor when updating the factor</param>
/// <returns>Calculated Q2 correction factor</returns>
public double CalculateQ2CorrectionFactor(Results.Entities.MeterTestRslt q2adjResult, double calibTarget, double nominalFlow, int currentFactor = 0)
public double CalculateQ2CorrectionFactor(Results.Entities.MeterTestRslt currentQ2Result, int currentFactor, double nominalFlow, double errorTarget = 0)
{
double nominalTestFlowLph = Units.ConvertTo(Common.Unit.lph, nominalFlow);
double volumeRefShiftedToTarget = q2adjResult.VolumeRef * (1.0 + calibTarget / 100.0);
double q2adjErrorShiftedToTarget = Formulas.ErrorFromVolumes(q2adjResult.VolumeMeter, volumeRefShiftedToTarget);
double nominalTestFlowLph = Units.ConvertTo(Unit.lph, nominalFlow);
double volumeRefShiftedToTarget = currentQ2Result.VolumeRef * (1.0 + errorTarget / 100.0);
double q2adjErrorShiftedToTarget = Config.Formulas.ErrorFromVolumes(currentQ2Result.VolumeMeter, volumeRefShiftedToTarget);
double A = 16.0 / ScalingFactor(); /// Raw units per ml: DN15=16, DN20=8, DN25=4, DN32=2, DN40=1
const double B = 8.0; /// Raw units per minute, 8
@ -226,14 +240,16 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
double F = D / (nominalTestFlowLph * 10.0); /// Error corrected with 8 Raw Units per minute [%]
double G = F / B; /// Error corrected with 1 Raw Unit per minute [%]
double q2CorrectionFactor = Convert.ToDouble(currentFactor)
- (q2adjErrorShiftedToTarget / G) * (volumeRefShiftedToTarget / q2adjResult.VolumeMeter);
/// Do not change the factor for an invalid measurement (q2adjResult.VolumeMeter == 0)
double q2CorrectionFactor = (Math.Abs(currentQ2Result.VolumeMeter) <= float.Epsilon) ? Convert.ToDouble(currentFactor) :
Convert.ToDouble(currentFactor) - (q2adjErrorShiftedToTarget / G) * (volumeRefShiftedToTarget / currentQ2Result.VolumeMeter);
log.WarnFormat("CalculateQ2CorrectionFactor() : Pos={0}, PCB#={1}, Error={2}%, CalTarget={3}%, Q2CorrFactor={4}",
log.WarnFormat("CalculateQ2CorrectionFactor() : Pos={0}, PCB#={1}, Error={2}%, Target={3}%, Current factor={4} New factor={5}",
Name,
SerialNr,
q2adjResult.Error.ToString("F2"),
calibTarget.ToString("F1"),
currentQ2Result.Error.ToString("F2"),
errorTarget.ToString("F3"),
currentFactor.ToString("F1"),
q2CorrectionFactor.ToString("F1"));
return q2CorrectionFactor;
@ -283,12 +299,11 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
/// </summary>
/// <param name="test">Currently executed test</param>
/// <param name="repetitionNr">Currently executed repetition number</param>
public void TestIsGoingToStartSoon(Test test, int repetitionNr)
public void TestIsGoingToStartSoon(Test _test, int _repetitionNr)
{
/// Store/update values to be used as a part of the opto-data log file name
testName = test.Name;
testRepeats = test.Repeats;
this.repetitionNr = repetitionNr;
this.test = _test;
this.repetitionNr = _repetitionNr;
if (IsDataStreamProcessing())
{
@ -324,8 +339,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
}
}
///
string testName;
int testRepeats;
Test test;
int repetitionNr;
@ -420,20 +434,26 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
synchronized = false;
synchronized2 = false;
partOfTelegram = string.Empty;
optoSerialPort = null;
if (DebugLevel == DebugMode.Normal)
{
/// Open serial port: 9600 Bd, 8 data bits, 1 stop bit, no parity
string portName = string.Format("COM{0}", iperlHeadCfg.OptoComPortNr);
optoSerialPort = new SerialPort(portName, 9600, Parity.None, 8, StopBits.One);
optoSerialPort.Handshake = Handshake.None;
optoSerialPort.Open();
log.FatalFormat("{0} initialized: {1}", Name, this);
/// Check whether head is connected, working
try
{
OpenOptoSerialPort($"COM{iperlHeadCfg.OptoComPortNr}", 9600, Parity.None, 8, StopBits.One, Handshake.None);
CloseOptoSerialPort();
log.FatalFormat($"{Name} initialized: {this}");
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
else
{
optoSerialPort = null;
log.FatalFormat("{0} simulated: {1}", Name, this);
log.FatalFormat($"{Name} simulated: {this}");
}
}
@ -451,6 +471,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
CalibrationStruct = null;
CalibrationStructV4 = null;
OrigTestModeConfig = 0;
LastTestResult = null;
LastTestResult2 = null;
@ -460,6 +482,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
Q2CorrRL = 0;
Q2CorrLR = 0;
simulatedPcbNr = null;
dataStreamState = DataStreamState.Flush;
currentFlowDir = InitFlowDir;
@ -535,10 +559,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
{
try
{
if (DebugLevel == DebugMode.Normal && optoSerialPort != null)
if (optoSerialPort != null)
{
optoSerialPort.Close();
optoSerialPort = null;
CloseOptoSerialPort();
}
}
catch
@ -552,7 +575,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
/// Events: Event.ReadRegisterDone, Event.Error
/// </summary>
/// <returns>ReadWaterMeter instance reference casted to IOperaton</returns>
public IOperation ReadDatastreamOp()
public IOperation ReadRegisterOp()
{
return this;
}
@ -656,20 +679,26 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
//
// log.DebugFormat("Feature vector calculation end, save opto-file start: {0:HH:mm:ss.fff}", DateTime.Now);
string relativeDirectory = Path.Combine(StateMachine.CycleStartTimeStamp.ToString("yy"),
StateMachine.CycleStartTimeStamp.ToString("MM"),
StateMachine.CycleStartTimeStamp.ToString("dd"));
string directory = Path.Combine(OptoDataDirectory, relativeDirectory);
string fileName = DetermineExtraDataFileName();
if (!string.IsNullOrEmpty(fileName))
#if ORACLE_DB
if (test.RawDataId + (test.Repeats - repetitionNr) * test.RawDataIdRepetMulti != 0)
{
if (SaveOptoDataToFile(directory, fileName))
string relativeDirectory = Path.Combine(StateMachine.CycleStartTimeStamp.ToString("yy"),
StateMachine.CycleStartTimeStamp.ToString("MM"),
StateMachine.CycleStartTimeStamp.ToString("dd"));
string fileName = DetermineExtraDataFileName();
if (SaveOptoDataToFile(Path.Combine(OptoDataDirectory, relativeDirectory), fileName))
{
extraDataPath = Path.Combine(relativeDirectory, fileName);
}
}
log.WarnFormat("IperlHeadd.Stop() startIx={0} endIx={1} optoData.Len={2} filename={3}", startIx, endIx, optoData.Length, !string.IsNullOrEmpty(fileName) ? fileName : "<null>");
log.WarnFormat("IperlHead.Stop() startIx={0} endIx={1} len={2} raw data file = {3}",
startIx, endIx, optoData.Length, fileName);
}
else
#endif
{
log.WarnFormat("IperlHead.Stop() startIx={0} endIx={1} len={2} no raw data file", startIx, endIx, optoData.Length);
}
if (TestStartTelegramIx == 0 || optoDataCount < 100)
{
@ -736,36 +765,27 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
string DetermineExtraDataFileName()
{
///
/// Select or create appropriate test infos
///
Results.Output.SensusTestInfo[] testInfos = Sequences.ProcessData.CompleteTestInfos;
///
if ((ProcessData.OracleDB != null && ProcessData.OracleDB.DesigMode == Output.DB.SensusOracle.DesigMode.Based_on_procedure) ||
(testInfos == null && StateMachine.Procedure != null))
{
testInfos = Results.Output.SensusTestInfo.CreateFromProcedure(StateMachine.Procedure);
}
///
/// Select or create appropriate 'qBezeichnung'
///
string fullTestName = Results.Utils.GetTestName(testName, testRepeats, repetitionNr);
var ti = testInfos.FirstOrDefault(x => x.PruefungsNrOpto != 0 && x.TestName == fullTestName);
string qBezeichnung = (ti == null) ? fullTestName /// No appropriate TestInfo found => set default opto data file name
: string.IsNullOrEmpty(ti.QBezeichnungOpto) ? ti.PruefungsNrOpto.ToString("D2")
: ti.QBezeichnungOpto;
///
/// Get other required pieces of information
/// Get required pieces of information
///
string pcbNr = (ConfigStruct != null) ? ConfigStruct.GetPcbNrString() : "UnknownPcbNr";
string wmPosition = Name.Substring(5); /// WMPosition is extracted from a component name in form 'iPerl#'
if (wmPosition.Length == 1) wmPosition = "0" + wmPosition;
string cycleStartTime = StateMachine.CycleStartTimeStamp.ToString("HH_mm_ss");
#if ORACLE_DB
string[] designations = string.IsNullOrEmpty(test.RawDataDesignation) ? new string[0] : test.RawDataDesignation.Split(new char[] { '~' });
int testId = test.RawDataId + (test.Repeats - repetitionNr) * test.RawDataIdRepetMulti;
string designation = string.IsNullOrEmpty(test.RawDataDesignation)
? testId.ToString(testId > 0 ? "D2" : "D1") /// Name is generated from Id
: (designations.Length > repetitionNr - 1) ? designations[repetitionNr - 1] /// Name is from 'RawDataDesignation' parameter
: string.Format("{0}-{1}", designations[0], repetitionNr); /// Name is form test name and repetition nr.
#else
int testId = 0;
string designation = (test.Repeats == 1) ? test.Name : string.Format("{0}-{1}", test.Name, repetitionNr);
#endif
///
/// Return the file name
///
return string.Format("{0}_{1}_{2}_{3}.txt", pcbNr, wmPosition, qBezeichnung, cycleStartTime);
///
return string.Format("{0}_{1}_{2}_{3}.txt", pcbNr, wmPosition, designation, cycleStartTime);
}
@ -775,7 +795,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
bool SaveOptoDataToFile(string directory, string fileName)
{
string fullFileName = Path.Combine(directory, fileName);
log.WarnFormat("Saving {0} opto data to {1}", Name, fullFileName);
log.WarnFormat("Saving {0} raw data to {1}", Name, fullFileName);
try
{
@ -840,6 +860,42 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
wmTestTime = timestampSec - timestampSec0;
}
private void OpenOptoSerialPort(string comPort, int baudRate, Parity parity, int dataBits, StopBits stopBit, Handshake handshake)
{
if (DebugLevel == DebugMode.FailureDuringOperation) DebugLevel = DebugMode.Normal;
if (DebugLevel == DebugMode.Normal)
{
/// Open serial port: 9600 Bd, 8 data bits, 1 stop bit, no parity
try
{
CloseOptoSerialPort();
optoSerialPort = new SerialPort(comPort, baudRate, parity, dataBits, stopBit);
optoSerialPort.Handshake = handshake;
optoSerialPort.Open();
log.FatalFormat($"{Name} OptoPort opened: {this}");
}
catch (Exception ex)
{
log.FatalFormat($"{Name} OptoPort - error opening port: {this}" + Environment.NewLine + ex.Message);
throw ex;
}
}
else
{
optoSerialPort = null;
log.FatalFormat($"{Name} OproPort simulated: {this}");
}
}
private void CloseOptoSerialPort()
{
if (optoSerialPort != null)
{
optoSerialPort.Close();
optoSerialPort = null;
log.FatalFormat($"{Name} OptoPort closed: {this}");
}
}
DataStreamState dataStreamState;
@ -848,6 +904,13 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
/// </summary>
public void StartDataStreamProcessing()
{
try
{
OpenOptoSerialPort($"COM{iperlHeadCfg.OptoComPortNr}", 9600, Parity.None, 8, StopBits.One, Handshake.None);
}
catch (Exception)
{
}
/// Reset opto-data, etc.
optoDataCount = 0;
timeFromStart = 0;
@ -878,20 +941,21 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
/// <summary>
/// Stop processing and saving datastream data
/// </summary>
void StopDataStreamProcessing()
public void StopDataStreamProcessing()
{
dataStreamState = DataStreamState.Flush;
CloseOptoSerialPort();
}
///
/// Variables storing the context of serial port data parsing (ReadOptoSerialPort(...))
///
bool synchronized;
///
/// Variables storing the context of serial port data parsing (ReadOptoSerialPort(...))
///
bool synchronized;
bool synchronized2;
string partOfTelegram;
/// <summary>
/// Reads opto-datastream via serual port. Invoked from RunDeviceBefore()
/// Reads opto-datastream via serial port. Invoked from RunDeviceBefore()
///
/// Telegram description:
/// AAAAAA[tab]BBBB[tab]CCCC[tab]DDDDDD[tab]EEEE[tab]FFFFFFFF[tab]GG[cr][lf] (42 bytes)
@ -903,6 +967,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
/// <param name="optoState">OptoState.Read or OptoState.Flush</param>
void ReadOptoData(DataStreamState optoState)
{
if (optoSerialPort is null) return;
lock (this)
{
int nrBytes = optoSerialPort.BytesToRead;
@ -949,7 +1014,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
{
/// CR+LF was found && (pos >= OptoTelegramRaw.Length - 2) && the telegram is OK
flowDirectionDetection.WriteToFifo(volumeRawExtLast, timestampExtLast);
OptoTelegramRreceived(optoDataCount, synchronized2, volumeRawExtLast, timestampExtLast);
OptoTelegramReceived(optoDataCount, synchronized2, volumeRawExtLast, timestampExtLast);
synchronized2 = synchronized;
allRcvd = allRcvd.Substring(pos + 2);
}
@ -998,8 +1063,25 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
}
}
public string ReadOptoData()
{
if (optoSerialPort is null) return "";
string received = ".";
lock (this)
{
int nrBytes = optoSerialPort.BytesToRead;
if (nrBytes > 0)
{
char[] buffer = new char[nrBytes];
optoSerialPort.Read(buffer, 0, nrBytes);
received = new string(buffer);
}
}
return received;
}
void OptoTelegramRreceived(int currentIx, bool async, Int64 volumeRawExt, Int64 timestampRawExt)
void OptoTelegramReceived(int currentIx, bool async, Int64 volumeRawExt, Int64 timestampRawExt)
{
currentTelegramIx = currentIx;
@ -1029,6 +1111,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
/// <summary>
///
/// Called from the state machine when a test is selected and UI needs to be updated.
/// </summary>
public void OnOptoReceived(object sender, OptoReceivedEventArgs args)
@ -1326,5 +1409,72 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
if (reader.ReadBoolean()) (LastTestResult = new Results.Entities.MeterTestRslt()).ReadBinary(reader, null);
if (reader.ReadBoolean()) (LastTestResult2 = new Results.Entities.MeterTestRslt()).ReadBinary(reader, null);
}
internal void ResetNfcInterface(bool? nfc_on = null)
{
if (iperlHeadCfg.HeadCommunicationComPortNr == 0) return;
SERIAL_Driver _SERIAL_Driver_Head_Config = new SERIAL_Driver();
_SERIAL_Driver_Head_Config.OpenConnection($"COM{iperlHeadCfg.HeadCommunicationComPortNr}", 9600, 8, Parity.None, StopBits.One);
NFCHeadConfig _NFCHead_Config = new NFCHeadConfig(_SERIAL_Driver_Head_Config);
if (nfc_on == null || nfc_on == false) _NFCHead_Config.NFCHeadConfig_SetInterface(false); // set RFID interface
if (nfc_on == null || nfc_on == true ) _NFCHead_Config.NFCHeadConfig_SetInterface(true); // set NFC interface
_SERIAL_Driver_Head_Config.Close();
_SERIAL_Driver_Head_Config.Dispose();
}
internal void SetNfcInterface()
{
ResetNfcInterface(true);
}
internal void SetRfidInterface()
{
ResetNfcInterface(false);
}
internal void SetCommunicationInterface(CommunicationInterface commInterface)
{
//using (ISession session = TBF.DB.ConfigDBSessionFactory.OpenSession())
// Replace the problematic line with the following code to fix the error:
using (ISession session = TBF.DB.SessionFactories[(int)DBKind.Config].OpenSession())
using (ITransaction tx = session.BeginTransaction())
{
try
{
var cmpntEntities = session.QueryOver<Component>()
.OrderBy(x => x.ItemNr).Asc
.List<Component>();
var cmpnt = cmpntEntities.Where(x => x.Name == Name).First();
if (cmpnt != null)
{
XDocument doc = XDocument.Parse(cmpnt.Parameters);
if (doc != null)
{
XElement element = doc.Root.Element("CommunicationInterface");
if (element != null)
{
element.Value = commInterface.ToString();
cmpnt.Parameters = doc.ToString();
session.SaveOrUpdate(cmpnt);
tx.Commit();
log.FatalFormat($"Set CommunicationInterface {Name} to {commInterface.ToString()}");
}
}
}
}
catch (Exception ex)
{
if (tx != null) tx.Rollback();
log.FatalFormat($"Set CommunicationInterface {Name} error: {ex.Message}");
}
}
}
public IOperation ReadDatastreamOp()
{
return this;
}
}
}

View File

@ -21,10 +21,12 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
public bool UseTcpIP;
public string OptoIPAddress;
public ushort OptoTcpipPortNr;
public int HeadCommunicationComPortNr;
public int OptoComPortNr;
public int RfidComPortNr; /// 0 = use MuxBoardNr
public int MuxBoardNr; /// 0 = use RfidComPort(Nr), otherwise mux. board nr. 1 .. 4
public int Group; /// Number written to QuidoRS to connct the watermeter to RfidComPort, 1 .. 10
public CommunicationInterface CommunicationInterface; /// Communication Interface: RFID or NFC
/// <summary> Procedure parameters </summary>
[XmlIgnore]
@ -45,6 +47,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
RfidComPortNr = 0; /// = use mux. board
MuxBoardNr = 1;
ProcParams = CreateProcParamsProvider() as ProcParams;
CommunicationInterface = CommunicationInterface.RFID;
HeadCommunicationComPortNr = 0;
}
public IperlHeadCfg(IComponentFactory factory)
@ -55,12 +59,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
public string ToString(int i)
{
return string.Format("{0} Group1 (mux#)={1}, Group2={2}, Opto=Com{3}, RFID=Com{4}",
Name,
MuxBoardNr,
Group,
OptoComPortNr,
RfidComPortNr);
return $"{Name} Group1 (mux#)={MuxBoardNr}, Group2={Group}, Opto=Com{OptoComPortNr}, {CommunicationInterface}=Com{RfidComPortNr}";
}
}
}

View File

@ -3,16 +3,14 @@
///
using System;
using System.Net;
using System.Net.Sockets;
using System.Windows.Forms;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
using TBF.Resources;
namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
{
public partial class IperlHeadCfgCtrl : UserControl, IComponentCfgCtrl
public partial class IperlHeadCfgCtrl : UserControl, IComponentCfgCtrl
{
public bool ShowMore { get { return false; } }
@ -51,11 +49,14 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
radioButton2.Checked = !config.UseTcpIP;
ipAddressTextBox.Text = (config.OptoIPAddress != null) ? config.OptoIPAddress : "0.0.0.0";
tcpipPortTextBox.Text = config.OptoTcpipPortNr.ToString();
headPortNrTextBox.Text = config.HeadCommunicationComPortNr.ToString();
optoSerialPortTextBox.Text = config.OptoComPortNr.ToString();
rfidPortNrTextBox.Text = config.RfidComPortNr.ToString();
muxBoardNrTextBox.Text = config.MuxBoardNr.ToString();
groupTextBox.Text = config.Group.ToString();
}
comboBoxCommunicationInterface.SelectedItem = config.CommunicationInterface.ToString();
tabPage2.Controls.Add(new IperlHeadTestCtrl(config));
}
public void Unlock()
{
@ -66,8 +67,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
tcpipPortTextBox.Enabled = true;
optoSerialPortTextBox.Enabled = true;
rfidPortNrTextBox.Enabled = true;
headPortNrTextBox.Enabled = true;
muxBoardNrTextBox.Enabled = true;
groupTextBox.Enabled = true;
comboBoxCommunicationInterface.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
@ -106,6 +109,12 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
message += Environment.NewLine + "'RFID serial port nr.' is not valid";
}
if (!int.TryParse(headPortNrTextBox.Text, out dummy) || dummy < 0 || dummy > 999)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Head communication serial port nr.' is not valid";
}
if (!int.TryParse(muxBoardNrTextBox.Text, out dummy) || dummy < 1 || dummy > 4)
{
flags |= CfgUpdateFlags.Error;
@ -144,8 +153,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
config.RfidComPortNr = int.Parse(rfidPortNrTextBox.Text);
config.MuxBoardNr = int.Parse(muxBoardNrTextBox.Text);
config.Group = int.Parse(groupTextBox.Text);
config.CommunicationInterface = (CommunicationInterface)comboBoxCommunicationInterface.SelectedIndex;
config.HeadCommunicationComPortNr = int.Parse(headPortNrTextBox.Text);
return flags;
}
}
}
}

View File

@ -31,149 +31,150 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
/// </summary>
private void InitializeComponent()
{
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.optoSerialPortTextBox = new System.Windows.Forms.TextBox();
this.optoSerialPortLabel = new System.Windows.Forms.Label();
this.muxBoardNrTextBox = new System.Windows.Forms.TextBox();
this.muxBoardNrLabel = new System.Windows.Forms.Label();
this.groupTextBox = new System.Windows.Forms.TextBox();
this.groupLabel = new System.Windows.Forms.Label();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.comboBoxCommunicationInterface = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.rfidPortNrTextBox = new System.Windows.Forms.TextBox();
this.rfidSerialPortNrLabel = new System.Windows.Forms.Label();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.optoDataGroupBox = new System.Windows.Forms.GroupBox();
this.tcpipPortLabel = new System.Windows.Forms.Label();
this.tcpipPortTextBox = new System.Windows.Forms.TextBox();
this.ipAddressLabel = new System.Windows.Forms.Label();
this.ipAddressTextBox = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.optoDataGroupBox.SuspendLayout();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.optoSerialPortLabel = new System.Windows.Forms.Label();
this.optoSerialPortTextBox = new System.Windows.Forms.TextBox();
this.groupTextBox = new System.Windows.Forms.TextBox();
this.groupLabel = new System.Windows.Forms.Label();
this.muxBoardNrTextBox = new System.Windows.Forms.TextBox();
this.muxBoardNrLabel = new System.Windows.Forms.Label();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.headPortNrTextBox = new System.Windows.Forms.TextBox();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.optoDataGroupBox.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// nameTextBox
// tabControl1
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(135, 40);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(121, 20);
this.nameTextBox.TabIndex = 2;
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Location = new System.Drawing.Point(3, 3);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(611, 432);
this.tabControl1.TabIndex = 0;
//
// nameLabel
// tabPage1
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(25, 43);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
this.tabPage1.Controls.Add(this.groupBox2);
this.tabPage1.Controls.Add(this.label4);
this.tabPage1.Controls.Add(this.label3);
this.tabPage1.Controls.Add(this.groupBox1);
this.tabPage1.Controls.Add(this.optoDataGroupBox);
this.tabPage1.Controls.Add(this.groupTextBox);
this.tabPage1.Controls.Add(this.groupLabel);
this.tabPage1.Controls.Add(this.muxBoardNrTextBox);
this.tabPage1.Controls.Add(this.muxBoardNrLabel);
this.tabPage1.Controls.Add(this.nameTextBox);
this.tabPage1.Controls.Add(this.nameLabel);
this.tabPage1.Controls.Add(this.classNameLabel);
this.tabPage1.Location = new System.Drawing.Point(4, 25);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(603, 403);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Config";
this.tabPage1.UseVisualStyleBackColor = true;
//
// classNameLabel
// label4
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(132, 16);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(60, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ClassName";
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(208, 101);
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(40, 16);
this.label4.TabIndex = 25;
this.label4.Text = "1 .. 10";
//
// optoSerialPortTextBox
// label3
//
this.optoSerialPortTextBox.Enabled = false;
this.optoSerialPortTextBox.Location = new System.Drawing.Point(329, 42);
this.optoSerialPortTextBox.Name = "optoSerialPortTextBox";
this.optoSerialPortTextBox.Size = new System.Drawing.Size(34, 20);
this.optoSerialPortTextBox.TabIndex = 7;
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(208, 72);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(33, 16);
this.label3.TabIndex = 24;
this.label3.Text = "1 .. 4";
//
// optoSerialPortLabel
// groupBox1
//
this.optoSerialPortLabel.AutoSize = true;
this.optoSerialPortLabel.Location = new System.Drawing.Point(241, 45);
this.optoSerialPortLabel.Name = "optoSerialPortLabel";
this.optoSerialPortLabel.Size = new System.Drawing.Size(72, 13);
this.optoSerialPortLabel.TabIndex = 6;
this.optoSerialPortLabel.Text = "Serial port nr.:";
this.groupBox1.Controls.Add(this.comboBoxCommunicationInterface);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.rfidPortNrTextBox);
this.groupBox1.Controls.Add(this.rfidSerialPortNrLabel);
this.groupBox1.Location = new System.Drawing.Point(10, 259);
this.groupBox1.Margin = new System.Windows.Forms.Padding(4);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(4);
this.groupBox1.Size = new System.Drawing.Size(552, 68);
this.groupBox1.TabIndex = 23;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "RFID / NFC communication (in case mux. board is not used)";
//
// muxBoardNrTextBox
// comboBoxCommunicationInterface
//
this.muxBoardNrTextBox.Enabled = false;
this.muxBoardNrTextBox.Location = new System.Drawing.Point(135, 63);
this.muxBoardNrTextBox.Name = "muxBoardNrTextBox";
this.muxBoardNrTextBox.Size = new System.Drawing.Size(34, 20);
this.muxBoardNrTextBox.TabIndex = 9;
this.comboBoxCommunicationInterface.Enabled = false;
this.comboBoxCommunicationInterface.FormattingEnabled = true;
this.comboBoxCommunicationInterface.Items.AddRange(new object[] {
"RFID",
"NFC"});
this.comboBoxCommunicationInterface.Location = new System.Drawing.Point(201, 27);
this.comboBoxCommunicationInterface.Name = "comboBoxCommunicationInterface";
this.comboBoxCommunicationInterface.Size = new System.Drawing.Size(71, 24);
this.comboBoxCommunicationInterface.TabIndex = 9;
//
// muxBoardNrLabel
// label1
//
this.muxBoardNrLabel.AutoSize = true;
this.muxBoardNrLabel.Location = new System.Drawing.Point(25, 66);
this.muxBoardNrLabel.Name = "muxBoardNrLabel";
this.muxBoardNrLabel.Size = new System.Drawing.Size(106, 13);
this.muxBoardNrLabel.TabIndex = 8;
this.muxBoardNrLabel.Text = "Group 1 (mux. board)";
//
// groupTextBox
//
this.groupTextBox.Enabled = false;
this.groupTextBox.Location = new System.Drawing.Point(135, 86);
this.groupTextBox.Name = "groupTextBox";
this.groupTextBox.Size = new System.Drawing.Size(34, 20);
this.groupTextBox.TabIndex = 11;
//
// groupLabel
//
this.groupLabel.AutoSize = true;
this.groupLabel.Location = new System.Drawing.Point(25, 89);
this.groupLabel.Name = "groupLabel";
this.groupLabel.Size = new System.Drawing.Size(45, 13);
this.groupLabel.TabIndex = 10;
this.groupLabel.Text = "Group 2";
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(41, 30);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(153, 16);
this.label1.TabIndex = 8;
this.label1.Text = "Communication Interface";
//
// rfidPortNrTextBox
//
this.rfidPortNrTextBox.Enabled = false;
this.rfidPortNrTextBox.Location = new System.Drawing.Point(329, 21);
this.rfidPortNrTextBox.Location = new System.Drawing.Point(439, 26);
this.rfidPortNrTextBox.Margin = new System.Windows.Forms.Padding(4);
this.rfidPortNrTextBox.Name = "rfidPortNrTextBox";
this.rfidPortNrTextBox.Size = new System.Drawing.Size(34, 20);
this.rfidPortNrTextBox.Size = new System.Drawing.Size(44, 22);
this.rfidPortNrTextBox.TabIndex = 7;
//
// rfidSerialPortNrLabel
//
this.rfidSerialPortNrLabel.AutoSize = true;
this.rfidSerialPortNrLabel.Location = new System.Drawing.Point(241, 24);
this.rfidSerialPortNrLabel.Location = new System.Drawing.Point(321, 30);
this.rfidSerialPortNrLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.rfidSerialPortNrLabel.Name = "rfidSerialPortNrLabel";
this.rfidSerialPortNrLabel.Size = new System.Drawing.Size(72, 13);
this.rfidSerialPortNrLabel.Size = new System.Drawing.Size(88, 16);
this.rfidSerialPortNrLabel.TabIndex = 6;
this.rfidSerialPortNrLabel.Text = "Serial port nr.:";
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Enabled = false;
this.radioButton1.Location = new System.Drawing.Point(22, 19);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(83, 17);
this.radioButton1.TabIndex = 0;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "Use TCP/IP";
this.radioButton1.UseVisualStyleBackColor = true;
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Enabled = false;
this.radioButton2.Location = new System.Drawing.Point(234, 19);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(92, 17);
this.radioButton2.TabIndex = 1;
this.radioButton2.TabStop = true;
this.radioButton2.Text = "Use serial port";
this.radioButton2.UseVisualStyleBackColor = true;
//
// optoDataGroupBox
//
this.optoDataGroupBox.Controls.Add(this.tcpipPortLabel);
@ -184,125 +185,257 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
this.optoDataGroupBox.Controls.Add(this.radioButton2);
this.optoDataGroupBox.Controls.Add(this.optoSerialPortLabel);
this.optoDataGroupBox.Controls.Add(this.optoSerialPortTextBox);
this.optoDataGroupBox.Location = new System.Drawing.Point(28, 114);
this.optoDataGroupBox.Location = new System.Drawing.Point(10, 131);
this.optoDataGroupBox.Margin = new System.Windows.Forms.Padding(4);
this.optoDataGroupBox.Name = "optoDataGroupBox";
this.optoDataGroupBox.Size = new System.Drawing.Size(414, 97);
this.optoDataGroupBox.TabIndex = 5;
this.optoDataGroupBox.Padding = new System.Windows.Forms.Padding(4);
this.optoDataGroupBox.Size = new System.Drawing.Size(552, 119);
this.optoDataGroupBox.TabIndex = 18;
this.optoDataGroupBox.TabStop = false;
this.optoDataGroupBox.Text = "Opto-data";
//
// tcpipPortLabel
//
this.tcpipPortLabel.AutoSize = true;
this.tcpipPortLabel.Location = new System.Drawing.Point(31, 71);
this.tcpipPortLabel.Location = new System.Drawing.Point(41, 87);
this.tcpipPortLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.tcpipPortLabel.Name = "tcpipPortLabel";
this.tcpipPortLabel.Size = new System.Drawing.Size(47, 13);
this.tcpipPortLabel.Size = new System.Drawing.Size(54, 16);
this.tcpipPortLabel.TabIndex = 4;
this.tcpipPortLabel.Text = "Port nr..:";
//
// tcpipPortTextBox
//
this.tcpipPortTextBox.Enabled = false;
this.tcpipPortTextBox.Location = new System.Drawing.Point(107, 68);
this.tcpipPortTextBox.Location = new System.Drawing.Point(143, 84);
this.tcpipPortTextBox.Margin = new System.Windows.Forms.Padding(4);
this.tcpipPortTextBox.Name = "tcpipPortTextBox";
this.tcpipPortTextBox.Size = new System.Drawing.Size(39, 20);
this.tcpipPortTextBox.Size = new System.Drawing.Size(51, 22);
this.tcpipPortTextBox.TabIndex = 5;
//
// ipAddressLabel
//
this.ipAddressLabel.AutoSize = true;
this.ipAddressLabel.Location = new System.Drawing.Point(31, 48);
this.ipAddressLabel.Location = new System.Drawing.Point(41, 59);
this.ipAddressLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.ipAddressLabel.Name = "ipAddressLabel";
this.ipAddressLabel.Size = new System.Drawing.Size(63, 13);
this.ipAddressLabel.Size = new System.Drawing.Size(78, 16);
this.ipAddressLabel.TabIndex = 2;
this.ipAddressLabel.Text = "IP address.:";
//
// ipAddressTextBox
//
this.ipAddressTextBox.Enabled = false;
this.ipAddressTextBox.Location = new System.Drawing.Point(107, 45);
this.ipAddressTextBox.Location = new System.Drawing.Point(143, 55);
this.ipAddressTextBox.Margin = new System.Windows.Forms.Padding(4);
this.ipAddressTextBox.Name = "ipAddressTextBox";
this.ipAddressTextBox.Size = new System.Drawing.Size(98, 20);
this.ipAddressTextBox.Size = new System.Drawing.Size(129, 22);
this.ipAddressTextBox.TabIndex = 3;
//
// groupBox1
// radioButton1
//
this.groupBox1.Controls.Add(this.rfidPortNrTextBox);
this.groupBox1.Controls.Add(this.rfidSerialPortNrLabel);
this.groupBox1.Location = new System.Drawing.Point(28, 218);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(414, 55);
this.groupBox1.TabIndex = 12;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "RFID communication (in case mux. board is not used)";
this.radioButton1.AutoSize = true;
this.radioButton1.Checked = true;
this.radioButton1.Enabled = false;
this.radioButton1.Location = new System.Drawing.Point(29, 23);
this.radioButton1.Margin = new System.Windows.Forms.Padding(4);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(99, 20);
this.radioButton1.TabIndex = 0;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "Use TCP/IP";
this.radioButton1.UseVisualStyleBackColor = true;
//
// label3
// radioButton2
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(176, 66);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(31, 13);
this.label3.TabIndex = 13;
this.label3.Text = "1 .. 4";
this.radioButton2.AutoSize = true;
this.radioButton2.Enabled = false;
this.radioButton2.Location = new System.Drawing.Point(312, 23);
this.radioButton2.Margin = new System.Windows.Forms.Padding(4);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(115, 20);
this.radioButton2.TabIndex = 1;
this.radioButton2.Text = "Use serial port";
this.radioButton2.UseVisualStyleBackColor = true;
//
// label4
// optoSerialPortLabel
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(176, 89);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(37, 13);
this.label4.TabIndex = 14;
this.label4.Text = "1 .. 10";
this.optoSerialPortLabel.AutoSize = true;
this.optoSerialPortLabel.Location = new System.Drawing.Point(321, 55);
this.optoSerialPortLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.optoSerialPortLabel.Name = "optoSerialPortLabel";
this.optoSerialPortLabel.Size = new System.Drawing.Size(88, 16);
this.optoSerialPortLabel.TabIndex = 6;
this.optoSerialPortLabel.Text = "Serial port nr.:";
//
// WaterMeterCfgCtrl
// optoSerialPortTextBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.optoSerialPortTextBox.Enabled = false;
this.optoSerialPortTextBox.Location = new System.Drawing.Point(439, 52);
this.optoSerialPortTextBox.Margin = new System.Windows.Forms.Padding(4);
this.optoSerialPortTextBox.Name = "optoSerialPortTextBox";
this.optoSerialPortTextBox.Size = new System.Drawing.Size(44, 22);
this.optoSerialPortTextBox.TabIndex = 7;
//
// groupTextBox
//
this.groupTextBox.Enabled = false;
this.groupTextBox.Location = new System.Drawing.Point(153, 97);
this.groupTextBox.Margin = new System.Windows.Forms.Padding(4);
this.groupTextBox.Name = "groupTextBox";
this.groupTextBox.Size = new System.Drawing.Size(44, 22);
this.groupTextBox.TabIndex = 22;
//
// groupLabel
//
this.groupLabel.AutoSize = true;
this.groupLabel.Location = new System.Drawing.Point(6, 101);
this.groupLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.groupLabel.Name = "groupLabel";
this.groupLabel.Size = new System.Drawing.Size(54, 16);
this.groupLabel.TabIndex = 21;
this.groupLabel.Text = "Group 2";
//
// muxBoardNrTextBox
//
this.muxBoardNrTextBox.Enabled = false;
this.muxBoardNrTextBox.Location = new System.Drawing.Point(153, 69);
this.muxBoardNrTextBox.Margin = new System.Windows.Forms.Padding(4);
this.muxBoardNrTextBox.Name = "muxBoardNrTextBox";
this.muxBoardNrTextBox.Size = new System.Drawing.Size(44, 22);
this.muxBoardNrTextBox.TabIndex = 20;
//
// muxBoardNrLabel
//
this.muxBoardNrLabel.AutoSize = true;
this.muxBoardNrLabel.Location = new System.Drawing.Point(6, 72);
this.muxBoardNrLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.muxBoardNrLabel.Name = "muxBoardNrLabel";
this.muxBoardNrLabel.Size = new System.Drawing.Size(131, 16);
this.muxBoardNrLabel.TabIndex = 19;
this.muxBoardNrLabel.Text = "Group 1 (mux. board)";
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(153, 40);
this.nameTextBox.Margin = new System.Windows.Forms.Padding(4);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(160, 22);
this.nameTextBox.TabIndex = 17;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(6, 44);
this.nameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(44, 16);
this.nameLabel.TabIndex = 16;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(149, 11);
this.classNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(78, 16);
this.classNameLabel.TabIndex = 15;
this.classNameLabel.Text = "ClassName";
//
// tabPage2
//
this.tabPage2.Location = new System.Drawing.Point(4, 25);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(603, 403);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Test";
this.tabPage2.UseVisualStyleBackColor = true;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.headPortNrTextBox);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Location = new System.Drawing.Point(10, 335);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(552, 50);
this.groupBox2.TabIndex = 26;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Head Communication";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(321, 18);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(88, 16);
this.label2.TabIndex = 7;
this.label2.Text = "Serial port nr.:";
//
// headPortNrTextBox
//
this.headPortNrTextBox.Enabled = false;
this.headPortNrTextBox.Location = new System.Drawing.Point(439, 15);
this.headPortNrTextBox.Margin = new System.Windows.Forms.Padding(4);
this.headPortNrTextBox.Name = "headPortNrTextBox";
this.headPortNrTextBox.Size = new System.Drawing.Size(44, 22);
this.headPortNrTextBox.TabIndex = 8;
//
// IperlHeadCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.optoDataGroupBox);
this.Controls.Add(this.groupTextBox);
this.Controls.Add(this.groupLabel);
this.Controls.Add(this.muxBoardNrTextBox);
this.Controls.Add(this.muxBoardNrLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "WaterMeterCfgCtrl";
this.Size = new System.Drawing.Size(500, 300);
this.Controls.Add(this.tabControl1);
this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "IperlHeadCfgCtrl";
this.Size = new System.Drawing.Size(617, 438);
this.Load += new System.EventHandler(this.WaterMeterCfgCtrl_Load);
this.optoDataGroupBox.ResumeLayout(false);
this.optoDataGroupBox.PerformLayout();
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.optoDataGroupBox.ResumeLayout(false);
this.optoDataGroupBox.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
#endregion
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.TextBox optoSerialPortTextBox;
private System.Windows.Forms.Label optoSerialPortLabel;
private System.Windows.Forms.TextBox muxBoardNrTextBox;
private System.Windows.Forms.Label muxBoardNrLabel;
private System.Windows.Forms.TextBox groupTextBox;
private System.Windows.Forms.Label groupLabel;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.ComboBox comboBoxCommunicationInterface;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox rfidPortNrTextBox;
private System.Windows.Forms.Label rfidSerialPortNrLabel;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.GroupBox optoDataGroupBox;
private System.Windows.Forms.Label tcpipPortLabel;
private System.Windows.Forms.TextBox tcpipPortTextBox;
private System.Windows.Forms.Label ipAddressLabel;
private System.Windows.Forms.TextBox ipAddressTextBox;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
}
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.Label optoSerialPortLabel;
private System.Windows.Forms.TextBox optoSerialPortTextBox;
private System.Windows.Forms.TextBox groupTextBox;
private System.Windows.Forms.Label groupLabel;
private System.Windows.Forms.TextBox muxBoardNrTextBox;
private System.Windows.Forms.Label muxBoardNrLabel;
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox headPortNrTextBox;
private System.Windows.Forms.Label label2;
}
}

Some files were not shown because too many files have changed in this diff Show More