From 4911353eb1b82bf7b99384ab3d08bd6544d74acf Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 27 Oct 2020 15:08:49 +0100 Subject: [PATCH 1/2] reset dati ThermoCam alla rich iesta conf Risc da PLC --- Thermo.Active.NC/NcAdapter.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Thermo.Active.NC/NcAdapter.cs b/Thermo.Active.NC/NcAdapter.cs index 08bc0939..07ca7d28 100644 --- a/Thermo.Active.NC/NcAdapter.cs +++ b/Thermo.Active.NC/NcAdapter.cs @@ -2960,10 +2960,20 @@ namespace Thermo.Active.NC if (libraryError.IsError()) return libraryError; - - // FIXME TODO completare con altre aree conf thermoCam da recipe - - + // scrivo altre info della parte warmers da ricetta (resetto temperature actual, set riferimento, abilitazione canali, boolean...) + numericalControl.PLC_WTCamMode(false); + numericalControl.PLC_WTCamActiv(false); + Dictionary resetTCamEnab = new Dictionary(); + Dictionary resetTCamTemp = new Dictionary(); + foreach (var item in RecipeLiveData.ChannelTCamEnab) + { + resetTCamEnab.Add(item.Key, false); + resetTCamTemp.Add(item.Key, 0); + } + numericalControl.PLC_WWarmerChTCamEnab(resetTCamEnab); + numericalControl.PLC_WWarmerChTCamTempAct(resetTCamTemp); + numericalControl.PLC_WWarmerChTCamTempSet(resetTCamTemp); + // esce return libraryError; } From 61b94daf2892857619651717c9d84392476d70b8 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 27 Oct 2020 15:51:32 +0100 Subject: [PATCH 2/2] primo giro load/save ThermoCamData --- .../Controllers/WebApi/RecipeController.cs | 48 ++++++++++++++++++- Thermo.Active/Properties/AssemblyInfo.cs | 2 +- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/Thermo.Active/Controllers/WebApi/RecipeController.cs b/Thermo.Active/Controllers/WebApi/RecipeController.cs index 1cd02047..f26737ca 100644 --- a/Thermo.Active/Controllers/WebApi/RecipeController.cs +++ b/Thermo.Active/Controllers/WebApi/RecipeController.cs @@ -725,7 +725,7 @@ namespace Thermo.Active.Controllers.WebApi newRisk.Add(item.Key, item.Value); } - // write to PLC + // write to PLC SetPointHMI (%) checkError = ncAdapter.WriteRecipeWarmChSetpHMI(newRisk); if (checkError.IsError()) { @@ -733,6 +733,52 @@ namespace Thermo.Active.Controllers.WebApi return checkError; } + // Disable Thermocam Mode + OnOff + checkError = ncAdapter.SetTCamMode(false); + if (checkError.IsError()) + { + ThermoActiveLogger.LogError($"WriteCurrentRecipeToPlc | SetTCamMode error | {checkError.exception}"); + return checkError; + } + checkError = ncAdapter.SetTCamActiv(false); + if (checkError.IsError()) + { + ThermoActiveLogger.LogError($"WriteCurrentRecipeToPlc | SetTCamActiv error | {checkError.exception}"); + return checkError; + } + + // write to PLC TempRif (°C) + checkError = ncAdapter.WriteRecipeWarmChTCamTempSet(NcAdapter.RecipeLiveData.ChannelTCamTempReq); + if (checkError.IsError()) + { + ThermoActiveLogger.LogError($"WriteCurrentRecipeToPlc | WriteRecipeWarmChTCamTempSet error | {checkError.exception}"); + return checkError; + } + + // write to PLC TCamChEnab + checkError = ncAdapter.WriteRecipeWarmChTCamEnab(NcAdapter.RecipeLiveData.ChannelTCamEnab); + if (checkError.IsError()) + { + ThermoActiveLogger.LogError($"WriteCurrentRecipeToPlc | WriteRecipeWarmChTCamEnab error | {checkError.exception}"); + return checkError; + } + + // reset ActTemp + Dictionary resetTCamTemp = new Dictionary(); + foreach (var item in NcAdapter.RecipeLiveData.ChannelTCamEnab) + { + resetTCamTemp.Add(item.Key, 0); + } + checkError = ncAdapter.WriteRecipeWarmChTCamTempAct(resetTCamTemp); + if (checkError.IsError()) + { + ThermoActiveLogger.LogError($"WriteCurrentRecipeToPlc | WriteRecipeWarmChTCamTempAct error | {checkError.exception}"); + return checkError; + } + + + + // enable recipe! scrivo sul PLC il comando conferma! libraryError = ncAdapter.ConfirmRecipeData(true); if (libraryError.IsError()) diff --git a/Thermo.Active/Properties/AssemblyInfo.cs b/Thermo.Active/Properties/AssemblyInfo.cs index 7727fd23..f6a392b5 100644 --- a/Thermo.Active/Properties/AssemblyInfo.cs +++ b/Thermo.Active/Properties/AssemblyInfo.cs @@ -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.108.135")] \ No newline at end of file +[assembly: AssemblyVersion("0.108.136")] \ No newline at end of file