Fix gestione TempiCiclo in sec!
This commit is contained in:
@@ -732,7 +732,7 @@ public static class ThreadsFunctions
|
||||
if (ncAdapter.numericalControl.NC_IsConnected())
|
||||
{
|
||||
// Get new data from PLC (and log if changed...)
|
||||
libraryError = ncAdapter.ReadProdInfoData(out ThermoModels.ProdInfoModel prodInfoData);
|
||||
libraryError = ncAdapter.ReadProdInfoData(out DTOProdInfo prodInfoData);
|
||||
if (libraryError.IsError())
|
||||
ManageLibraryError(libraryError);
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using CMS_CORE_Library.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -6,66 +7,87 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Thermo.Active.Model.DTOModels.ThProd
|
||||
{
|
||||
public class DTOProdInfo
|
||||
public class DTOProdInfo
|
||||
{
|
||||
public DateTime DtEvent { get; set; }
|
||||
public short NumTarget { get; set; } = 0;
|
||||
public short NumDone { get; set; } = 0;
|
||||
public double TimeWarm { get; set; } = 0;
|
||||
public double TimeVent { get; set; } = 0;
|
||||
public double TimeVacuum { get; set; } = 0;
|
||||
public double TimeCycleGross { get; set; } = 0;
|
||||
public double TimeCycleNet { get; set; } = 0;
|
||||
public int NumDec { get; set; } = 1;
|
||||
public int ScaleFactor { get; set; } = 1000;
|
||||
public double MaterialTempEndWarm { get; set; } = 0;
|
||||
public double MaterialTempEndVent { get; set; } = 0;
|
||||
public double MoldTemp { get; set; } = 0;
|
||||
public double VacuumReadVal { get; set; } = 0;
|
||||
public double MouldEnergyOUT { get; set; } = 0;
|
||||
public double MouldEnergyIN { get; set; } = 0;
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
public DateTime DtEvent { get; set; }
|
||||
public short NumTarget { get; set; } = 0;
|
||||
public short NumDone { get; set; } = 0;
|
||||
public double TimeWarm { get; set; } = 0;
|
||||
public double TimeVent { get; set; } = 0;
|
||||
public double TimeVacuum { get; set; } = 0;
|
||||
public double TimeCycleGross { get; set; } = 0;
|
||||
public double TimeCycleNet { get; set; } = 0;
|
||||
public int NumDec { get; set; } = 1;
|
||||
public int ScaleFactor { get; set; } = 1000;
|
||||
public double MaterialTempEndWarm { get; set; } = 0;
|
||||
public double MaterialTempEndVent { get; set; } = 0;
|
||||
public double MoldTemp { get; set; } = 0;
|
||||
public double VacuumReadVal { get; set; } = 0;
|
||||
public double MouldEnergyOUT { get; set; } = 0;
|
||||
public double MouldEnergyIN { get; set; } = 0;
|
||||
// Object is not a GaugeModel instance
|
||||
if (!(obj is DTOProdInfo item))
|
||||
return false;
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
// Object is not a GaugeModel instance
|
||||
if (!(obj is DTOProdInfo item))
|
||||
return false;
|
||||
|
||||
if (DtEvent != item.DtEvent)
|
||||
return false;
|
||||
if (NumTarget != item.NumTarget)
|
||||
return false;
|
||||
if (NumDone != item.NumDone)
|
||||
return false;
|
||||
if (TimeWarm != item.TimeWarm)
|
||||
return false;
|
||||
if (TimeVent != item.TimeVent)
|
||||
return false;
|
||||
if (TimeVacuum != item.TimeVacuum)
|
||||
return false;
|
||||
if (TimeCycleGross != item.TimeCycleGross)
|
||||
return false;
|
||||
if (TimeCycleNet != item.TimeCycleNet)
|
||||
return false;
|
||||
if (MaterialTempEndWarm != item.MaterialTempEndWarm)
|
||||
return false;
|
||||
if (MaterialTempEndVent != item.MaterialTempEndVent)
|
||||
return false;
|
||||
if (MoldTemp != item.MoldTemp)
|
||||
return false;
|
||||
if (VacuumReadVal != item.VacuumReadVal)
|
||||
return false;
|
||||
if (MouldEnergyOUT != item.MouldEnergyOUT)
|
||||
return false;
|
||||
if (MouldEnergyIN != item.MouldEnergyIN)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
if (DtEvent != item.DtEvent)
|
||||
return false;
|
||||
if (NumTarget != item.NumTarget)
|
||||
return false;
|
||||
if (NumDone != item.NumDone)
|
||||
return false;
|
||||
if (TimeWarm != item.TimeWarm)
|
||||
return false;
|
||||
if (TimeVent != item.TimeVent)
|
||||
return false;
|
||||
if (TimeVacuum != item.TimeVacuum)
|
||||
return false;
|
||||
if (TimeCycleGross != item.TimeCycleGross)
|
||||
return false;
|
||||
if (TimeCycleNet != item.TimeCycleNet)
|
||||
return false;
|
||||
if (MaterialTempEndWarm != item.MaterialTempEndWarm)
|
||||
return false;
|
||||
if (MaterialTempEndVent != item.MaterialTempEndVent)
|
||||
return false;
|
||||
if (MoldTemp != item.MoldTemp)
|
||||
return false;
|
||||
if (VacuumReadVal != item.VacuumReadVal)
|
||||
return false;
|
||||
if (MouldEnergyOUT != item.MouldEnergyOUT)
|
||||
return false;
|
||||
if (MouldEnergyIN != item.MouldEnergyIN)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
public DTOProdInfo()
|
||||
{
|
||||
}
|
||||
|
||||
public DTOProdInfo(ThermoModels.ProdInfoModel pimRawData)
|
||||
{
|
||||
this.DtEvent = pimRawData.DtEvent;
|
||||
this.NumDone = pimRawData.NumDone;
|
||||
this.NumTarget = pimRawData.NumTarget;
|
||||
this.TimeCycleGross = (double)pimRawData.TimeCycleGross / this.ScaleFactor;
|
||||
this.TimeCycleNet = (double)pimRawData.TimeCycleNet / this.ScaleFactor;
|
||||
this.TimeVacuum = (double)pimRawData.TimeVacuum / this.ScaleFactor;
|
||||
this.TimeVent = (double)pimRawData.TimeVent / this.ScaleFactor;
|
||||
this.TimeWarm = (double)pimRawData.TimeWarm / this.ScaleFactor;
|
||||
this.MaterialTempEndWarm = pimRawData.MaterialTempEndWarm;
|
||||
this.MaterialTempEndVent = pimRawData.MaterialTempEndVent;
|
||||
this.MoldTemp = pimRawData.MoldTemp;
|
||||
this.VacuumReadVal = pimRawData.VacuumReadVal;
|
||||
this.MouldEnergyIN = pimRawData.MouldEnergyIN;
|
||||
this.MouldEnergyOUT = pimRawData.MouldEnergyOUT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@
|
||||
<Compile Include="DTOModels\DTOAxisNameModel.cs" />
|
||||
<Compile Include="DTOModels\DTOClientConfigurationModel.cs" />
|
||||
<Compile Include="DTOModels\ThModules\DTOModulesBlock.cs" />
|
||||
<Compile Include="DTOModels\ThProd\DTOProdInfo.cs" />
|
||||
<Compile Include="DTOModels\ThProd\DTOThermoPanelProd.cs" />
|
||||
<Compile Include="DTOModels\ThProd\DTOThermoProd.cs" />
|
||||
<Compile Include="DTOModels\ThRecipe\LiveData.cs" />
|
||||
|
||||
@@ -1296,10 +1296,10 @@ namespace Thermo.Active.NC
|
||||
{
|
||||
currentProdPanel.NumDone = lastProdInfoData.NumDone;
|
||||
currentProdPanel.NumTarget = lastProdInfoData.NumTarget;
|
||||
currentProdPanel.LastTCiclo = lastProdInfoData.TimeCycleGross;
|
||||
currentProdPanel.LastTCiclo = (double)lastProdInfoData.TimeCycleGross/1000;
|
||||
if (lastProdInfoData.TimeCycleGross > 0)
|
||||
{
|
||||
currentProdPanel.LastCadenza = (double)3600 / lastProdInfoData.TimeCycleGross;
|
||||
currentProdPanel.LastCadenza = (double)3600000 / lastProdInfoData.TimeCycleGross;
|
||||
}
|
||||
// stima durata da pz fatti...
|
||||
currentProdPanel.StimaDurata = (currentProdPanel.NumTarget - currentProdPanel.NumDone) * currentProdPanel.LastTCiclo;
|
||||
@@ -1324,21 +1324,21 @@ namespace Thermo.Active.NC
|
||||
{
|
||||
if (TS_TC.ContainsKey(item.NumDone))
|
||||
{
|
||||
TS_TC[item.NumDone] = item.TimeCycleGross;
|
||||
TS_TC[item.NumDone] = (double)item.TimeCycleGross/1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
TS_TC.Add(item.NumDone, item.TimeCycleGross);
|
||||
TS_TC.Add(item.NumDone, (double)item.TimeCycleGross/1000);
|
||||
}
|
||||
if (item.TimeCycleGross > 0)
|
||||
{
|
||||
if (TS_Cad.ContainsKey(item.NumDone))
|
||||
{
|
||||
TS_Cad[item.NumDone] = 3600 / item.TimeCycleGross;
|
||||
TS_Cad[item.NumDone] = (double)3600000 / item.TimeCycleGross;
|
||||
}
|
||||
else
|
||||
{
|
||||
TS_Cad.Add(item.NumDone, 3600 / item.TimeCycleGross);
|
||||
TS_Cad.Add(item.NumDone, (double)3600000 / item.TimeCycleGross);
|
||||
}
|
||||
numTcOk++;
|
||||
}
|
||||
@@ -1362,11 +1362,11 @@ namespace Thermo.Active.NC
|
||||
TS_TC[numPz] = TCMedio + (rand.NextDouble() * 4 - 2);
|
||||
if (TS_Cad.ContainsKey(numPz))
|
||||
{
|
||||
TS_Cad[numPz] = 3600 / TS_TC[numPz];
|
||||
TS_Cad[numPz] = (double)3600 / TS_TC[numPz];
|
||||
}
|
||||
else
|
||||
{
|
||||
TS_Cad.Add(numPz, 3600 / TS_TC[numPz]);
|
||||
TS_Cad.Add(numPz, (double)3600 / TS_TC[numPz]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1406,11 +1406,15 @@ namespace Thermo.Active.NC
|
||||
/// <returns></returns>
|
||||
public CmsError ReadProdInfoData(out DTOProdInfo prodInfoData)
|
||||
{
|
||||
prodInfoData = new DTOProdInfo();
|
||||
ThermoModels.ProdInfoModel prodInfoRawData = new ThermoModels.ProdInfoModel();
|
||||
CmsError libraryError = numericalControl.PLC_RProdInfo(ref prodInfoRawData);
|
||||
if (libraryError.IsError())
|
||||
return libraryError;
|
||||
|
||||
// converto 1:1 dati da ThermoModels.ProdInfoModel --> DTOProdInfo
|
||||
prodInfoData = new DTOProdInfo(prodInfoRawData);
|
||||
|
||||
// if lastProdInfo is missing --> populate!
|
||||
if (lastProdInfoData == null)
|
||||
lastProdInfoData = prodInfoRawData;
|
||||
|
||||
@@ -430,7 +430,7 @@ namespace Thermo.Active.Listeners.SignalR
|
||||
}
|
||||
public static void SendThermoProdInfoData(object prodInfoData)
|
||||
{
|
||||
ProdInfoModel currProdInfo = prodInfoData as ProdInfoModel;
|
||||
DTOProdInfo currProdInfo = prodInfoData as DTOProdInfo;
|
||||
|
||||
if (!LastProdInfoData.Equals(currProdInfo))
|
||||
{
|
||||
|
||||
@@ -38,11 +38,9 @@ namespace Thermo.Active.Listeners
|
||||
public static Dictionary<string, double> LastAreaData = new Dictionary<string, double>();
|
||||
public static Dictionary<string, DTOThermoProd> LastLiveProdData = new Dictionary<string, DTOThermoProd>();
|
||||
public static ThermoModels.ProdCycleModel LastProdCycleData = new ThermoModels.ProdCycleModel();
|
||||
public static ThermoModels.ProdInfoModel LastProdInfoData = new ThermoModels.ProdInfoModel();
|
||||
public static DTOProdInfo LastProdInfoData = new DTOProdInfo();
|
||||
public static DTOThermoPanelProd LastProdPanelData = new DTOThermoPanelProd();
|
||||
|
||||
|
||||
public static bool LastIsNcConnected = false;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -30,4 +30,4 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("0.9.34")]
|
||||
[assembly: AssemblyVersion("0.9.35")]
|
||||
Reference in New Issue
Block a user