diff --git a/CMS_CORE_Library/Models/ThermoModels.cs b/CMS_CORE_Library/Models/ThermoModels.cs index 84ccf7e..d742a4b 100644 --- a/CMS_CORE_Library/Models/ThermoModels.cs +++ b/CMS_CORE_Library/Models/ThermoModels.cs @@ -136,9 +136,11 @@ namespace CMS_CORE_Library.Models public class AxisInfo { public short Id { get; set; } = 0; - public int errorCode { get; set; } = 0; - public int movPhase { get; set; } = 0; - public int statusCode { get; set; } = 0; + public int ErrorCode { get; set; } = 0; + public int MovPhase { get; set; } = 0; + public int StatusWord { get; set; } = 0; + public int ControlWord { get; set; } = 0; + public double TargetPos { get; set; } = 0; public override bool Equals(object obj) { @@ -148,11 +150,15 @@ namespace CMS_CORE_Library.Models if (Id != item.Id) return false; - if (errorCode != item.errorCode) + if (ErrorCode != item.ErrorCode) return false; - if (movPhase != item.movPhase) + if (MovPhase != item.MovPhase) return false; - if (statusCode != item.statusCode) + if (StatusWord != item.StatusWord) + return false; + if (ControlWord != item.ControlWord) + return false; + if (TargetPos != item.TargetPos) return false; return true; } diff --git a/CMS_CORE_Library/NcThermo.cs b/CMS_CORE_Library/NcThermo.cs index 88d3e5c..3480140 100644 --- a/CMS_CORE_Library/NcThermo.cs +++ b/CMS_CORE_Library/NcThermo.cs @@ -626,6 +626,18 @@ namespace CMS_CORE_Library /// public abstract CmsError PLC_WAckPzProdEnd(); + /// + /// Get current Axis RT data + /// + /// + /// + public abstract CmsError PLC_RAxisRTList(ref Dictionary currAxisRT); + /// + /// Get current Axis Info data + /// + /// + /// + public abstract CmsError PLC_RAxisInfoList(ref Dictionary currAxisInfo); /// /// Get current recipe parameter list /// diff --git a/CMS_CORE_Library/S7Net/Nc_S7Net.cs b/CMS_CORE_Library/S7Net/Nc_S7Net.cs index 31b18e4..3c39db1 100644 --- a/CMS_CORE_Library/S7Net/Nc_S7Net.cs +++ b/CMS_CORE_Library/S7Net/Nc_S7Net.cs @@ -2073,6 +2073,120 @@ namespace CMS_CORE_Library.S7Net return libraryError; } + /// + /// Get current Axis RT data + /// + /// + /// + public override CmsError PLC_RAxisRTList(ref Dictionary currAxisRT) + { + CmsError libraryError = NO_ERROR; +#if false + CmsError libraryError = NO_ERROR; + List currMem = new List(); + int packSize = 8; + + // leggo da PLC a array di byte di appoggio... + libraryError = MEM_RWByteList(R, 0, PARAMETER_RT_DATA.MemType, PARAMETER_RT_DATA.Address, PARAMETER_RT_DATA.SubAddress, 0, PARAMETER_RT_DATA.Size, ref currMem); + if (libraryError.IsError()) + return libraryError; + + // controllo SE ho dati... + if (currMem.Count > 0) + { + // converto a blocchi di 8 byte... + byte[] memArray = currMem.ToArray(); + for (int i = 0; i < PARAMETER_RT_DATA.Size / packSize; i++) + { + PlcParamRT currParam = new PlcParamRT(memArray.Skip(i * packSize).Take(packSize).ToArray()); + // solo se ID > 0... + if (currParam.Id > 0) + { + // update oggetto thermoParamList... + if (ThermoParamList.ContainsKey(currParam.Id)) + { + try + { + ThermoParamList[currParam.Id].Enabled = currParam.Enabled; + ThermoParamList[currParam.Id].HasError = currParam.HasError; + ThermoParamList[currParam.Id].Visible = currParam.Visible; + ThermoParamList[currParam.Id].ValueAct = currParam.ValueAct; + } + catch + { } + } + else + { + try + { + ThermoParamList.Add(currParam.Id, new ThermoModels.RecipeParam() { Id = currParam.Id, Enabled = currParam.Enabled, HasError = currParam.HasError, Visible = currParam.Visible, ValueAct = currParam.ValueAct }); + } + catch + { } + } + } + } + } +#endif + return libraryError; + } + /// + /// Get current Axis Info data + /// + /// + /// + public override CmsError PLC_RAxisInfoList(ref Dictionary currAxisInfo) + { + CmsError libraryError = NO_ERROR; +#if false + CmsError libraryError = NO_ERROR; + List currMem = new List(); + int packSize = 8; + + // leggo da PLC a array di byte di appoggio... + libraryError = MEM_RWByteList(R, 0, PARAMETER_RT_DATA.MemType, PARAMETER_RT_DATA.Address, PARAMETER_RT_DATA.SubAddress, 0, PARAMETER_RT_DATA.Size, ref currMem); + if (libraryError.IsError()) + return libraryError; + + // controllo SE ho dati... + if (currMem.Count > 0) + { + // converto a blocchi di 8 byte... + byte[] memArray = currMem.ToArray(); + for (int i = 0; i < PARAMETER_RT_DATA.Size / packSize; i++) + { + PlcParamRT currParam = new PlcParamRT(memArray.Skip(i * packSize).Take(packSize).ToArray()); + // solo se ID > 0... + if (currParam.Id > 0) + { + // update oggetto thermoParamList... + if (ThermoParamList.ContainsKey(currParam.Id)) + { + try + { + ThermoParamList[currParam.Id].Enabled = currParam.Enabled; + ThermoParamList[currParam.Id].HasError = currParam.HasError; + ThermoParamList[currParam.Id].Visible = currParam.Visible; + ThermoParamList[currParam.Id].ValueAct = currParam.ValueAct; + } + catch + { } + } + else + { + try + { + ThermoParamList.Add(currParam.Id, new ThermoModels.RecipeParam() { Id = currParam.Id, Enabled = currParam.Enabled, HasError = currParam.HasError, Visible = currParam.Visible, ValueAct = currParam.ValueAct }); + } + catch + { } + } + } + } + } +#endif + return libraryError; + } /// /// read current recipe parameter list ///