Metrology:

- KBuoyancy calculation
- Readability column
Excel export:
- shape CC, for WT,T,Pr
This commit is contained in:
Michal Buzik 2025-05-13 10:53:31 +02:00
parent df5924663a
commit 5fa9fcaeff
27 changed files with 1486 additions and 450 deletions

View File

@ -13,6 +13,7 @@ namespace Config.Entities
public virtual double Measurement { get; set; }
public virtual double Correction { get; set; }
public virtual double Uncertainty { get; set; }
public virtual double Readability { get; set; }
public MeasurementCorrection()
{
@ -85,7 +86,7 @@ namespace Config.Entities
public override string ToString()
{
return string.Format("{0} {1} ({2}) {3}", Measurement, Correction, RangeIx, Uncertainty);
return string.Format("{0} {1} ({2}) {3} {4}", Measurement, Correction, RangeIx, Uncertainty, Readability);
}
}
}

View File

@ -15,6 +15,7 @@ namespace Config.Mappings
Map(x => x.Measurement);
Map(x => x.Correction);
Map(x => x.Uncertainty);
Map(x => x.Readability);
}
}
}

View File

@ -239,11 +239,13 @@
<Compile Include="Uncertainty\Calculation\CalculationTable.cs" />
<Compile Include="Uncertainty\Calculation\Math.cs" />
<Compile Include="Uncertainty\CommonExcell.cs" />
<Compile Include="Uncertainty\CommonTable\Table.cs" />
<Compile Include="Uncertainty\DEItem.cs" />
<Compile Include="Uncertainty\DEUtils.cs" />
<Compile Include="Uncertainty\DocumentSheets.cs" />
<Compile Include="Uncertainty\ProcessDataLine.cs" />
<Compile Include="Uncertainty\ProcessDataMeterLine.cs" />
<Compile Include="Uncertainty\CommonTable\Cell.cs" />
<Compile Include="Utils.cs" />
<Compile Include="WMeterRsltItemSpec.cs" />
</ItemGroup>

View File

