Fix read/write status/command area THermoCam

This commit is contained in:
Samuele Locatelli
2020-10-27 12:17:30 +01:00
parent 3bc768121e
commit d26fcefdc4
3 changed files with 64 additions and 1 deletions
+21
View File
@@ -450,6 +450,27 @@ namespace CMS_CORE_Library.Models
#endregion Methods
}
/// <summary>
/// ThermoCam management data
/// </summary>
public class ThermoCam
{
/// <summary>
/// Opzione ThermoCamera (set by PLC)
/// </summary>
public bool ThermoOptionActive { get; set; } = false;
/// <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>
/// Warmers channel data
/// </summary>
public class WarmerChannel
{
+7 -1
View File
@@ -272,7 +272,7 @@ namespace CMS_CORE_Library
public abstract CmsError NC_GetTranslatedPlcMessages(string language, ref Dictionary<int, string> messages);
public abstract CmsError NC_GetTranslatedThermoLabels(string language, ref Dictionary<string, string> messages);
public abstract CmsError NC_GetTranslatedThermoLabels(string language, ref Dictionary<string, string> messages);
public abstract CmsError NC_GetAvailableLanguages(ref ICollection<CultureInfo> languages);
@@ -672,6 +672,12 @@ namespace CMS_CORE_Library
/// <returns></returns>
public abstract CmsError PLC_RModulesBlockList(bool onlyRT, ref Dictionary<int, ThermoModels.ModuleBlock> currModulesBlockList);
/// <summary>
/// Get current Warmers ThermoCam Data
/// </summary>
/// <param name="currTCamData"></param>
/// <returns></returns>
public abstract CmsError PLC_RWarmerTCamData(out ThermoModels.ThermoCam currTCamData);
/// <summary>
/// Get current Warmers Channels list
/// </summary>
/// <param name="useCache">updates only READ parameters (false = update all data)</param>
+36
View File
@@ -61,6 +61,7 @@ namespace CMS_CORE_Library.S7Net
private static Dictionary<int, ThermoModels.WarmerChannel> ThermoWarmChannels = new Dictionary<int, ThermoModels.WarmerChannel>();
private static ThermoModels.ProdInfoModel ThermoProdInfo = new ThermoModels.ProdInfoModel();
private static ThermoModels.ProdCycleModel ThermoProdCycle = new ThermoModels.ProdCycleModel();
private static ThermoModels.ThermoCam ThermoCamData = new ThermoModels.ThermoCam();
// connessione S7
private CpuType tipoCpu = CpuType.S71500;
@@ -2343,6 +2344,41 @@ namespace CMS_CORE_Library.S7Net
return NO_ERROR;
}
/// <summary>
/// Get current Warmers ThermoCam Data
/// </summary>
/// <param name="currTCamData"></param>
/// <returns></returns>
public override CmsError PLC_RWarmerTCamData(out ThermoModels.ThermoCam currTCamData)
{
// init...
bool currValue = false;
currTCamData = new ThermoModels.ThermoCam();
// leggo da PLC singoli bit...
CmsError libraryError = MEM_RWBoolean(R, true, 0, TCAM_STATW_DATA.MemType, TCAM_STATW_DATA.Address, TCAM_STATW_DATA.SubAddress, 0, ref currValue);
if (libraryError.IsError())
return libraryError;
ThermoCamData.ThermoOptionActive = currValue;
libraryError = MEM_RWBoolean(R, true, 0, TCAM_COMMW_DATA.MemType, TCAM_COMMW_DATA.Address, TCAM_COMMW_DATA.SubAddress, 0, ref currValue);
if (libraryError.IsError())
return libraryError;
ThermoCamData.ThermoCamMode = currValue;
libraryError = MEM_RWBoolean(R, true, 0, TCAM_COMMW_DATA.MemType, TCAM_COMMW_DATA.Address, TCAM_COMMW_DATA.SubAddress, 1, ref currValue);
if (libraryError.IsError())
return libraryError;
ThermoCamData.ThermoCamOnOff = currValue;
// restituisce status dei parametri termocamera (in cache...)
currTCamData = ThermoCamData;
return libraryError;
}
/// <summary>
/// Get current Warmers Channels list
/// </summary>
/// <param name="useCache">updates only READ parameters (false = update all data)</param>