FIX modelli conf x thermo prod

This commit is contained in:
Samuele E. Locatelli
2021-02-17 19:54:37 +01:00
parent 5972e97530
commit 72b6815b49
2 changed files with 4950 additions and 4815 deletions
+223 -186
View File
@@ -6,22 +6,20 @@ namespace CMS_CORE_Library.Models
{
public class ThermoModels
{
#region Fields
#region Protected Fields
protected const double EPSILON = 0.1;
#endregion Fields
#endregion Protected Fields
#region Classes
#region Public Classes
/// <summary>
/// Single AXIS Info Data
/// </summary>
public class AxisInfo
{
#region Properties
#region Public Properties
public int ControlWord { get; set; } = 0;
public int ErrorCode { get; set; } = 0;
@@ -30,9 +28,9 @@ namespace CMS_CORE_Library.Models
public int StatusWord { get; set; } = 0;
public double TargetPos { get; set; } = 0;
#endregion Properties
#endregion Public Properties
#region Methods
#region Public Methods
public override bool Equals(object obj)
{
@@ -54,13 +52,13 @@ namespace CMS_CORE_Library.Models
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Methods
#endregion Public Methods
}
/// <summary>
@@ -68,8 +66,7 @@ namespace CMS_CORE_Library.Models
/// </summary>
public class AxisRT
{
#region Constructors
#region Public Constructors
/// <summary>
/// Deserializzazione da byte ad oggetto AxisRT
@@ -84,18 +81,18 @@ namespace CMS_CORE_Library.Models
Load = S7.Net.Types.Double.FromByteArray(rawData.Skip(8).Take(4).ToArray());
}
#endregion Constructors
#endregion Public Constructors
#region Properties
#region Public Properties
public int Id { get; set; } = 0;
public double Load { get; set; } = 0;
public double Position { get; set; } = 0;
public double Speed { get; set; } = 0;
#endregion Properties
#endregion Public Properties
#region Methods
#region Public Methods
/// <summary>
/// Converte un singolo item in un array di byte per scrittura su PLC S7
@@ -126,13 +123,165 @@ namespace CMS_CORE_Library.Models
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Methods
#endregion Public Methods
}
/// <summary>
/// Represent IO Channel FORCED by UI
/// </summary>
public class ChanIOFor
{
#region Public Properties
public Dictionary<int, bool> AO { get; set; } = new Dictionary<int, bool>();
public Dictionary<int, bool> DO { get; set; } = new Dictionary<int, bool>();
#endregion Public Properties
#region Public Methods
public override bool Equals(object obj)
{
if (!(obj is ChanIOVis item))
return false;
if (!DO.Equals(item.DO))
return false;
if (!AO.Equals(item.AO))
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Public Methods
}
/// <summary>
/// Represent IO Channel Values
/// </summary>
public class ChanIOVal
{
#region Public Properties
public Dictionary<int, int> AI { get; set; } = new Dictionary<int, int>();
public Dictionary<int, int> AO { get; set; } = new Dictionary<int, int>();
public Dictionary<int, bool> DI { get; set; } = new Dictionary<int, bool>();
public Dictionary<int, bool> DO { get; set; } = new Dictionary<int, bool>();
#endregion Public Properties
#region Public Methods
public override bool Equals(object obj)
{
if (!(obj is ChanIOVal item))
return false;
if (!DI.Equals(item.DI))
return false;
if (!DO.Equals(item.DO))
return false;
if (!AI.Equals(item.AI))
return false;
if (!AO.Equals(item.AO))
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Public Methods
}
/// <summary>
/// Represent IO Channel FORCED values
/// </summary>
public class ChanIOValFor
{
#region Public Properties
public Dictionary<int, int> AO { get; set; } = new Dictionary<int, int>();
public Dictionary<int, bool> DO { get; set; } = new Dictionary<int, bool>();
#endregion Public Properties
#region Public Methods
public override bool Equals(object obj)
{
if (!(obj is ChanIOVal item))
return false;
if (!DO.Equals(item.DO))
return false;
if (!AO.Equals(item.AO))
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Public Methods
}
/// <summary>
/// Represent IO Channel visibility
/// </summary>
public class ChanIOVis
{
#region Public Properties
public Dictionary<int, bool> AI { get; set; } = new Dictionary<int, bool>();
public Dictionary<int, bool> AO { get; set; } = new Dictionary<int, bool>();
public Dictionary<int, bool> DI { get; set; } = new Dictionary<int, bool>();
public Dictionary<int, bool> DO { get; set; } = new Dictionary<int, bool>();
#endregion Public Properties
#region Public Methods
public override bool Equals(object obj)
{
if (!(obj is ChanIOVis item))
return false;
if (!DI.Equals(item.DI))
return false;
if (!DO.Equals(item.DO))
return false;
if (!AI.Equals(item.AI))
return false;
if (!AO.Equals(item.AO))
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Public Methods
}
/// <summary>
@@ -140,17 +289,16 @@ namespace CMS_CORE_Library.Models
/// </summary>
public class LiveProdDataModel
{
#region Properties
#region Public Properties
public double Air { get; set; } = 0;
public double Power { get; set; } = 0;
public double TimeAdv { get; set; } = 0;
public double Vacuum { get; set; } = 0;
#endregion Properties
#endregion Public Properties
#region Methods
#region Public Methods
public override bool Equals(object obj)
{
@@ -178,15 +326,12 @@ namespace CMS_CORE_Library.Models
return base.GetHashCode();
}
#endregion Methods
#endregion Public Methods
}
public class ModuleBlock
{
#region Properties
#region Public Properties
public int ActualDelay { get; set; } = 0;
public int ActualDuration { get; set; } = 0;
@@ -199,9 +344,9 @@ namespace CMS_CORE_Library.Models
public bool Terminated { get; set; } = false;
public bool Visible { get; set; } = false;
#endregion Properties
#endregion Public Properties
#region Methods
#region Public Methods
public override bool Equals(object obj)
{
@@ -232,19 +377,18 @@ namespace CMS_CORE_Library.Models
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Methods
#endregion Public Methods
}
public class ProdCycleModel
{
#region Properties
#region Public Properties
public ushort MessageId { get; set; } = 0;
public ushort Mode { get; set; } = 0;
@@ -252,9 +396,9 @@ namespace CMS_CORE_Library.Models
public ushort Submode { get; set; } = 0;
public uint TimeAdv { get; set; } = 0;
#endregion Properties
#endregion Public Properties
#region Methods
#region Public Methods
public override bool Equals(object obj)
{
@@ -275,41 +419,41 @@ namespace CMS_CORE_Library.Models
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Methods
#endregion Public Methods
}
public class ProdInfoModel
{
#region Properties
#region Public Properties
public DateTime DtEvent { get; set; } = DateTime.Now;
public bool IsScrap { get; set; } = false;
public double MaterialTempEndVent { get; set; } = 0;
public double MaterialTempEndWarm { get; set; } = 0;
public double MoldTemp { get; set; } = 0;
public double MouldEnergyIN { get; set; } = 0;
public double MouldEnergyOUT { get; set; } = 0;
public float MaterialTempEndVent { get; set; } = 0;
public float MaterialTempEndWarm { get; set; } = 0;
public float MoldTemp { get; set; } = 0;
public float MouldEnergyIN { get; set; } = 0;
public float MouldEnergyOUT { get; set; } = 0;
public short NumDone { get; set; } = 0;
public short NumPreHot { get; set; } = 0;
public short NumTarget { get; set; } = 0;
public short PreWarmCycle { get; set; } = 0;
public string ThermoImage { get; set; } = "";
public int TimeCycleGross { get; set; } = 0;
public int TimeCycleNet { get; set; } = 0;
public int TimeVacuum { get; set; } = 0;
public int TimeVent { get; set; } = 0;
public int TimeWarm { get; set; } = 0;
public double VacuumReadVal { get; set; } = 0;
public float VacuumReadVal { get; set; } = 0;
#endregion Properties
#endregion Public Properties
#region Methods
#region Public Methods
/// <summary>
/// Converte un singolo item in un array di byte per scrittura su PLC S7
@@ -326,12 +470,12 @@ namespace CMS_CORE_Library.Models
Buffer.BlockCopy(S7.Net.Types.DInt.ToByteArray(TimeVacuum), 0, answ, 14, 4);
Buffer.BlockCopy(S7.Net.Types.DInt.ToByteArray(TimeCycleGross), 0, answ, 18, 4);
Buffer.BlockCopy(S7.Net.Types.DInt.ToByteArray(TimeCycleNet), 0, answ, 22, 4);
Buffer.BlockCopy(S7.Net.Types.Double.ToByteArray(MaterialTempEndWarm), 0, answ, 26, 4);
Buffer.BlockCopy(S7.Net.Types.Double.ToByteArray(MaterialTempEndVent), 0, answ, 30, 4);
Buffer.BlockCopy(S7.Net.Types.Double.ToByteArray(MoldTemp), 0, answ, 34, 4);
Buffer.BlockCopy(S7.Net.Types.Double.ToByteArray(VacuumReadVal), 0, answ, 38, 4);
Buffer.BlockCopy(S7.Net.Types.Double.ToByteArray(MouldEnergyOUT), 0, answ, 42, 4);
Buffer.BlockCopy(S7.Net.Types.Double.ToByteArray(MouldEnergyIN), 0, answ, 46, 4);
Buffer.BlockCopy(S7.Net.Types.Real.ToByteArray(MaterialTempEndWarm), 0, answ, 26, 4);
Buffer.BlockCopy(S7.Net.Types.Real.ToByteArray(MaterialTempEndVent), 0, answ, 30, 4);
Buffer.BlockCopy(S7.Net.Types.Real.ToByteArray(MoldTemp), 0, answ, 34, 4);
Buffer.BlockCopy(S7.Net.Types.Real.ToByteArray(VacuumReadVal), 0, answ, 38, 4);
Buffer.BlockCopy(S7.Net.Types.Real.ToByteArray(MouldEnergyOUT), 0, answ, 42, 4);
Buffer.BlockCopy(S7.Net.Types.Real.ToByteArray(MouldEnergyIN), 0, answ, 46, 4);
return answ;
}
@@ -349,6 +493,8 @@ namespace CMS_CORE_Library.Models
return false;
if (PreWarmCycle != item.PreWarmCycle)
return false;
if (ThermoImage != item.ThermoImage)
return false;
if (TimeWarm != item.TimeWarm)
return false;
if (TimeVent != item.TimeVent)
@@ -378,126 +524,13 @@ namespace CMS_CORE_Library.Models
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Methods
}
/// <summary>
/// Represent IO Channel visibility
/// </summary>
public class ChanIOVis
{
public Dictionary<int, bool> DI { get; set; } = new Dictionary<int, bool>();
public Dictionary<int, bool> DO { get; set; } = new Dictionary<int, bool>();
public Dictionary<int, bool> AI { get; set; } = new Dictionary<int, bool>();
public Dictionary<int, bool> AO { get; set; } = new Dictionary<int, bool>();
public override bool Equals(object obj)
{
if (!(obj is ChanIOVis item))
return false;
if (!DI.Equals(item.DI))
return false;
if (!DO.Equals(item.DO))
return false;
if (!AI.Equals(item.AI))
return false;
if (!AO.Equals(item.AO))
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
}
/// <summary>
/// Represent IO Channel Values
/// </summary>
public class ChanIOVal
{
public Dictionary<int, bool> DI { get; set; } = new Dictionary<int, bool>();
public Dictionary<int, bool> DO { get; set; } = new Dictionary<int, bool>();
public Dictionary<int, int> AI { get; set; } = new Dictionary<int, int>();
public Dictionary<int, int> AO { get; set; } = new Dictionary<int, int>();
public override bool Equals(object obj)
{
if (!(obj is ChanIOVal item))
return false;
if (!DI.Equals(item.DI))
return false;
if (!DO.Equals(item.DO))
return false;
if (!AI.Equals(item.AI))
return false;
if (!AO.Equals(item.AO))
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
}
/// <summary>
/// Represent IO Channel FORCED by UI
/// </summary>
public class ChanIOFor
{
public Dictionary<int, bool> DO { get; set; } = new Dictionary<int, bool>();
public Dictionary<int, bool> AO { get; set; } = new Dictionary<int, bool>();
public override bool Equals(object obj)
{
if (!(obj is ChanIOVis item))
return false;
if (!DO.Equals(item.DO))
return false;
if (!AO.Equals(item.AO))
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
}
/// <summary>
/// Represent IO Channel FORCED values
/// </summary>
public class ChanIOValFor
{
public Dictionary<int, bool> DO { get; set; } = new Dictionary<int, bool>();
public Dictionary<int, int> AO { get; set; } = new Dictionary<int, int>();
public override bool Equals(object obj)
{
if (!(obj is ChanIOVal item))
return false;
if (!DO.Equals(item.DO))
return false;
if (!AO.Equals(item.AO))
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Public Methods
}
/// <summary>
@@ -505,8 +538,7 @@ namespace CMS_CORE_Library.Models
/// </summary>
public class RecipeParam
{
#region Properties
#region Public Properties
public bool Enabled { get; set; } = false;
public bool HasError { get; set; } = false;
@@ -520,9 +552,9 @@ namespace CMS_CORE_Library.Models
public double ValueAct { get; set; } = 0;
public bool Visible { get; set; } = false;
#endregion Properties
#endregion Public Properties
#region Methods
#region Public Methods
public override bool Equals(object obj)
{
@@ -555,39 +587,46 @@ namespace CMS_CORE_Library.Models
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Methods
#endregion Public Methods
}
/// <summary>
/// ThermoCam management data
/// </summary>
public class ThermoCam
{
/// <summary>
/// Opzione ThermoCamera (set by PLC)
/// </summary>
public bool ThermoOptionActive { get; set; } = false;
#region Public Properties
/// <summary>
/// Modalità ThermoCamera (set by HMI)
/// </summary>
public bool ThermoCamMode { get; set; } = false;
/// <summary>
/// Funzionamento ThermoCamera (set by HMI)
/// </summary>
public bool ThermoCamOnOff { get; set; } = false;
/// <summary>
/// Opzione ThermoCamera (set by PLC)
/// </summary>
public bool ThermoOptionActive { get; set; } = false;
#endregion Public Properties
}
/// <summary>
/// Warmers channel data
/// </summary>
public class WarmerChannel
{
#region Properties
#region Public Properties
/// <summary>
/// Channel status
@@ -644,9 +683,9 @@ namespace CMS_CORE_Library.Models
/// </summary>
public short TCamTempSet { get; set; } = 0;
#endregion Properties
#endregion Public Properties
#region Methods
#region Public Methods
/// <summary>
/// Equality test for class object
@@ -690,11 +729,9 @@ namespace CMS_CORE_Library.Models
return base.GetHashCode();
}
#endregion Methods
#endregion Public Methods
}
#endregion Classes
#endregion Public Classes
}
}
}
File diff suppressed because it is too large Load Diff