@ -1,6 +1,10 @@
using System;
using System.Collections.Generic;
using ClosedXML.Excel;
using Common;
using Config.Entities;
using log4net;
using NHibernate;
using Results.Resources;
namespace Results.Uncertainty
@ -17,6 +21,9 @@ namespace Results.Uncertainty
private static Dictionary<int, int> bloks = null;
static readonly ILog log = LogManager.GetLogger(typeof(CommonExcell));
private static IList<Component> cmpntEntities;
public static Dictionary<int, int> GetBolocs() {
if (bloks == null)
@ -35,8 +42,13 @@ namespace Results.Uncertainty
return bloks;
}
/// <summary>
/// Inserts a line of process data into a specified row of the Excel document.
/// </summary>
/// <param name="_rigUncertainty">An instance of the <see cref="RigUncertainty"/> class representing the rig uncertainty and its associated data.</param>
/// <param name="iRowI">The row index in the Excel worksheet where the process data will be inserted.</param>
/// <param name="processDataLine">An instance of the <see cref="ProcessDataLine"/> class containing the process data to be added to the row.</param>
public static void InsertValueLineProcessData(RigUncertainty _rigUncertainty, int iRowI, ProcessDataLine processDataLine)
{
if (!_rigUncertainty.IsOpenedDocument)
@ -157,6 +169,15 @@ namespace Results.Uncertainty
}
}
/// <summary>
/// Populates a range of cells in an Excel worksheet with meter process data starting from a specified column and row.
/// </summary>
/// <param name="worksheet">The Excel worksheet where data will be inserted.</param>
/// <param name="column">The starting column in the worksheet for inserting the meter process data.</param>
/// <param name="iRowI">The row index in the worksheet where the data will be inserted.</param>
/// <param name="data">An instance of the <see cref="ProcessDataMeterLine"/> class containing the meter process data to insert.</param>
/// <param name="distance">An optional parameter specifying the distance for additional columns to leave empty after data insertion. Defaults to 0.</param>
/// <returns>The next available column string after the last column used during data insertion.</returns>
private static string MeterCellData(IXLWorksheet worksheet, string column, int iRowI, ProcessDataMeterLine data, int distance = 0)
{
int iIndex = 0;
@ -197,39 +218,10 @@ namespace Results.Uncertainty
return nextColumn;
}
/*private static string MeterCellDataOld(IXLWorksheet worksheet, string column, int iRowI, ProcessDataMeterLine data, int distance = 0)
{
CellData(worksheet, column, iRowI, data.SerNo , formatStr);//Position - Ser.No. - CE
string nextColumn = NextColumn(column); CellData(worksheet,nextColumn, iRowI, data.VolMtSt , formatInt);//Vol.Mt.st - CF
nextColumn = NextColumn(nextColumn); CellData(worksheet,nextColumn, iRowI, data.VolMtEn , formatInt);//Vol.Mt.en - CG
nextColumn = NextColumn(nextColumn); CellData(worksheet,nextColumn, iRowI, data.VolMt , formatD7);//Vol.Mt. - CH
nextColumn = NextColumn(nextColumn); CellData(worksheet,nextColumn, iRowI, data.VolRm, formatD7);//Vol.rm - CI
nextColumn = NextColumn(nextColumn); CellData(worksheet,nextColumn, iRowI, data.ERel , formatD6); // E rel. - CJ
nextColumn = NextColumn(nextColumn); CellData(worksheet,nextColumn, iRowI, data.IPerlCalibrationFactor , formatInt); // U - CK
nextColumn = NextColumn(nextColumn); CellData(worksheet,nextColumn, iRowI, data.Pulses , formatInt); //Pulses() -
nextColumn = NextColumn(nextColumn); CellData(worksheet,nextColumn, iRowI, data.RefPulsesNi , formatInt); //Ref pulses_ni()
nextColumn = NextColumn(nextColumn); CellData(worksheet,nextColumn, iRowI, data.T , formatD4); //T(s)()_ni
nextColumn = NextColumn(nextColumn); CellData(worksheet,nextColumn, iRowI, data.Evaluation , formatStr);//evaluation
nextColumn = NextColumn(nextColumn); CellData(worksheet,nextColumn, iRowI, data.PulsesL , formatD4);//Pulses/l - CP
nextColumn = NextColumn(nextColumn); CellData(worksheet,nextColumn, iRowI, data.ImpL , formatInt);//imp/l
nextColumn = NextColumn(nextColumn); CellData(worksheet,nextColumn, iRowI, data.Div , formatInt);//div
nextColumn = NextColumn(nextColumn); CellData(worksheet,nextColumn, iRowI, data.VEnd , formatInt);//Vend
nextColumn = NextColumn(nextColumn); CellData(worksheet,nextColumn, iRowI, data.TEnd , formatInt);//T end
if (distance > 0)
{
string lastColumn = CommonExcell.GetExcelColumnByDistance(column, distance);
int columnDistance = CommonExcell.GetColumnDistance(nextColumn, lastColumn);
for (int i = 1; i < columnDistance; i++)
{
nextColumn = NextColumn(nextColumn); CellData(worksheet,nextColumn, iRowI, 0 , formatInt);
}
}
return nextColumn;
}*/
public static void CellData(IXLWorksheet worksheet, string column, int iRowI, XLCellValue value, string format = null)
{
worksheet.Cell($"{column}{iRowI}").Value = value;

View File

@ -0,0 +1,43 @@
using ClosedXML.Excel;
namespace Results.Uncertainty.CommonTable
{
public class Cell
{
public int IRow { get; }
public int IColumn { get; }
public XLCellValue Value { get; set; }
// The names (if any) of the row/column
public string ColumnName { get; }
public string RowName { get; }
/// <summary>
/// Excelstyle address, e.g. “B3”.
/// </summary>
public string Address => $"{ToLetter(IColumn + 1)}{IRow + 1}";
public Cell(int col, int row, XLCellValue value,
string colName = null, string rowName = null)
{
IColumn = col;
IRow = row;
Value = value;
ColumnName = colName;
RowName = rowName;
}
// Convert 1-based column number into letters
private static string ToLetter(int col)
{
var s = "";
while (col > 0)
{
int m = (col - 1) % 26;
s = (char)('A' + m) + s;
col = (col - m - 1) / 26;
}
return s;
}
}
}

View File

@ -0,0 +1,232 @@
using System.Collections.Generic;
using ClosedXML.Excel;
using System;
using System.Collections.Generic;
using ClosedXML.Excel;
namespace Results.Uncertainty.CommonTable
{
public class Table
{
private int iOffsetRows = 0;
private int iOffsetColumns = 0;
public int IOffsetRows
{
get => iOffsetRows;
set => iOffsetRows = value;
}
public int IOffsetColumns
{
get => iOffsetColumns;
set => iOffsetColumns = value;
}
// The grid of cells
public IList<IList<Cell>> Cells { get; private set; }
= new List<IList<Cell>>();
// Optional names for columns and rows
public IList<string> ColumnNames { get; private set; }
= new List<string>();
public IList<string> RowNames { get; private set; }
= new List<string>();
public Table() { }
public void AddColumnExcel(string nameStart, string nameEnd)
{
int distance = CommonExcell.GetColumnDistance(nameStart, nameEnd);
int iStart = CommonExcell.ColumnToNumber(nameStart);
AddColumn(nameStart);
for (int i = 0; i < distance; i++)
{
AddColumn(CommonExcell.GetExcelColumnByDistance(nameStart, i+1));
}
}
public void GenerateTable_RowsColumns_Excel(string nameStart, string nameEnd, int iRowsCount)
{
AddColumnExcel(nameStart, nameEnd);
for (int i = 0; i < iRowsCount; i++)
{
AddRow(i.ToString());
}
}
/// <summary>
/// Adds a new column (with optional name) and returns its index.
/// </summary>
public int AddColumn(string name = null)
{
int colIndex = ColumnNames.Count;
ColumnNames.Add(name);
// Grow every existing row by one
for (int r = 0; r < Cells.Count; r++)
{
Cells[r].Add(new Cell(colIndex, r, new XLCellValue(), name, RowNames[r]));
}
return colIndex;
}
/// <summary>
/// Adds a new row (with optional name) and returns its index.
/// </summary>
public int AddRow(string name = null)
{
int rowIndex = Cells.Count;
RowNames.Add(name);
var newRow = new List<Cell>(ColumnNames.Count);
// Initialize with empty cells
for (int c = 0; c < ColumnNames.Count; c++)
{
newRow.Add(new Cell(c, rowIndex, new XLCellValue(), ColumnNames[c], name));
}
Cells.Add(newRow);
return rowIndex;
}
/// <summary>
/// Ensures the given [row,col] exists, creating rows/columns as needed.
/// </summary>
private void EnsurePosition(int rowIndex, int colIndex)
{
while (Cells.Count <= rowIndex)
AddRow();
var row = Cells[rowIndex];
while (row.Count <= colIndex)
AddColumn();
}
/// <summary>
/// Sets the value of the cell at [rowIndex, colIndex].
/// </summary>
public void AddCell(int rowIndex, int colIndex, XLCellValue value)
{
EnsurePosition(rowIndex, colIndex);
Cells[rowIndex][colIndex].Value = value;
}
/// <summary>
/// Sets the value of the cell at [rowIndex, columnName].
/// If the columnName doesnt exist yet, its created.
/// </summary>
public void AddCell(int rowIndex, string columnName, XLCellValue value)
{
int colIndex = ColumnNames.IndexOf(columnName);
if (colIndex < 0)
colIndex = AddColumn(columnName);
AddCell(rowIndex, colIndex, value);
}
/// <summary>
/// Retrieves a cell by numeric coordinates.
/// </summary>
public Cell GetCell(int rowIndex, int colIndex)
=> Cells[rowIndex][colIndex];
/// <summary>
/// Retrieves a cell by rowIndex and columnName.
/// </summary>
public Cell GetCell(int rowIndex, string columnName)
{
int colIndex = ColumnNames.IndexOf(columnName);
if (colIndex < 0)
throw new ArgumentException($"Column '{columnName}' not found.");
return GetCell(rowIndex, colIndex);
}
/// <summary>
/// Writes the entire table into the given worksheet,
/// optionally including the header row of column names.
/// </summary>
public void ToWorksheet(IXLWorksheet ws, bool includeHeaders = true)
{
int startRow = 1;
if (includeHeaders)
{
for (int c = 0; c < ColumnNames.Count; c++)
ws.Cell(1, c + 1).Value = ColumnNames[c] ?? string.Empty;
startRow = 2;
}
for (int r = 0; r < Cells.Count; r++)
{
for (int c = 0; c < Cells[r].Count; c++)
{
ws.Cell(r + startRow, c + 1).Value = Cells[r][c].Value;
}
}
}
/// <summary>
/// Writes the entire table into the given worksheet,
/// optionally including the header row of column names.
/// </summary>
public void ToWorksheetWithOffset(IXLWorksheet ws, int rowsOffset = 1, int columnsOffset = 0, bool includeHeaders = true)
{
int startRow = rowsOffset;
if (includeHeaders)
{
for (int c = 0; c < ColumnNames.Count; c++)
ws.Cell(1, c + 1).Value = ColumnNames[c] ?? string.Empty;
startRow = 2;
}
for (int r = 0; r < Cells.Count; r++)
{
for (int c = 0; c < Cells[r].Count; c++)
{
if(!(Cells[r][c].Value.IsBlank || Cells[r][c].Value.Type == XLDataType.Blank))
{
ws.Cell(r + startRow, c + 1 + columnsOffset).Value = Cells[r][c].Value;
}
}
}
}
/// <summary>
/// Returns all cells in the given row (by zerobased index).
/// </summary>
public IList<Cell> GetRow(int rowIndex)
{
if (rowIndex < 0 || rowIndex >= Cells.Count)
throw new IndexOutOfRangeException($"Row {rowIndex} does not exist.");
return Cells[rowIndex];
}
/// <summary>
/// Returns all cells in the given column (by zerobased index).
/// </summary>
public IList<Cell> GetColumn(int colIndex)
{
if (colIndex < 0 || colIndex >= ColumnNames.Count)
throw new IndexOutOfRangeException($"Column {colIndex} does not exist.");
var list = new List<Cell>();
for (int r = 0; r < Cells.Count; r++)
{
// skip if that row hasnt grown that far yet
if (Cells[r].Count > colIndex)
list.Add(Cells[r][colIndex]);
}
return list;
}
}
}

View File

@ -1,9 +1,15 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAssert_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fd08b5425b14a4a129bfa8e447a81395e12190_003Fae_003F94d308d8_003FAssert_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AControl_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fbb93580b829e4f7d9c8d742286f27f7d5b8648_003F2d_003F54df0719_003FControl_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AICollection_00601_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4290c01eea7748b3aa477ca831e6a387531830_003F80_003Fe38b444d_003FICollection_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ALoader_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F8210282bc4024c02ab1c8fa84c45a21e32a600_003F0d_003F48a17bd3_003FLoader_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATabControl_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fbb93580b829e4f7d9c8d742286f27f7d5b8648_003F0e_003F5c4249c2_003FTabControl_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATestMethodInfo_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4472e9d6a19b4c92bcc9a80bd60ca17d26da8_003Fad_003F4c8a6929_003FTestMethodInfo_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATestMethodInfo_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4472e9d6a19b4c92bcc9a80bd60ca17d26da8_003F98_003F3ffb6d31_003FTestMethodInfo_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F9c2967a135e648bdb993c5397a44991b573620_003Fd7_003F14d417af_003FThrowHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AUserControl_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fbb93580b829e4f7d9c8d742286f27f7d5b8648_003Fa3_003F8eb63727_003FUserControl_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AXLRangeBase_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003Fb48983f97d522ed19b681bf6f133c9baafae03ce9d864ed711a5aa8752bf_003FXLRangeBase_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AXLWorksheet_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F95dc236c6854d515fec2d9794746c52171e52b19e7f2ca0fcc6a6636bb4ed18_003FXLWorksheet_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AXmlSerializer_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F9e4992465ee24dc8915fd9be20badb7d281d48_003F5e_003F4df5856e_003FXmlSerializer_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue">&lt;AssemblyExplorer&gt;&#xD;
&lt;Assembly Path="C:\Users\micha\git\tbf\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll" /&gt;&#xD;
@ -15,7 +21,7 @@
<s:String x:Key="/Default/Environment/UnitTesting/CreateUnitTestDialog/TestProjectMapping/=8648FD92_002DCDA1_002D4C3A_002DB5F9_002DFE547CE1FA48/@EntryIndexedValue">77EB589F-C670-4489-AAD6-2A3C02061FD1</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/CreateUnitTestDialog/TestProjectMapping/=9D0DCC88_002DDC81_002D47EB_002D9FDD_002D4C3907871BFB/@EntryIndexedValue">77EB589F-C670-4489-AAD6-2A3C02061FD1</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/CreateUnitTestDialog/TestTemplateMapping/=MSTest/@EntryIndexedValue">d6790ab7-33c2-4425-b2c9-51480cd1a852</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=311ca613_002Da634_002D4e0f_002Db9fb_002D4b7af9b7abb2/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="GetCorrection" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=311ca613_002Da634_002D4e0f_002Db9fb_002D4b7af9b7abb2/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="GetCorrection" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;TestAncestor&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Entities.MeasurementCorrectionTest.GetCorrection&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Rig.Modbus.Meret.AdjustableScale.AdjustableMeterTest.GetCorrection&lt;/TestId&gt;&#xD;
@ -25,10 +31,11 @@
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Uncertainty.Calculation.MathTest.AritmeticMeanTest&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Uncertainty.Calculation.BatchProcessTableTest&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Uncertainty.Calculation.CalculationTableTest&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Uncertainty.CommonTable.TableTest.CrateTableTest&lt;/TestId&gt;&#xD;
&lt;/TestAncestor&gt;&#xD;
&lt;/SessionState&gt;</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=fee81c72_002D0b13_002D439c_002D8921_002D12878bb8cd86/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="Initialize" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=fee81c72_002D0b13_002D439c_002D8921_002D12878bb8cd86/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="Initialize" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;TestAncestor&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Rig.Network.Camera.KeyenceIV3G120.CameraTest.Initialize&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.RigUncertaintyTest.OpenDocument_SuccessfullyOpensDocument_RaisesNoExceptions&lt;/TestId&gt;&#xD;
@ -37,6 +44,8 @@
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.RigUncertaintyTest.ExcelColumnsTools&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.RigUncertaintyTest&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Uncertainty.Calculation.MathTest&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Uncertainty.CommonTable.TableTest.CrateTableTest&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Uncertainty.CommonTable.TableTest.CrateTableOnPositionTest&lt;/TestId&gt;&#xD;
&lt;/TestAncestor&gt;&#xD;
&lt;/SessionState&gt;</s:String>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=Config_002FResources_002FStrings/@EntryIndexedValue">False</s:Boolean>
@ -44,7 +53,7 @@
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=Miscellaneous_0020Files_002FWyqupug/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FResources_002FStrings/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FResources_002FStrings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FDataEntry_002FStandartCameraPurchaseOrder_002FCycleBeginningForm/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FDataEntry_002FStandartCameraPurchaseOrder_002FCycleEndForm/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FDataEntry_002FStandartCameraPurchaseOrder_002FTestStartEndForm/@EntryIndexedValue">False</s:Boolean>
@ -58,8 +67,8 @@
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FRegisterReaders_002FFrequencyMeterFromUniCB_002FRRCfgCtrl/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FUI_002FBench_002FComponents_002FComponentsManagerDlg/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FUI_002FBench_002FMetrology_002FCalibCertificateExtendedCtrl/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FUI_002FBench_002FMetrology_002FMetrologyDlgAdjustableScaleTab/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FUI_002FBench_002FMetrology_002FCalibCertificateExtendedCtrl/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FUI_002FBench_002FMetrology_002FMetrologyDlgAdjustableScaleTab/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FUI_002FBench_002FMetrology_002FMetrologyDlgPressMeterTab/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FUI_002FBench_002FMetrology_002FMetrologyDlgTempMeterTab/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FUI_002FResultsMI_002FPreviousResultsDlgUncertainty/@EntryIndexedValue">False</s:Boolean>

View File

@ -8,5 +8,7 @@ Document start on version `3.9.2144.1`
### v3.9.2144 Uncertainty
#### Database update
```
use wrc2swindon298;
alter table measurementcorrection add Uncertainty float null;
alter table measurementcorrection add Readability float null;
```

View File

@ -4622,6 +4622,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Readability.
/// </summary>
internal static string Readability {
get {
return ResourceManager.GetString("Readability", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Reading from the production tracing DB failed.
/// </summary>

View File

@ -2050,6 +2050,9 @@
<data name="Uncertainty" xml:space="preserve">
<value>Uncertainty</value>
</data>
<data name="Readability" xml:space="preserve">
<value>Readability</value>
</data>
<data name="No_info_available" xml:space="preserve">
<value>No info available</value>
</data>

View File

@ -104,6 +104,21 @@
<Reference Include="Castle.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="ClosedXML, Version=0.105.0.0, Culture=neutral, PublicKeyToken=fd1eb21b62ae805b, processorArchitecture=MSIL">
<HintPath>..\packages\ClosedXML.0.105.0-rc\lib\netstandard2.0\ClosedXML.dll</HintPath>
</Reference>
<Reference Include="ClosedXML.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1d5f7376574c51ec, processorArchitecture=MSIL">
<HintPath>..\packages\ClosedXML.Parser.2.0.0-preview1\lib\netstandard2.0\ClosedXML.Parser.dll</HintPath>
</Reference>
<Reference Include="DocumentFormat.OpenXml, Version=3.1.1.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
<HintPath>..\packages\DocumentFormat.OpenXml.3.1.1\lib\net46\DocumentFormat.OpenXml.dll</HintPath>
</Reference>
<Reference Include="DocumentFormat.OpenXml.Framework, Version=3.1.1.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
<HintPath>..\packages\DocumentFormat.OpenXml.Framework.3.1.1\lib\net46\DocumentFormat.OpenXml.Framework.dll</HintPath>
</Reference>
<Reference Include="ExcelNumberFormat, Version=1.1.0.0, Culture=neutral, PublicKeyToken=23c6f5d73be07eca, processorArchitecture=MSIL">
<HintPath>..\packages\ExcelNumberFormat.1.1.0\lib\net20\ExcelNumberFormat.dll</HintPath>
</Reference>
<Reference Include="FluentNHibernate">
<HintPath>..\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll</HintPath>
</Reference>
@ -113,6 +128,9 @@
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.HashCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.HashCode.1.1.1\lib\net461\Microsoft.Bcl.HashCode.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="MySql.Data">
<HintPath>..\packages\MySql.Data.6.6.5\lib\net40\MySql.Data.dll</HintPath>
@ -131,9 +149,15 @@
<HintPath>..\packages\Oracle.ManagedDataAccess.19.11.0\lib\net40\Oracle.ManagedDataAccess.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="RBush, Version=4.0.0.0, Culture=neutral, PublicKeyToken=c77e27b81f4d0187, processorArchitecture=MSIL">
<HintPath>..\packages\RBush.Signed.4.0.0\lib\net47\RBush.dll</HintPath>
</Reference>
<Reference Include="Renci.SshNet">
<HintPath>..\packages\Renci.SshNet\Renci.SshNet.dll</HintPath>
</Reference>
<Reference Include="SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13, processorArchitecture=MSIL">
<HintPath>..\packages\SixLabors.Fonts.1.0.0\lib\netstandard2.0\SixLabors.Fonts.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.6.1\lib\net462\System.Buffers.dll</HintPath>
@ -162,6 +186,7 @@
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Boxes\DateTimeBox.cs" />

View File

@ -29,6 +29,10 @@
private void InitializeComponent()
{
this.groupBox = new System.Windows.Forms.GroupBox();
this.textBox_SerialNo = new System.Windows.Forms.TextBox();
this.label_SerialNo = new System.Windows.Forms.Label();
this.textBox_Type = new System.Windows.Forms.TextBox();
this.label_Type = new System.Windows.Forms.Label();
this.certIdLabel = new System.Windows.Forms.Label();
this.openCertificateButton = new System.Windows.Forms.Button();
this.showCertificateButton = new System.Windows.Forms.Button();
@ -37,10 +41,6 @@
this.calibValidDateLabel = new System.Windows.Forms.Label();
this.calibDateLabel = new System.Windows.Forms.Label();
this.calibCertificateNrTextBox = new System.Windows.Forms.TextBox();
this.textBox_SerialNo = new System.Windows.Forms.TextBox();
this.label_SerialNo = new System.Windows.Forms.Label();
this.textBox_Type = new System.Windows.Forms.TextBox();
this.label_Type = new System.Windows.Forms.Label();
this.groupBox.SuspendLayout();
this.SuspendLayout();
//
@ -68,6 +68,38 @@
this.groupBox.TabStop = false;
this.groupBox.Text = "Calibration certificate";
//
// textBox_SerialNo
//
this.textBox_SerialNo.Enabled = false;
this.textBox_SerialNo.Location = new System.Drawing.Point(111, 178);
this.textBox_SerialNo.Name = "textBox_SerialNo";
this.textBox_SerialNo.Size = new System.Drawing.Size(239, 26);
this.textBox_SerialNo.TabIndex = 33;
//
// label_SerialNo
//
this.label_SerialNo.Location = new System.Drawing.Point(14, 181);
this.label_SerialNo.Name = "label_SerialNo";
this.label_SerialNo.Size = new System.Drawing.Size(81, 23);
this.label_SerialNo.TabIndex = 32;
this.label_SerialNo.Text = "Serial. No";
//
// textBox_Type
//
this.textBox_Type.Enabled = false;
this.textBox_Type.Location = new System.Drawing.Point(111, 137);
this.textBox_Type.Name = "textBox_Type";
this.textBox_Type.Size = new System.Drawing.Size(239, 26);
this.textBox_Type.TabIndex = 31;
//
// label_Type
//
this.label_Type.Location = new System.Drawing.Point(14, 140);
this.label_Type.Name = "label_Type";
this.label_Type.Size = new System.Drawing.Size(81, 23);
this.label_Type.TabIndex = 30;
this.label_Type.Text = "Type";
//
// certIdLabel
//
this.certIdLabel.AutoSize = true;
@ -152,43 +184,13 @@
this.calibCertificateNrTextBox.Size = new System.Drawing.Size(144, 26);
this.calibCertificateNrTextBox.TabIndex = 22;
//
// textBox_SerialNo
//
this.textBox_SerialNo.Location = new System.Drawing.Point(111, 178);
this.textBox_SerialNo.Name = "textBox_SerialNo";
this.textBox_SerialNo.Size = new System.Drawing.Size(239, 26);
this.textBox_SerialNo.TabIndex = 33;
//
// label_SerialNo
//
this.label_SerialNo.Location = new System.Drawing.Point(14, 181);
this.label_SerialNo.Name = "label_SerialNo";
this.label_SerialNo.Size = new System.Drawing.Size(81, 23);
this.label_SerialNo.TabIndex = 32;
this.label_SerialNo.Text = "Serial. No";
//
// textBox_Type
//
this.textBox_Type.Location = new System.Drawing.Point(111, 137);
this.textBox_Type.Name = "textBox_Type";
this.textBox_Type.Size = new System.Drawing.Size(239, 26);
this.textBox_Type.TabIndex = 31;
//
// label_Type
//
this.label_Type.Location = new System.Drawing.Point(14, 140);
this.label_Type.Name = "label_Type";
this.label_Type.Size = new System.Drawing.Size(81, 23);
this.label_Type.TabIndex = 30;
this.label_Type.Text = "Type";
//
// CalibCertificateCtrl
// CalibCertificateExtendedCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupBox);
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "CalibCertificateCtrl";
this.Name = "CalibCertificateExtendedCtrl";
this.Size = new System.Drawing.Size(360, 218);
this.groupBox.ResumeLayout(false);
this.groupBox.PerformLayout();

View File

@ -53,6 +53,7 @@ namespace TBF.UI.Bench.Metrology
Control correctionTextBox;
Control errorTextBox;
Control uncertaintyTextBox;
Control readabilityTextBox;
Unit currentUnit;
@ -83,6 +84,7 @@ namespace TBF.UI.Bench.Metrology
this.Controls.Add(correctionTextBox = new TextBox());
this.Controls.Add(errorTextBox = new TextBox());
this.Controls.Add(uncertaintyTextBox = new TextBox());
this.Controls.Add(readabilityTextBox = new TextBox());
currentUnit = TBF.Rig.Sequences.ProcessData.ElectricUnit;
unitComboBox.Text = currentUnit.ToDescription();
@ -102,6 +104,7 @@ namespace TBF.UI.Bench.Metrology
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [{1}]", Strings.Correction, unit.ToDescription()), Width = 100 });
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Error), Width = 100 });
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Uncertainty), Width = 100 });
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Readability), Width = 100 });
measuredLabel.Text = string.Format("{0} [{1}]:", Strings.Measured, unit.ToDescription());
correctedLabel.Text = string.Format("{0} [{1}]:", Strings.Corrected, unit.ToDescription());
@ -148,6 +151,7 @@ namespace TBF.UI.Bench.Metrology
//uncertainty
lvi.SubItems.Add(Common.Utils.ToNiceString(corr.Uncertainty, SignifDigits));
lvi.SubItems.Add(Common.Utils.ToNiceString(corr.Readability, SignifDigits));
listViewEx.Items.Add(lvi);
@ -170,6 +174,10 @@ namespace TBF.UI.Bench.Metrology
else if (unlocked && e.SubItem == 4)
{
listViewEx.StartEditing(uncertaintyTextBox, e.Item, e.SubItem);
}
else if (unlocked && e.SubItem == 5)
{
listViewEx.StartEditing(readabilityTextBox, e.Item, e.SubItem);
}
}
@ -194,6 +202,7 @@ namespace TBF.UI.Bench.Metrology
double correction; /// Correction in default unit
double error = 0;
double uncertainty = 0;
double readability = 0;
if (subItem == 1 && Utils.TryParseEDouble(strValue, out oriMeasurement) && (measurement = Units.ConvertFrom(currentUnit, oriMeasurement)) >= 0)
{
@ -274,6 +283,19 @@ namespace TBF.UI.Bench.Metrology
return true;
}
else if (subItem == 5 && ((strValue == Strings.NaN) || Utils.TryParseEDouble(strValue, out readability)))
{
if (strValue == Strings.NaN)
{
}
else
{
(item.Tag as MeasurementCorrection).Readability = readability;
item.SubItems[4].Text = Common.Utils.ToNiceString(readability, SignifDigits);
}
return true;
}
else
{
return false;

View File

@ -49,6 +49,7 @@ namespace TBF.UI.Bench.Metrology
Control measurementTextBox;
Control correctionTextBox;
Control uncertaintyTextBox;
Control readabilityTextBox;
public MetrologyDlgDiverterTab()
@ -78,9 +79,11 @@ namespace TBF.UI.Bench.Metrology
measurementTextBox = new TextBox();
correctionTextBox = new TextBox();
uncertaintyTextBox = new TextBox();
readabilityTextBox = new TextBox();
this.Controls.Add(measurementTextBox);
this.Controls.Add(correctionTextBox);
this.Controls.Add(uncertaintyTextBox);
this.Controls.Add(readabilityTextBox);
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemRightClicked += new SubItemEventHandler(listViewEx_SubItemRightClicked);
@ -90,6 +93,7 @@ namespace TBF.UI.Bench.Metrology
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [m3/h]", Strings.Flow), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [ms]", Strings.Correction), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() {Text = string.Format("{0} [%]", Strings.Uncertainty), Width = 100});
listViewEx.Columns.Add(new ColumnHeader() {Text = string.Format("{0} [%]", Strings.Readability), Width = 100});
RefreshAll();
}
@ -124,6 +128,7 @@ namespace TBF.UI.Bench.Metrology
lvi.SubItems.Add(corr.Measurement.ToString());
lvi.SubItems.Add((1000 * corr.Correction).ToString());
lvi.SubItems.Add(corr.Uncertainty.ToString());
lvi.SubItems.Add(corr.Readability.ToString());
lvi.Tag = corr;
listViewEx.Items.Add(lvi);
}
@ -142,6 +147,10 @@ namespace TBF.UI.Bench.Metrology
{
listViewEx.StartEditing(uncertaintyTextBox, e.Item, e.SubItem);
}
else if (unlocked && e.SubItem == 4)
{
listViewEx.StartEditing(readabilityTextBox, e.Item, e.SubItem);
}
}
void listViewEx_SubItemRightClicked(object sender, SubItemEventArgs e)
@ -203,7 +212,12 @@ namespace TBF.UI.Bench.Metrology
(item.Tag as MeasurementCorrection).Uncertainty = fvalue ;
return true;
}
else if (subItem == 4 && Utils.TryParseEFloat(value, out fvalue))
{
(item.Tag as MeasurementCorrection).Readability = fvalue ;
return true;
}
else
{
return false;

View File

@ -49,6 +49,7 @@ namespace TBF.UI.Bench.Metrology
Control measurementTextBox;
Control correctionTextBox;
Control uncertaintyTextBox;
Control readabilityTextBox;
public MetrologyDlgEvaporationTab()
@ -78,9 +79,11 @@ namespace TBF.UI.Bench.Metrology
measurementTextBox = new TextBox();
correctionTextBox = new TextBox();
uncertaintyTextBox = new TextBox();
readabilityTextBox = new TextBox();
this.Controls.Add(measurementTextBox);
this.Controls.Add(correctionTextBox);
this.Controls.Add(uncertaintyTextBox);
this.Controls.Add(readabilityTextBox);
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemRightClicked += new SubItemEventHandler(listViewEx_SubItemRightClicked);
@ -90,6 +93,7 @@ namespace TBF.UI.Bench.Metrology
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [°C]", Strings.Temperature), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [g/hour]", Strings.Evaporation), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Uncertainty), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Readability), Width = 100 });
RefreshAll();
}
@ -121,6 +125,7 @@ namespace TBF.UI.Bench.Metrology
lvi.SubItems.Add(corr.Measurement.ToString());
lvi.SubItems.Add((1000 * corr.Correction).ToString());
lvi.SubItems.Add(corr.Uncertainty.ToString());
lvi.SubItems.Add(corr.Readability.ToString());
lvi.Tag = corr;
listViewEx.Items.Add(lvi);
}
@ -139,6 +144,10 @@ namespace TBF.UI.Bench.Metrology
{
listViewEx.StartEditing(uncertaintyTextBox, e.Item, e.SubItem);
}
else if (unlocked && e.SubItem == 4)
{
listViewEx.StartEditing(readabilityTextBox, e.Item, e.SubItem);
}
}
void listViewEx_SubItemRightClicked(object sender, SubItemEventArgs e)
@ -200,6 +209,11 @@ namespace TBF.UI.Bench.Metrology
(item.Tag as MeasurementCorrection).Uncertainty = fvalue;
return true;
}
else if (subItem == 4 && Utils.TryParseEFloat(value, out fvalue))
{
(item.Tag as MeasurementCorrection).Readability = fvalue;
return true;
}
else
{
return false;

View File

@ -53,6 +53,7 @@ namespace TBF.UI.Bench.Metrology
Control correctionTextBox;
Control errorTextBox;
Control uncertaintyTextBox;
Control readabilityTextBox;
readonly int rangeIx; /// 0 (no range) or 1..5 (range #)
readonly bool isLastFlowMeterRange; /// true when this is the last range of this flow meter.
/// This is to prevent double saving of the meter entity to a DB
@ -98,6 +99,7 @@ namespace TBF.UI.Bench.Metrology
this.Controls.Add(correctionTextBox = new TextBox());
this.Controls.Add(errorTextBox = new TextBox());
this.Controls.Add(uncertaintyTextBox = new TextBox());
this.Controls.Add(readabilityTextBox = new TextBox());
currentUnit = TBF.Rig.Sequences.ProcessData.FlowUnit;
unitComboBox.Text = currentUnit.ToDescription();
@ -117,6 +119,7 @@ namespace TBF.UI.Bench.Metrology
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [{1}]", Strings.Correction, unit.ToDescription()), Width = 150 });
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Error), Width = 100 });
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Uncertainty), Width = 100 });
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Readability), Width = 100 });
measuredLabel.Text = string.Format("{0} [{1}]:", Strings.Measured, unit.ToDescription());
correctedLabel.Text = string.Format("{0} [{1}]:", Strings.Corrected, unit.ToDescription());
@ -167,6 +170,7 @@ namespace TBF.UI.Bench.Metrology
}
lvi.SubItems.Add(corr.Uncertainty.ToString());
lvi.SubItems.Add(corr.Readability.ToString());
listViewEx.Items.Add(lvi);
}
@ -188,6 +192,10 @@ namespace TBF.UI.Bench.Metrology
else if (unlocked && e.SubItem == 4)
{
listViewEx.StartEditing(uncertaintyTextBox, e.Item, e.SubItem);
}
else if (unlocked && e.SubItem == 5)
{
listViewEx.StartEditing(readabilityTextBox, e.Item, e.SubItem);
}
}
@ -212,6 +220,7 @@ namespace TBF.UI.Bench.Metrology
double correction; /// Correction in default unit
double error = 0;
double uncertainty;
double readibility;
if (subItem == 1 && Utils.TryParseEDouble(strValue, out oriMeasurement) && (measurement = Units.ConvertFrom(currentUnit, oriMeasurement)) >= 0)
{
@ -294,6 +303,21 @@ namespace TBF.UI.Bench.Metrology
return true;
}
if (subItem == 5 && Utils.TryParseEDouble(strValue, out readibility))
{
(item.Tag as MeasurementCorrection).Readability = readibility;
if (readibility == 0.0f)
{
item.SubItems[3].Text = Strings.NaN;
}
else
{
item.SubItems[3].Text = Common.Utils.ToNiceString(readibility, SignifDigits);
}
return true;
}
else
{
return false;

View File

@ -49,6 +49,7 @@ namespace TBF.UI.Bench.Metrology
Control measurementTextBox;
Control correctionTextBox;
Control uncertaintyTextBox;
Control readabilityTextBox;
public MetrologyDlgLevelMeterTab()
@ -78,9 +79,11 @@ namespace TBF.UI.Bench.Metrology
measurementTextBox = new TextBox();
correctionTextBox = new TextBox();
uncertaintyTextBox = new TextBox();
readabilityTextBox = new TextBox();
this.Controls.Add(measurementTextBox);
this.Controls.Add(correctionTextBox);
this.Controls.Add(uncertaintyTextBox);
this.Controls.Add(readabilityTextBox);
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemRightClicked += new SubItemEventHandler(listViewEx_SubItemRightClicked);
@ -90,6 +93,7 @@ namespace TBF.UI.Bench.Metrology
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [mm]", Strings.Level), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [mm]", Strings.Correction), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Uncertainty), Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Readability), Width = 100 });
RefreshAll();
}
@ -121,6 +125,7 @@ namespace TBF.UI.Bench.Metrology
lvi.SubItems.Add(corr.Measurement.ToString());
lvi.SubItems.Add((corr.Correction).ToString());
lvi.SubItems.Add((corr.Uncertainty).ToString());
lvi.SubItems.Add((corr.Readability).ToString());
lvi.Tag = corr;
listViewEx.Items.Add(lvi);
}
@ -196,6 +201,11 @@ namespace TBF.UI.Bench.Metrology
(item.Tag as MeasurementCorrection).Uncertainty = fvalue;
return true;
}
else if (subItem == 4 && Utils.TryParseEFloat(value, out fvalue))
{
(item.Tag as MeasurementCorrection).Readability = fvalue;
return true;
}
else
{
return false;

View File

@ -53,6 +53,7 @@ namespace TBF.UI.Bench.Metrology
Control correctionTextBox;
Control errorTextBox;
Control uncertaintyTextBox;
Control readabilityTextBox;
Unit currentUnit;
@ -83,6 +84,7 @@ namespace TBF.UI.Bench.Metrology
this.Controls.Add(correctionTextBox = new TextBox());
this.Controls.Add(errorTextBox = new TextBox());
this.Controls.Add(uncertaintyTextBox = new TextBox());
this.Controls.Add(readabilityTextBox = new TextBox());
currentUnit = TBF.Rig.Sequences.ProcessData.PressUnit;
unitComboBox.Text = currentUnit.ToDescription();
@ -102,6 +104,7 @@ namespace TBF.UI.Bench.Metrology
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [{1}]", Strings.Correction, unit.ToDescription()), Width = 100 });
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Error), Width = 100 });
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Uncertainty), Width = 100 });
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Readability), Width = 100 });
measuredLabel.Text = string.Format("{0} [{1}]:", Strings.Measured, unit.ToDescription());
correctedLabel.Text = string.Format("{0} [{1}]:", Strings.Corrected, unit.ToDescription());
@ -149,6 +152,8 @@ namespace TBF.UI.Bench.Metrology
//uncertainty
lvi.SubItems.Add(Common.Utils.ToNiceString(corr.Uncertainty, SignifDigits));
//Readability
lvi.SubItems.Add(Common.Utils.ToNiceString(corr.Readability, SignifDigits));
listViewEx.Items.Add(lvi);
}
@ -170,6 +175,10 @@ namespace TBF.UI.Bench.Metrology
else if (unlocked && e.SubItem == 4)
{
listViewEx.StartEditing(uncertaintyTextBox, e.Item, e.SubItem);
}
else if (unlocked && e.SubItem == 5)
{
listViewEx.StartEditing(readabilityTextBox, e.Item, e.SubItem);
}
}
@ -194,6 +203,7 @@ namespace TBF.UI.Bench.Metrology
double correction; /// Correction in default unit
double error = 0;
double uncertaitity;
double readability;
if (subItem == 1 && Utils.TryParseEDouble(strValue, out oriMeasurement) && (measurement = Units.ConvertFrom(currentUnit, oriMeasurement)) >= 0)
{
@ -274,6 +284,19 @@ namespace TBF.UI.Bench.Metrology
return true;
}
else if (subItem == 5 && (Utils.TryParseEDouble(strValue, out readability)))
{
if (strValue == Strings.NaN)
{
}
else
{
(item.Tag as MeasurementCorrection).Readability = readability;
item.SubItems[5].Text = Common.Utils.ToNiceString(readability, SignifDigits);
}
return true;
}
else
{
return false;

View File

@ -4,15 +4,15 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Windows.Forms;
using log4net;
using Common;
using Common.Forms;
using Config.Entities;
using TBF.Resources;
using TBF.Rig.GenericDevices;
using TBF.Rig.MettlerToledo.Standard;
using TBF.UI.Shared;
using static System.Net.Mime.MediaTypeNames;
namespace TBF.UI.Bench.Metrology
{
@ -54,6 +54,7 @@ namespace TBF.UI.Bench.Metrology
Control correctionTextBox;
Control errorTextBox;
Control uncertaintyTextBox;
Control readabilityTextBox;
Unit currentUnit;
@ -84,6 +85,7 @@ namespace TBF.UI.Bench.Metrology
this.Controls.Add(correctionTextBox = new TextBox());
this.Controls.Add(errorTextBox = new TextBox());
this.Controls.Add(uncertaintyTextBox = new TextBox());
this.Controls.Add(readabilityTextBox = new TextBox());
currentUnit = TBF.Rig.Sequences.ProcessData.MassUnit;
unitComboBox.Text = currentUnit.ToDescription();
@ -103,6 +105,7 @@ namespace TBF.UI.Bench.Metrology
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [{1}]", Strings.Correction, unit.ToDescription()), Width = 150 });
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Error), Width = 100 });
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Uncertainty), Width = 100 });
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Readability), Width = 100 });
measuredLabel.Text = string.Format("{0} [{1}]:", Strings.Measured, unit.ToDescription());
correctedLabel.Text = string.Format("{0} [{1}]:", Strings.Corrected, unit.ToDescription());
@ -130,7 +133,7 @@ namespace TBF.UI.Bench.Metrology
buoyancyTempTextBox.Text = BalanceCfg.BuoyancyTemp.ToString("F2");
buoyancyPressTextBox.Text = BalanceCfg.BuoyancyPress.ToString("F4");
buoyancyHumiTextBox.Text = BalanceCfg.BuoyancyHumi.ToString("F1");
/// airDensityTextBox.Text = //calculate air density
airDensityTextBox.Text = CalculateAirDetsity(BalanceCfg).ToString("F4");
weightStandardDensityTextBox.Text = BalanceCfg.WeightStandardDensity.ToString("F1");
}
@ -138,6 +141,27 @@ namespace TBF.UI.Bench.Metrology
foreach (var corr in MeterEntity.Corrections) AddOneLVI(corr);
}
double CalculateAirDetsity(IScaleCfg scaleCfg)//, double temperature, double pressure, double humidity)
{
double temperature = scaleCfg.BuoyancyTemp;
double humidity = scaleCfg.BuoyancyHumi;
double pressure = Units.ConvertTo(Unit.mbar, scaleCfg.BuoyancyPress);
double t = 273.15 + temperature;
double F6 =
(1.2811805 / 100000) * Math.Pow(t, 2)
- (1.950987 / 100) * t
+ 34.04926034
- (6.353631 * 1000) / t;
double G6 = Math.Exp(F6);
double H6 = scaleCfg.BuoyancyHumi/100*G6/pressure;
double airDensityE = (((3.48353 / 1000) * pressure * (1 - (0.378 * H6))) / t )/ 1000;
return (airDensityE * 1000);
}
void AddOneLVI(MeasurementCorrection corr)
{
int nr = listViewEx.Items.Count + 1;
@ -161,6 +185,7 @@ namespace TBF.UI.Bench.Metrology
}
lvi.SubItems.Add(corr.Uncertainty.ToString());
lvi.SubItems.Add(corr.Readability.ToString());
listViewEx.Items.Add(lvi);
}
@ -182,6 +207,10 @@ namespace TBF.UI.Bench.Metrology
else if (unlocked && e.SubItem == 4)
{
listViewEx.StartEditing(uncertaintyTextBox, e.Item, e.SubItem);
}
else if (unlocked && e.SubItem == 5)
{
listViewEx.StartEditing(readabilityTextBox, e.Item, e.SubItem);
}
}
@ -206,9 +235,11 @@ namespace TBF.UI.Bench.Metrology
double correction; /// Correction in default unit
double error = 0;
double uncertainty;
double readability = 0;
if (subItem == 1 && Utils.TryParseEDouble(strValue, out oriMeasurement) && (measurement = Units.ConvertFrom(currentUnit, oriMeasurement)) >= 0)
if (subItem == 1 && Utils.TryParseEDouble(strValue, out oriMeasurement))
{
measurement = Units.ConvertFrom(currentUnit, oriMeasurement);
(item.Tag as MeasurementCorrection).Measurement = measurement;
/// Update error (if possible)
@ -279,11 +310,25 @@ namespace TBF.UI.Bench.Metrology
if (uncertainty != 0)
{
item.SubItems[3].Text = Common.Utils.ToNiceString(uncertainty, SignifDigits);
item.SubItems[4].Text = Common.Utils.ToNiceString(uncertainty, SignifDigits);
}
else
{
item.SubItems[3].Text = Strings.NaN;
item.SubItems[4].Text = Strings.NaN;
}
return true;
}
else if (subItem == 5 && Utils.TryParseEDouble(strValue, out readability))
{
(item.Tag as MeasurementCorrection).Readability = readability;
if (readability != 0)
{
item.SubItems[5].Text = Common.Utils.ToNiceString(readability, SignifDigits);
}
else
{
item.SubItems[5].Text = Strings.NaN;
}
return true;
}
@ -463,5 +508,31 @@ namespace TBF.UI.Bench.Metrology
InitializeColumns(listViewEx, currentUnit);
RefreshAll();
}
}
private void buoyancy_TextChanged(object sender, EventArgs e)
{
var cfg = new BalanceCfg(null);
cfg.BuoyancyTemp = Utils.ParseSFloat(buoyancyTempTextBox.Text);
cfg.BuoyancyPress =Utils.ParseUFloat(buoyancyPressTextBox.Text);
cfg.BuoyancyHumi = Utils.ParseUFloat(buoyancyHumiTextBox.Text);
airDensityTextBox.Text = CalculateAirDetsity(cfg).ToString("F4");
}
private void buoyancyHumiTextBox_TextChanged(object sender, EventArgs e)
{
buoyancy_TextChanged(sender, e);
}
private void buoyancyPressTextBox_TextChanged(object sender, EventArgs e)
{
buoyancy_TextChanged(sender, e);
}
private void buoyancyTempTextBox_TextChanged(object sender, EventArgs e)
{
buoyancy_TextChanged(sender, e);
}
}
}

