Config.Entities.Profile, PTest, Config.Mappings.ProfileMap, PTestMap added.
This commit is contained in:
parent
0a68fed3e9
commit
ecaca8cc6b
@ -84,6 +84,8 @@
|
||||
<Compile Include="Entities\OutputPath.cs" />
|
||||
<Compile Include="Entities\Procedure.cs" />
|
||||
<Compile Include="Entities\ProcedureHistory.cs" />
|
||||
<Compile Include="Entities\Profile.cs" />
|
||||
<Compile Include="Entities\PTest.cs" />
|
||||
<Compile Include="Entities\Test.cs" />
|
||||
<Compile Include="Entities\TransitionSequence.cs" />
|
||||
<Compile Include="Entities\TransitionStep.cs" />
|
||||
@ -106,6 +108,8 @@
|
||||
<Compile Include="Mappings\MetersPathMap.cs" />
|
||||
<Compile Include="Mappings\OutputPathMap.cs" />
|
||||
<Compile Include="Mappings\ProcedureMap.cs" />
|
||||
<Compile Include="Mappings\ProfileMap.cs" />
|
||||
<Compile Include="Mappings\PTestMap.cs" />
|
||||
<Compile Include="Mappings\TestMap.cs" />
|
||||
<Compile Include="Mappings\TransitionSequenceMap.cs" />
|
||||
<Compile Include="Mappings\TransitionStepMap.cs" />
|
||||
|
||||
@ -83,6 +83,14 @@ namespace Config.Entities
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum ProfileType
|
||||
{
|
||||
One,
|
||||
Two,
|
||||
Three,
|
||||
Count,
|
||||
}
|
||||
|
||||
/// <summary> Kind of meters for the procedure / test </summary>
|
||||
public enum MetersKind
|
||||
{
|
||||
@ -294,20 +302,6 @@ namespace Config.Entities
|
||||
Count
|
||||
}
|
||||
|
||||
public enum TestRedType
|
||||
{
|
||||
Fix,
|
||||
/// etc.
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum FQC1
|
||||
{
|
||||
FQC1,
|
||||
FQP1,
|
||||
Count,
|
||||
}
|
||||
|
||||
public enum Progress
|
||||
{
|
||||
JustStarted,
|
||||
|
||||
319
Config/Entities/PTest.cs
Normal file
319
Config/Entities/PTest.cs
Normal file
@ -0,0 +1,319 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Test, consisting of one or more repetitions of the test 'SingleTest'.
|
||||
/// </summary>
|
||||
public class PTest : IHasName, IHasItemNr
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual float CoefQfrom { get; set; } /// Water flow low limit in [m3/h]
|
||||
public virtual float CoefQto { get; set; } /// Water flow high limit in [m3/h]
|
||||
public virtual float ErrLimLo { get; set; } /// in [%] usually < 0, in case of heat meters: 1=class1, 2=class2, 3=class3
|
||||
public virtual float ErrLimHi { get; set; } /// in [%] usually > 0, in case of heat meters: -Qn in m3/h
|
||||
public virtual float TempLimLo { get; set; } /// Lower limit for the controlled temperature
|
||||
public virtual float TempLimHi { get; set; } /// Upper limit for the controlled temperature
|
||||
public virtual float PressLimLo { get; set; } /// [bar] min. water pressure
|
||||
public virtual float PressLimHi { get; set; } /// [bar] max. water pressure
|
||||
|
||||
public virtual sbyte E1 { get; set; } /// 0=off, 1=info, 2=evaluate
|
||||
public virtual sbyte E2 { get; set; }
|
||||
public virtual sbyte E3 { get; set; }
|
||||
public virtual sbyte E4 { get; set; }
|
||||
public virtual sbyte E5 { get; set; }
|
||||
public virtual sbyte E6 { get; set; }
|
||||
public virtual sbyte E7 { get; set; }
|
||||
public virtual sbyte E8 { get; set; }
|
||||
public virtual sbyte E9 { get; set; }
|
||||
public virtual sbyte E10 { get; set; }
|
||||
public virtual sbyte E11 { get; set; }
|
||||
public virtual sbyte E12 { get; set; }
|
||||
public virtual sbyte E13 { get; set; }
|
||||
public virtual sbyte E14 { get; set; }
|
||||
public virtual sbyte E15 { get; set; }
|
||||
public virtual sbyte E16 { get; set; }
|
||||
public virtual sbyte E21 { get; set; }
|
||||
|
||||
public virtual float Delta_Q_pct { get; set; } /// [%] max deviation from the mean flow
|
||||
public virtual float Delta_T { get; set; } /// [°C] max. T_up or T_down deviation from the mean temperature
|
||||
public virtual float Delta_Tup_Tdn { get; set; } /// [°C] max. difference abs(T_up - T_down)
|
||||
public virtual float TestTime_min { get; set; } /// [s]
|
||||
public virtual float TestTime_max { get; set; } /// [s]
|
||||
public virtual float AmbTemp_min { get; set; } /// [°C] min. ambient temperature
|
||||
public virtual float AmbTemp_max { get; set; } /// [°C] max. ambient temperature
|
||||
|
||||
public virtual float Coef_E9 { get; set; } /// Coefficient used in E9, default 0.025
|
||||
public virtual float Coef_E10 { get; set; } /// Coefficient used in E10, default 0.04
|
||||
public virtual float Coef_E11 { get; set; } /// Coefficient used in E11, default 0.1
|
||||
public virtual float Coef_E12 { get; set; } /// Coefficient used in E12, default 1
|
||||
public virtual float Offset_E9 { get; set; } /// [s] default 0 (no offset)
|
||||
public virtual float Offset_E12 { get; set; } /// [s] default 0 (no offset)
|
||||
|
||||
public virtual Profile Profile { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
public PTest()
|
||||
{
|
||||
///
|
||||
/// Default values
|
||||
///
|
||||
CoefQfrom = 0.9f;
|
||||
CoefQto = 1.0f;
|
||||
ErrLimLo = -2.0f; /// [%] lower error limit
|
||||
ErrLimHi = 2.0f; /// [%] upper error limit
|
||||
TempLimLo = 15.0f;
|
||||
TempLimHi = 25.0f;
|
||||
PressLimLo = 0;
|
||||
PressLimHi = 16.0f;
|
||||
|
||||
E1 = 1;
|
||||
E2 = 1;
|
||||
E3 = 1;
|
||||
E4 = 1;
|
||||
E5 = 1;
|
||||
E6 = 1;
|
||||
E7 = 1;
|
||||
E8 = 1;
|
||||
E9 = 1;
|
||||
E10 = 1;
|
||||
E11 = 1;
|
||||
E12 = 1;
|
||||
E13 = 1;
|
||||
E14 = 1;
|
||||
E15 = 1;
|
||||
E16 = 1;
|
||||
E21 = 1;
|
||||
|
||||
Delta_Q_pct = 0;
|
||||
Delta_T = 0;
|
||||
Delta_Tup_Tdn = 0;
|
||||
TestTime_min = 0;
|
||||
TestTime_max = 0;
|
||||
AmbTemp_min = 0;
|
||||
AmbTemp_max = 0;
|
||||
|
||||
Coef_E9 = 0;
|
||||
Coef_E10 = 0;
|
||||
Coef_E11 = 0;
|
||||
Coef_E12 = 0;
|
||||
Offset_E9 = 0;
|
||||
Offset_E12 = 0;
|
||||
}
|
||||
|
||||
public PTest(string name, int itemNr, Profile profile)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
ItemNr = itemNr;
|
||||
Profile = profile;
|
||||
}
|
||||
|
||||
// Makes a new copy of this object (not just a reference)
|
||||
public virtual PTest Clone()
|
||||
{
|
||||
PTest result = new PTest(Name, ItemNr, Profile);
|
||||
|
||||
result.CoefQfrom = CoefQfrom;
|
||||
result.CoefQto = CoefQto;
|
||||
result.ErrLimLo = ErrLimLo;
|
||||
result.ErrLimHi = ErrLimHi;
|
||||
result.TempLimLo = TempLimLo;
|
||||
result.TempLimHi = TempLimHi;
|
||||
result.PressLimLo = PressLimLo;
|
||||
result.PressLimHi = PressLimHi;
|
||||
|
||||
result.E1 = E1;
|
||||
result.E2 = E2;
|
||||
result.E3 = E3;
|
||||
result.E4 = E4;
|
||||
result.E5 = E5;
|
||||
result.E6 = E6;
|
||||
result.E7 = E7;
|
||||
result.E8 = E8;
|
||||
result.E9 = E9;
|
||||
result.E10 = E10;
|
||||
result.E11 = E11;
|
||||
result.E12 = E12;
|
||||
result.E13 = E13;
|
||||
result.E14 = E14;
|
||||
result.E15 = E15;
|
||||
result.E16 = E16;
|
||||
result.E21 = E21;
|
||||
|
||||
result.Delta_Q_pct = Delta_Q_pct;
|
||||
result.Delta_T = Delta_T;
|
||||
result.Delta_Tup_Tdn = Delta_Tup_Tdn;
|
||||
result.TestTime_min = TestTime_min;
|
||||
result.TestTime_max = TestTime_max;
|
||||
result.AmbTemp_min = AmbTemp_min;
|
||||
result.AmbTemp_max = AmbTemp_max;
|
||||
|
||||
result.Coef_E9 = Coef_E9;
|
||||
result.Coef_E10 = Coef_E10;
|
||||
result.Coef_E11 = Coef_E11;
|
||||
result.Coef_E12 = Coef_E12;
|
||||
result.Offset_E9 = Offset_E9;
|
||||
result.Offset_E12 = Offset_E12;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
{
|
||||
CultureInfo ci = CultureInfo.InvariantCulture;
|
||||
|
||||
output.WriteLine(Name);
|
||||
output.WriteLine(CoefQfrom.ToString(ci));
|
||||
output.WriteLine(CoefQto.ToString(ci));
|
||||
output.WriteLine(ErrLimLo.ToString(ci));
|
||||
output.WriteLine(ErrLimHi.ToString(ci));
|
||||
output.WriteLine(TempLimLo.ToString(ci));
|
||||
output.WriteLine(TempLimHi.ToString(ci));
|
||||
output.WriteLine(PressLimLo.ToString(ci));
|
||||
output.WriteLine(PressLimHi.ToString(ci));
|
||||
|
||||
output.WriteLine(E1.ToString());
|
||||
output.WriteLine(E2.ToString());
|
||||
output.WriteLine(E3.ToString());
|
||||
output.WriteLine(E4.ToString());
|
||||
output.WriteLine(E5.ToString());
|
||||
output.WriteLine(E6.ToString());
|
||||
output.WriteLine(E7.ToString());
|
||||
output.WriteLine(E8.ToString());
|
||||
output.WriteLine(E9.ToString());
|
||||
output.WriteLine(E10.ToString());
|
||||
output.WriteLine(E11.ToString());
|
||||
output.WriteLine(E12.ToString());
|
||||
output.WriteLine(E13.ToString());
|
||||
output.WriteLine(E14.ToString());
|
||||
output.WriteLine(E15.ToString());
|
||||
output.WriteLine(E16.ToString());
|
||||
output.WriteLine(E21.ToString());
|
||||
|
||||
output.WriteLine(Delta_Q_pct.ToString(ci));
|
||||
output.WriteLine(Delta_T.ToString(ci));
|
||||
output.WriteLine(Delta_Tup_Tdn.ToString(ci));
|
||||
output.WriteLine(TestTime_min.ToString(ci));
|
||||
output.WriteLine(TestTime_max.ToString(ci));
|
||||
output.WriteLine(AmbTemp_min.ToString(ci));
|
||||
output.WriteLine(AmbTemp_max.ToString(ci));
|
||||
|
||||
output.WriteLine(Coef_E9.ToString(ci));
|
||||
output.WriteLine(Coef_E10.ToString(ci));
|
||||
output.WriteLine(Coef_E11.ToString(ci));
|
||||
output.WriteLine(Coef_E12.ToString(ci));
|
||||
output.WriteLine(Offset_E9.ToString(ci));
|
||||
output.WriteLine(Offset_E12.ToString(ci));
|
||||
}
|
||||
|
||||
public static PTest Import(StreamReader input, Profile newProfile)
|
||||
{
|
||||
string firstLine = input.ReadLine();
|
||||
if (string.IsNullOrEmpty(firstLine))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
CultureInfo ci = CultureInfo.InvariantCulture;
|
||||
PTest tst = new PTest();
|
||||
|
||||
tst.Name = firstLine;
|
||||
tst.CoefQfrom = float.Parse(input.ReadLine(), ci);
|
||||
tst.CoefQto = float.Parse(input.ReadLine(), ci);
|
||||
tst.ErrLimLo = float.Parse(input.ReadLine(), ci);
|
||||
tst.ErrLimHi = float.Parse(input.ReadLine(), ci);
|
||||
tst.TempLimLo = float.Parse(input.ReadLine(), ci);
|
||||
tst.TempLimHi = float.Parse(input.ReadLine(), ci);
|
||||
|
||||
/// TODO (E1 .. E21)
|
||||
|
||||
tst.Delta_Q_pct = float.Parse(input.ReadLine(), ci);
|
||||
tst.Delta_T = float.Parse(input.ReadLine(), ci);
|
||||
tst.Delta_Tup_Tdn = float.Parse(input.ReadLine(), ci);
|
||||
tst.TestTime_min = float.Parse(input.ReadLine(), ci);
|
||||
tst.TestTime_max = float.Parse(input.ReadLine(), ci);
|
||||
tst.AmbTemp_min = float.Parse(input.ReadLine(), ci);
|
||||
tst.AmbTemp_max = float.Parse(input.ReadLine(), ci);
|
||||
|
||||
tst.Coef_E9 = float.Parse(input.ReadLine(), ci);
|
||||
tst.Coef_E10 = float.Parse(input.ReadLine(), ci);
|
||||
tst.Coef_E11 = float.Parse(input.ReadLine(), ci);
|
||||
tst.Coef_E12 = float.Parse(input.ReadLine(), ci);
|
||||
tst.Offset_E9 = float.Parse(input.ReadLine(), ci);
|
||||
tst.Offset_E12 = float.Parse(input.ReadLine(), ci);
|
||||
|
||||
tst.Profile = newProfile;
|
||||
return tst;
|
||||
}
|
||||
|
||||
public virtual string Compare(StreamReader inp)
|
||||
{
|
||||
System.Text.StringBuilder diff = new System.Text.StringBuilder();
|
||||
string fmt = string.Format("Test {0} : ", Name) + "{0} = {1}\r\n (in the file {2})\r\n";
|
||||
string ln;
|
||||
CultureInfo ci = CultureInfo.InvariantCulture;
|
||||
|
||||
string firstLine = inp.ReadLine();
|
||||
if (string.IsNullOrEmpty(firstLine)) return string.Format("Test {0} is missing in the file\r\n", Name);
|
||||
|
||||
if (Name != firstLine) { diff.AppendFormat(fmt, "Name", Name, firstLine); };
|
||||
ln = inp.ReadLine(); if (ln != CoefQfrom.ToString(ci)) { diff.AppendFormat(fmt, "CoefQfrom", CoefQfrom.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != CoefQto.ToString(ci)) { diff.AppendFormat(fmt, "CoefQto", CoefQto.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != ErrLimLo.ToString(ci)) { diff.AppendFormat(fmt, "ErrLimLo", ErrLimLo.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != ErrLimHi.ToString(ci)) { diff.AppendFormat(fmt, "ErrLimHi", ErrLimHi.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != TempLimLo.ToString(ci)) { diff.AppendFormat(fmt, "TempLimLo", TempLimLo.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != TempLimHi.ToString(ci)) { diff.AppendFormat(fmt, "TempLimHi", TempLimHi.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != PressLimLo.ToString(ci)) { diff.AppendFormat(fmt, "Pressure_min", TempLimLo.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != PressLimHi.ToString(ci)) { diff.AppendFormat(fmt, "Pressure_max", TempLimHi.ToString(ci), ln); };
|
||||
|
||||
ln = inp.ReadLine(); if (ln != E1.ToString()) { diff.AppendFormat(fmt, "E1", E1.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E2.ToString()) { diff.AppendFormat(fmt, "E2", E2.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E3.ToString()) { diff.AppendFormat(fmt, "E3", E3.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E4.ToString()) { diff.AppendFormat(fmt, "E4", E4.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E5.ToString()) { diff.AppendFormat(fmt, "E5", E5.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E6.ToString()) { diff.AppendFormat(fmt, "E6", E6.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E7.ToString()) { diff.AppendFormat(fmt, "E7", E7.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E8.ToString()) { diff.AppendFormat(fmt, "E8", E8.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E9.ToString()) { diff.AppendFormat(fmt, "E9", E9.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E10.ToString()) { diff.AppendFormat(fmt, "E10", E10.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E11.ToString()) { diff.AppendFormat(fmt, "E11", E11.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E12.ToString()) { diff.AppendFormat(fmt, "E12", E12.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E13.ToString()) { diff.AppendFormat(fmt, "E13", E13.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E14.ToString()) { diff.AppendFormat(fmt, "E14", E14.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E15.ToString()) { diff.AppendFormat(fmt, "E15", E15.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E16.ToString()) { diff.AppendFormat(fmt, "E16", E16.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E21.ToString()) { diff.AppendFormat(fmt, "E21", E21.ToString(), ln); };
|
||||
|
||||
ln = inp.ReadLine(); if (ln != Delta_Q_pct.ToString(ci)) { diff.AppendFormat(fmt, "Delta_Q_pct", Delta_Q_pct.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Delta_T.ToString(ci)) { diff.AppendFormat(fmt, "Delta_T", Delta_T.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Delta_Tup_Tdn.ToString(ci)) { diff.AppendFormat(fmt, "Delta_Tup_Tdn", Delta_Tup_Tdn.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != TestTime_min.ToString(ci)) { diff.AppendFormat(fmt, "TestTime_min", TestTime_min.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != TestTime_max.ToString(ci)) { diff.AppendFormat(fmt, "TestTime_max", TestTime_max.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != AmbTemp_min.ToString(ci)) { diff.AppendFormat(fmt, "AmbTemp_min", AmbTemp_min.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != AmbTemp_max.ToString(ci)) { diff.AppendFormat(fmt, "AmbTemp_max", AmbTemp_max.ToString(ci), ln); };
|
||||
|
||||
ln = inp.ReadLine(); if (ln != Coef_E9.ToString(ci)) { diff.AppendFormat(fmt, "Coef_E9", Coef_E9.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Coef_E10.ToString(ci)) { diff.AppendFormat(fmt, "Coef_E10", Coef_E10.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Coef_E11.ToString(ci)) { diff.AppendFormat(fmt, "Coef_E11", Coef_E11.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Coef_E12.ToString(ci)) { diff.AppendFormat(fmt, "Coef_E12", Coef_E12.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Offset_E9.ToString(ci)) { diff.AppendFormat(fmt, "Offset_E9", Offset_E9.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Offset_E12.ToString(ci)) { diff.AppendFormat(fmt, "Offset_E12", Offset_E12.ToString(ci), ln); };
|
||||
|
||||
return diff.ToString();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
141
Config/Entities/Profile.cs
Normal file
141
Config/Entities/Profile.cs
Normal file
@ -0,0 +1,141 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores one test procedure, supports revisions and history log
|
||||
/// </summary>
|
||||
public class Profile : IHasName, IHasItemNr
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string Description { get; set; } /// Short description
|
||||
public virtual string CreationUser { get; set; } /// Name of the user who has created or changed this procedure
|
||||
public virtual DateTime CreationTime { get; set; } /// Date and time of the creation or change
|
||||
public virtual string LastChgUser { get; set; } /// Name of the user who has created or changed this procedure
|
||||
public virtual DateTime LastChgTime { get; set; } /// Date and time of the creation or change
|
||||
public virtual ProfileType ProfileType { get; set; }
|
||||
|
||||
public virtual IList<PTest> Tests { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
public Profile()
|
||||
{
|
||||
Tests = new List<PTest>();
|
||||
|
||||
///
|
||||
/// Default values
|
||||
///
|
||||
CreationUser = (Users.GlobalData.CurrentUser != null) ? Users.GlobalData.CurrentUser.UserName : null;
|
||||
CreationTime = DateTime.Now;
|
||||
LastChgUser = CreationUser;
|
||||
LastChgTime = CreationTime;
|
||||
Description = string.Empty;
|
||||
}
|
||||
|
||||
public Profile(string name, int itemNr)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
ItemNr = itemNr;
|
||||
}
|
||||
|
||||
public virtual Profile Clone()
|
||||
{
|
||||
Profile result = new Profile();
|
||||
|
||||
result.ItemNr = ItemNr;
|
||||
result.Name = Name;
|
||||
result.Description = Description;
|
||||
result.CreationUser = CreationUser;
|
||||
result.CreationTime = CreationTime;
|
||||
result.LastChgUser = LastChgUser;
|
||||
result.LastChgTime = LastChgTime;
|
||||
result.ProfileType = ProfileType;
|
||||
|
||||
foreach (var test in Tests) { result.Tests.Add(test.Clone()); }
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
{
|
||||
output.WriteLine(ItemNr.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(Name);
|
||||
output.WriteLine(Description);
|
||||
output.WriteLine(CreationUser);
|
||||
output.WriteLine(CreationTime.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(LastChgUser);
|
||||
output.WriteLine(LastChgTime.ToString(CultureInfo.InvariantCulture));
|
||||
|
||||
foreach (var test in Tests) { test.Export(output); }
|
||||
output.WriteLine();
|
||||
|
||||
output.Close();
|
||||
}
|
||||
|
||||
public static Profile Import(StreamReader input)
|
||||
{
|
||||
Profile result = new Profile();
|
||||
|
||||
result.ItemNr = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
result.Name = input.ReadLine();
|
||||
result.Description = input.ReadLine();
|
||||
result.CreationUser = input.ReadLine();
|
||||
result.CreationTime = DateTime.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
result.LastChgUser = input.ReadLine();
|
||||
result.LastChgTime = DateTime.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
string line = input.ReadLine();
|
||||
|
||||
while (true)
|
||||
{
|
||||
PTest tst = PTest.Import(input, result);
|
||||
if (tst == null)
|
||||
break;
|
||||
else
|
||||
result.Tests.Add(tst);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual string Compare(StreamReader inp)
|
||||
{
|
||||
System.Text.StringBuilder diff = new System.Text.StringBuilder();
|
||||
const string fmt = "{0} = {1}\r\n (in the file {2})\r\n";
|
||||
string ln;
|
||||
|
||||
ln = inp.ReadLine(); /// skip ItemNr
|
||||
ln = inp.ReadLine(); if (ln != Name) { diff.AppendFormat(fmt, "Name", Name, ln); };
|
||||
ln = inp.ReadLine(); if (ln != Description) { diff.AppendFormat(fmt, "Description", Description, ln); };
|
||||
ln = inp.ReadLine(); /// skip CreationUser
|
||||
ln = inp.ReadLine(); /// skip CreationTime
|
||||
ln = inp.ReadLine(); /// skip LastChgUser
|
||||
ln = inp.ReadLine(); /// skip LastChgTime
|
||||
|
||||
//foreach (var test in Tests)
|
||||
//{
|
||||
// string testDiff = test.Compare(inp);
|
||||
// if (testDiff.Contains(
|
||||
//}
|
||||
|
||||
//bool extraTestsInFile = true;
|
||||
//while (Test.Import(inp, null) != null) { extraTestsInFile = true; }
|
||||
|
||||
return diff.ToString();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -44,7 +44,7 @@ namespace Config.Entities
|
||||
public virtual int TimePump2StartV { get; set; } /// Delay time from the start of the pump to opening the start valve in [s]
|
||||
public virtual int TimeStop2Mass { get; set; } /// Delay time from the test end (diverted) to the 2nd mass measuremen in [s]
|
||||
public virtual double TolerRed { get; set; } /// = Filter
|
||||
public virtual TestRedType RedType { get; set; }
|
||||
public virtual string RedType { get; set; }
|
||||
public virtual string FeedingPath { get; set; }
|
||||
public virtual string BenchPath { get; set; }
|
||||
public virtual string OutputPath { get; set; }
|
||||
|
||||
57
Config/Mappings/PTestMap.cs
Normal file
57
Config/Mappings/PTestMap.cs
Normal file
@ -0,0 +1,57 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Config.Entities;
|
||||
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class PTestMap : ClassMap<PTest>
|
||||
{
|
||||
public PTestMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.ItemNr);
|
||||
Map(x => x.Name);
|
||||
Map(x => x.CoefQfrom);
|
||||
Map(x => x.CoefQto);
|
||||
Map(x => x.ErrLimLo);
|
||||
Map(x => x.ErrLimHi);
|
||||
Map(x => x.TempLimLo);
|
||||
Map(x => x.TempLimHi);
|
||||
Map(x => x.PressLimLo);
|
||||
Map(x => x.PressLimHi);
|
||||
Map(x => x.E1);
|
||||
Map(x => x.E2);
|
||||
Map(x => x.E3);
|
||||
Map(x => x.E4);
|
||||
Map(x => x.E5);
|
||||
Map(x => x.E6);
|
||||
Map(x => x.E7);
|
||||
Map(x => x.E8);
|
||||
Map(x => x.E9);
|
||||
Map(x => x.E10);
|
||||
Map(x => x.E11);
|
||||
Map(x => x.E12);
|
||||
Map(x => x.E13);
|
||||
Map(x => x.E14);
|
||||
Map(x => x.E15);
|
||||
Map(x => x.E16);
|
||||
Map(x => x.E21);
|
||||
Map(x => x.Delta_Q_pct);
|
||||
Map(x => x.Delta_T);
|
||||
Map(x => x.Delta_Tup_Tdn);
|
||||
Map(x => x.TestTime_min);
|
||||
Map(x => x.TestTime_max);
|
||||
Map(x => x.AmbTemp_min);
|
||||
Map(x => x.AmbTemp_max);
|
||||
Map(x => x.Coef_E9);
|
||||
Map(x => x.Coef_E10);
|
||||
Map(x => x.Coef_E11);
|
||||
Map(x => x.Coef_E12);
|
||||
Map(x => x.Offset_E9);
|
||||
Map(x => x.Offset_E12);
|
||||
References(x => x.Profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
27
Config/Mappings/ProfileMap.cs
Normal file
27
Config/Mappings/ProfileMap.cs
Normal file
@ -0,0 +1,27 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Config.Entities;
|
||||
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class ProfileMap : ClassMap<Profile>
|
||||
{
|
||||
public ProfileMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.ItemNr);
|
||||
Map(x => x.Name);
|
||||
Map(x => x.Description);
|
||||
Map(x => x.CreationUser);
|
||||
Map(x => x.CreationTime);
|
||||
Map(x => x.LastChgUser);
|
||||
Map(x => x.LastChgTime);
|
||||
Map(x => x.ProfileType);
|
||||
HasMany(x => x.Tests)
|
||||
.OrderBy("ItemNr")
|
||||
.Cascade.All();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -48,7 +48,7 @@ namespace Config.Mappings
|
||||
Map(x => x.Uncertainty);
|
||||
Map(x => x.TolerRed)
|
||||
.Column("TolerRed"); /// ???
|
||||
Map(x => x.RedType); /// ???
|
||||
Map(x => x.RedType);
|
||||
Map(x => x.FeedingPath);
|
||||
Map(x => x.BenchPath);
|
||||
Map(x => x.OutputPath);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user