Continuing warmers & recipe fix & config

This commit is contained in:
Samuele Locatelli
2020-06-09 19:13:57 +02:00
parent bdc0ce1aa5
commit 6d52ccdc9c
3 changed files with 48 additions and 7 deletions
+3 -7
View File
@@ -713,13 +713,12 @@ public static class ThreadsFunctions
// Check if client is connected
if (ncAdapter.numericalControl.NC_IsConnected())
{
// Get new data from PLC
libraryError = ncAdapter.ReadProdInfoData(out ThermoModels.ProdInfoModel prodInfoData);
if (libraryError.IsError())
ManageLibraryError(libraryError);
MessageServices.Current.Publish(SEND_THERMO_PROD_INFO_DATA, null, prodInfoData);
MessageServices.Current.Publish(SEND_THERMO_PROD_INFO_DATA, null, prodInfoData);
}
else
RestoreConnection();
@@ -756,15 +755,12 @@ public static class ThreadsFunctions
// Check if client is connected
if (ncAdapter.numericalControl.NC_IsConnected())
{
#if false
// Get new data from PLC
libraryError = ncAdapter.ReadProdCycle(out ThermoModels.GaugeModel gaugeData);
libraryError = ncAdapter.ReadProdCycleData(out ThermoModels.ProdCycleModel prodCycleData);
if (libraryError.IsError())
ManageLibraryError(libraryError);
MessageServices.Current.Publish(SEND_THERMO_GAUGE_DATA, null, gaugeData);
#endif
MessageServices.Current.Publish(SEND_THERMO_PROD_CYCLE_DATA, null, prodCycleData);
}
else
RestoreConnection();
@@ -35,5 +35,6 @@ namespace Thermo.Active.Model.ConfigModels
public int SetpointRecipe;
public int SetpointThermo;
public int MaxPower;
//public int MinCurrent;
}
}
+44
View File
@@ -1240,6 +1240,48 @@ namespace Thermo.Active.NC
return NO_ERROR;
}
/// <summary>
/// Vero metodo lettura Warmers data da memoria PLC
/// </summary>
/// <param name="currentWarmers"></param>
/// <returns></returns>
public CmsError ReadWarmersData(out Dictionary<int, DTOWarmers> currentWarmers)
{
// init obj
currentWarmers = new Dictionary<int, DTOWarmers>();
// solo x S7...
if (NcConfig.NcVendor == NC_VENDOR.S7NET)
{
CmsError cmsError = NO_ERROR;
// leggo stato ricetta da PLC
Dictionary<int, ThermoModels.WarmerChannel> currPlcWarmers = new Dictionary<int, ThermoModels.WarmerChannel>();
cmsError = numericalControl.PLC_RWarmerChannelList(ref currPlcWarmers);
if (cmsError.IsError())
return cmsError;
// compongo con il resto delle info da config... do x scontato di avere TUTIT i 1024 channels
List<DTOWarmers> warmersConfig = RiskChannelConfig.Select(x => new DTOWarmers()
{
IdChannel = x.IdChannel,
IdReflector= x.IdReflector,
SetpointRecipe = x.SetpointRecipe,
SetpointTermocam = 0, // FIXME TODO x.SetpointTer,
SetpointPLC = currPlcWarmers[x.IdChannel].SetpointPLC,
ChannelStatus = currPlcWarmers[x.IdChannel].ChStatus,
ActualCurrent = currPlcWarmers[x.IdChannel].CurrAct,
ActualPerc = currPlcWarmers[x.IdChannel].PercAct,
MaxPower = x.MaxPower
}).ToList();
}
else
{
currentWarmers = new Dictionary<int, DTOWarmers>();
}
return NO_ERROR;
}
/// <summary>
/// Recipe Parameters write to PLC (only SetpointHMI)
/// </summary>
/// <param name="updtRecipe"></param>
@@ -1278,6 +1320,8 @@ namespace Thermo.Active.NC
}
public CmsError ReadNcScada(ScadaSchemaModel scadaSchema, out DTOScadaModel scadaValue)
{
//ReadScadaDataSiemens(scadaSchema, out scadaValue);