View File

@ -194,6 +194,7 @@ namespace TBF.UI.Bench.Metrology
this.buoyancyHumiTextBox.Name = "buoyancyHumiTextBox";
this.buoyancyHumiTextBox.Size = new System.Drawing.Size(121, 26);
this.buoyancyHumiTextBox.TabIndex = 5;
this.buoyancyHumiTextBox.TextChanged += new System.EventHandler(this.buoyancyHumiTextBox_TextChanged);
//
// buoyancyPressTextBox
//
@ -203,6 +204,7 @@ namespace TBF.UI.Bench.Metrology
this.buoyancyPressTextBox.Name = "buoyancyPressTextBox";
this.buoyancyPressTextBox.Size = new System.Drawing.Size(121, 26);
this.buoyancyPressTextBox.TabIndex = 4;
this.buoyancyPressTextBox.TextChanged += new System.EventHandler(this.buoyancyPressTextBox_TextChanged);
//
// buoyancyTempTextBox
//
@ -212,6 +214,7 @@ namespace TBF.UI.Bench.Metrology
this.buoyancyTempTextBox.Name = "buoyancyTempTextBox";
this.buoyancyTempTextBox.Size = new System.Drawing.Size(121, 26);
this.buoyancyTempTextBox.TabIndex = 3;
this.buoyancyTempTextBox.TextChanged += new System.EventHandler(this.buoyancyTempTextBox_TextChanged);
//
// buoyancyHumiLabel
//

View File

@ -72,7 +72,7 @@ namespace TBF.UI.Bench.Metrology
//
this.splitContainer1.Panel2.Controls.Add(this.listViewEx);
this.splitContainer1.Size = new System.Drawing.Size(975, 462);
this.splitContainer1.SplitterDistance = 157;
this.splitContainer1.SplitterDistance = 146;
this.splitContainer1.SplitterWidth = 6;
this.splitContainer1.TabIndex = 2;
//
@ -187,7 +187,7 @@ namespace TBF.UI.Bench.Metrology
this.listViewEx.Location = new System.Drawing.Point(0, 0);
this.listViewEx.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.listViewEx.Name = "listViewEx";
this.listViewEx.Size = new System.Drawing.Size(975, 299);
this.listViewEx.Size = new System.Drawing.Size(975, 310);
this.listViewEx.TabIndex = 0;
this.listViewEx.UseCompatibleStateImageBehavior = false;
this.listViewEx.View = System.Windows.Forms.View.Details;

View File

@ -53,6 +53,7 @@ namespace TBF.UI.Bench.Metrology
Control correctionTextBox;
Control errorTextBox;
Control uncertaintyTextBox;
Control readabilityTextBox;
Unit currentUnit;
@ -83,6 +84,7 @@ namespace TBF.UI.Bench.Metrology
this.Controls.Add(correctionTextBox = new TextBox());
this.Controls.Add(errorTextBox = new TextBox());
this.Controls.Add(uncertaintyTextBox = new TextBox());
this.Controls.Add(readabilityTextBox = new TextBox());
currentUnit = TBF.Rig.Sequences.ProcessData.TempUnit;
unitComboBox.Text = currentUnit.ToDescription();
@ -102,6 +104,7 @@ namespace TBF.UI.Bench.Metrology
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [{1}]", Strings.Correction, unit.ToDescription()), Width = 150 });
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Error), Width = 100 });
lv.Columns.Add(new ColumnHeader() {Text = string.Format("{0} [%]", Strings.Uncertainty), Width = 100 });
lv.Columns.Add(new ColumnHeader() {Text = string.Format("{0} [%]", Strings.Readability), Width = 100 });
measuredLabel.Text = string.Format("{0} [{1}]:", Strings.Measured, unit.ToDescription());
correctedLabel.Text = string.Format("{0} [{1}]:", Strings.Corrected, unit.ToDescription());
@ -148,6 +151,7 @@ namespace TBF.UI.Bench.Metrology
lvi.SubItems.Add(Common.Utils.ToNiceString(error, SignifDigits));
}
lvi.SubItems.Add(corr.Uncertainty.ToString());
lvi.SubItems.Add(corr.Readability.ToString());
listViewEx.Items.Add(lvi);
}
@ -169,6 +173,10 @@ namespace TBF.UI.Bench.Metrology
else if (unlocked && e.SubItem == 4)
{
listViewEx.StartEditing(uncertaintyTextBox, e.Item, e.SubItem);
}
else if (unlocked && e.SubItem == 5)
{
listViewEx.StartEditing(readabilityTextBox, e.Item, e.SubItem);
}
}
@ -193,6 +201,7 @@ namespace TBF.UI.Bench.Metrology
double correction; /// Correction in default unit
double error = 0;
double uncertainty;
double readability;
if (subItem == 1 && Utils.TryParseEDouble(strValue, out oriMeasurement) && (measurement = Units.ConvertFrom(currentUnit, oriMeasurement)) >= 0)
{
@ -260,7 +269,7 @@ namespace TBF.UI.Bench.Metrology
return true;
}
if (subItem == 4 && Utils.TryParseEDouble(strValue, out uncertainty))
else if (subItem == 4 && Utils.TryParseEDouble(strValue, out uncertainty))
{
(item.Tag as MeasurementCorrection).Uncertainty = uncertainty;
@ -269,7 +278,21 @@ namespace TBF.UI.Bench.Metrology
}
else
{
item.SubItems[2].Text = Common.Utils.ToNiceString(uncertainty, SignifDigits);
item.SubItems[4].Text = Common.Utils.ToNiceString(uncertainty, SignifDigits);
}
return true;
}
else if (subItem == 5 && Utils.TryParseEDouble(strValue, out readability))
{
(item.Tag as MeasurementCorrection).Readability = readability;
if (strValue == Strings.NaN)
{
}
else
{
item.SubItems[5].Text = Common.Utils.ToNiceString(readability, SignifDigits);
}
return true;

File diff suppressed because it is too large Load Diff

View File

@ -1,120 +1,125 @@
<?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">
<!--
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: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: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: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>
</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>

View File

@ -1,12 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="5.1.1" targetFramework="net472" />
<package id="ClosedXML" version="0.105.0-rc" targetFramework="net472" />
<package id="ClosedXML.Parser" version="2.0.0-preview1" targetFramework="net472" />
<package id="DocumentFormat.OpenXml" version="3.1.1" targetFramework="net472" />
<package id="DocumentFormat.OpenXml.Framework" version="3.1.1" targetFramework="net472" />
<package id="ExcelNumberFormat" version="1.1.0" targetFramework="net472" />
<package id="FluentNHibernate" version="2.0.3.0" targetFramework="net40" />
<package id="Iesi.Collections" version="4.0.0.4000" targetFramework="net40" />
<package id="Microsoft.Bcl.HashCode" version="1.1.1" targetFramework="net472" />
<package id="MySql.Data" version="6.6.5" targetFramework="net20" />
<package id="NHibernate" version="4.0.4.4000" targetFramework="net40" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
<package id="Oracle.ManagedDataAccess" version="19.11.0" targetFramework="net472" />
<package id="RBush.Signed" version="4.0.0" targetFramework="net472" />
<package id="SixLabors.Fonts" version="1.0.0" targetFramework="net472" />
<package id="System.Buffers" version="4.6.1" targetFramework="net472" />
<package id="System.Data.SQLite" version="1.0.90.0" targetFramework="net40" />
<package id="System.Memory" version="4.6.2" targetFramework="net472" />

View File

@ -92,6 +92,7 @@
<HintPath>..\packages\System.Buffers.4.6.1\lib\net462\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Memory, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.6.2\lib\net462\System.Memory.dll</HintPath>
</Reference>
@ -129,6 +130,7 @@
<Compile Include="Uncertainty\Calculation\BatchProcessTableTest.cs" />
<Compile Include="Uncertainty\Calculation\CalculationTableTest.cs" />
<Compile Include="Uncertainty\Calculation\MathTest.cs" />
<Compile Include="Uncertainty\CommonTable\TableTest.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />

View File

@ -0,0 +1,108 @@
using ClosedXML.Excel;
using JetBrains.Annotations;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Results.Uncertainty;
using Results.Uncertainty.CommonTable;
namespace TBFTests.Uncertainty.CommonTable
{
[TestClass]
[TestSubject(typeof(Table))]
public class TableTest
{
[TestMethod]
public void CrateTableTest()
{
var wb = new XLWorkbook();
var ws = wb.AddWorksheet("Demo");
var table = new Table();
// name your columns up front (optional)
table.AddColumn("Product");
table.AddColumn("Price");
// add a row
int row0 = table.AddRow();
table.AddCell(row0, "Product", "Widget");
table.AddCell(row0, "Price", 9.99);
// another row
int row1 = table.AddRow("Second row");
table.AddCell(row1, 0, "Gadget"); // by index
table.AddCell(row1, 1, 19.49);
// dump into sheet (with headers)
table.ToWorksheet(ws, includeHeaders: true);
// sheet check:
ws.Cell(2, 1).Value.Equals(table.GetCell(row0,0).Value); // A2
ws.Cell(3, 2).Value.Equals(table.GetCell(row1,1).Value); // B2
}
[TestMethod]
public void CrateTableOnPositionTest()
{
var wb = new XLWorkbook();
var ws = wb.AddWorksheet("Demo");
var table = new Table();
// name your columns up front (optional)
string Column = "A";
table.AddColumn(Column);
Column = CommonExcell.NextColumn(Column);
table.AddColumn(Column);
Column = CommonExcell.NextColumn(Column);
table.AddColumn(Column);
// add a row
int row0 = table.AddRow();
table.AddCell(row0, "A", "Widget");
table.AddCell(row0, "B", 9.99);
table.AddCell(row0, "C", 89.93);
// add a row
int row1 = table.AddRow();
table.AddCell(row0, "A", "Temp");
table.AddCell(row0, "B", 169.99);
table.AddCell(row0, "C", 88.01);
// another row by index
int row2 = table.AddRow("Another row");
table.AddCell(row1, 0, "Gadget"); // by index
table.AddCell(row1, 1, 19.49);
table.AddCell(row1, 2, 21.49);
// dump into sheet (with headers)
table.ToWorksheet(ws, includeHeaders: true);
// sheet check:
ws.Cell(2, 1).Value.Equals(table.GetCell(row0,0).Value); // A2
ws.Cell(3, 2).Value.Equals(table.GetCell(row1,1).Value); // B3
ws.Cell(4, 3).Value.Equals(table.GetCell(row2,2).Value); // C4
table.ToWorksheet(ws, includeHeaders: false);
// sheet check:
ws.Cell(1, 1).Value.Equals(table.GetCell(row0,0).Value); // A2
ws.Cell(2, 2).Value.Equals(table.GetCell(row1,1).Value); // B3
ws.Cell(3, 3).Value.Equals(table.GetCell(row2,2).Value); // C4
int iOffsetRow = 10;
int iOffsetCol = 2;
table.ToWorksheetWithOffset(ws, iOffsetRow, iOffsetCol, includeHeaders: false);
// sheet check:
ws.Cell(1 + iOffsetRow, 1 + iOffsetCol).Value.Equals(table.GetCell(row0,0).Value); // A2 + offset
ws.Cell(2 + iOffsetRow, 2 + iOffsetCol).Value.Equals(table.GetCell(row1,1).Value); // B3 + offset
ws.Cell(3 + iOffsetRow, 3 + iOffsetCol).Value.Equals(table.GetCell(row2,2).Value); // C4 + offset
}
}
}