diff --git a/CMS_CORE_Library/Demo/Nc_Demo.cs b/CMS_CORE_Library/Demo/Nc_Demo.cs index e220010..c84a605 100644 --- a/CMS_CORE_Library/Demo/Nc_Demo.cs +++ b/CMS_CORE_Library/Demo/Nc_Demo.cs @@ -932,6 +932,16 @@ namespace CMS_CORE_Library.Demo return NO_ERROR; } + public override CmsError PLC_RM157Data(ref List value) + { + return NO_ERROR; + } + + public override CmsError PLC_WM157Timer(int process, ushort timerVal) + { + return NO_ERROR; + } + public override CmsError PLC_RScadaValue(string memIndex, SCADA_MEM_TYPE memType, ref object value) { if (memType == SCADA_MEM_TYPE.BOOL) diff --git a/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs b/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs index e9d1b2e..f1b1c63 100644 --- a/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs +++ b/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs @@ -1146,6 +1146,16 @@ namespace CMS_CORE_Library.Fanuc return PLC_WStrobe(M156_INPUT_ACK, M156_INPUT_STROBE, (uint)process); } + public override CmsError PLC_RM157Data(ref List value) + { + return NO_ERROR; + } + + public override CmsError PLC_WM157Timer(int process, ushort timerVal) + { + return NO_ERROR; + } + private CmsError WriteMacroValue(int processId, int memIndex, double val) { int num = 1; diff --git a/CMS_CORE_Library/Models/DataStructures.cs b/CMS_CORE_Library/Models/DataStructures.cs index ad38b3e..0badc0d 100644 --- a/CMS_CORE_Library/Models/DataStructures.cs +++ b/CMS_CORE_Library/Models/DataStructures.cs @@ -330,6 +330,14 @@ namespace CMS_CORE_Library.Models public double Value; } + public class M157InputModel + { + public uint Process; + public ushort Timer; + public bool CountdownIsActive; + public bool TimerInputNeeded; + } + public struct M154DataModel { public uint Process; diff --git a/CMS_CORE_Library/Nc.cs b/CMS_CORE_Library/Nc.cs index a25b878..66f62d6 100644 --- a/CMS_CORE_Library/Nc.cs +++ b/CMS_CORE_Library/Nc.cs @@ -583,6 +583,10 @@ namespace CMS_CORE_Library public abstract CmsError PLC_WM156Response(int process, double responseVal); + public abstract CmsError PLC_RM157Data(ref List value); + + public abstract CmsError PLC_WM157Timer(int process, ushort timerVal); + public abstract CmsError PLC_RScadaValue(string memIndex, SCADA_MEM_TYPE memType, ref object value); public abstract CmsError PLC_WScadaValue(string memIndex, SCADA_MEM_TYPE memType, object value); diff --git a/CMS_CORE_Library/Osai/Nc_Osai.cs b/CMS_CORE_Library/Osai/Nc_Osai.cs index 6ab5803..c266791 100644 --- a/CMS_CORE_Library/Osai/Nc_Osai.cs +++ b/CMS_CORE_Library/Osai/Nc_Osai.cs @@ -1144,6 +1144,68 @@ namespace CMS_CORE_Library.Osai return PLC_WStrobe(M156_INPUT_ACK, M156_INPUT_STROBE, (uint)process); } + + + public override CmsError PLC_RM157Data(ref List value) + { + byte dataAreNeeded = 0; + CmsError cmsError = MEM_RWByte(R, 0, M157_INPUT_NEEDED.MemType, M157_INPUT_NEEDED.Address, 0, ref dataAreNeeded); + if (cmsError.IsError()) + return cmsError; + + byte countdownActive = 0; + cmsError = MEM_RWByte(R, 0, M157_INPUT_COUNTDOWN_ACTIVE.MemType, M157_INPUT_COUNTDOWN_ACTIVE.Address, 0, ref countdownActive); + if (cmsError.IsError()) + return cmsError; + + List timerValues = new List(); + + cmsError = MEM_RWWordList(R, 0, M157_TIMER.MemType, M157_TIMER.Address, M157_TIMER.Address, M157_TIMER.Size / 2, ref timerValues); + if (cmsError.IsError()) + return cmsError; + + bool[] dataNeededArray = ByteToBits(dataAreNeeded); + bool[] countdownActiveNeeded = ByteToBits(countdownActive); + + for (int processId = 1; processId <= MAX_PROCESS_NUMBER; processId++) + { + // check if modal to choose date has to be shown + if (dataNeededArray[processId - 1]) + { + value.Add(new M157InputModel() + { + Process = (uint)processId, + TimerInputNeeded = true, + CountdownIsActive = false, + Timer = 0 + }); ; + } + else if (countdownActiveNeeded[processId - 1]) + { + // check if timeout modal has to be shown + value.Add(new M157InputModel() + { + Process = (uint)processId, + TimerInputNeeded = false, + CountdownIsActive = true, + Timer = timerValues[processId - 1] + }); ; + } + } + + return NO_ERROR; + } + + + public override CmsError PLC_WM157Timer(int process, ushort timerVal) + { + CmsError cmsError = MEM_RWWord(W, 0, MEMORY_TYPE.Osai_GD, M156_RESPONSE_MEMORY + (process - 1), ref timerVal); + if (cmsError.IsError()) + return cmsError; + + return PLC_WStrobe(M157_INPUT_ACK, M157_INPUT_STROBE, (uint)process); + } + public override CmsError PLC_RM154Data(ref List data, ref bool MTCOnOff) { MTCOnOff = false; @@ -2398,12 +2460,13 @@ namespace CMS_CORE_Library.Osai // Filter per master axes and process if ((charName < 'a' || charName > 'z') && charName != 'S' && charName != '\0' && axesProcess[i] == process) { + var isVisible = ids.Where(x => x == i + 1)?.FirstOrDefault() == 0 ? false : true; // Add to returned value axesData.Add(new AxisModel() { Id = i + 1, Name = charName.ToString(), - IsSelectable = ids.Where(x => x == i + 1)?.FirstOrDefault() == 0 ? false : true + IsSelectable = true }); } } @@ -5087,6 +5150,12 @@ namespace CMS_CORE_Library.Osai internal static MEMORY_CELL M156_INPUT_STROBE = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4337, 1); internal static MEMORY_CELL M156_INPUT_ID_LIST = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4338, 8); + internal static MEMORY_CELL M157_INPUT_NEEDED = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4343, 1); + internal static MEMORY_CELL M157_INPUT_COUNTDOWN_ACTIVE = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4345, 1); + internal static MEMORY_CELL M157_INPUT_ACK = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4347, 1); + internal static MEMORY_CELL M157_INPUT_STROBE = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4337, 1); + internal static MEMORY_CELL M157_TIMER = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4338, 8); + internal static int M156_RESPONSE_MEMORY = 910; internal static MEMORY_CELL M154_SWITCH_ONOFF = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 4000, 1, 2); diff --git a/CMS_CORE_Library/Siemens/Nc_Siemens.cs b/CMS_CORE_Library/Siemens/Nc_Siemens.cs index ea0d2ac..4f5660b 100644 --- a/CMS_CORE_Library/Siemens/Nc_Siemens.cs +++ b/CMS_CORE_Library/Siemens/Nc_Siemens.cs @@ -191,7 +191,7 @@ namespace CMS_CORE_Library.Siemens // Check connection Item item = new Item("DB258.DBX0.0"); - DataSvc svc = new DataSvc(); + DataSvc svc = HighPriorityDataSvc(); svc.Read(item); Connected = true; @@ -1573,6 +1573,16 @@ namespace CMS_CORE_Library.Siemens return PLC_WStrobe(M156_INPUT_ACK, M156_INPUT_STROBE, (uint)process); } + public override CmsError PLC_RM157Data(ref List value) + { + return NO_ERROR; + } + + public override CmsError PLC_WM157Timer(int process, ushort timerVal) + { + return NO_ERROR; + } + public override CmsError PLC_RScadaValue(string memIndex, SCADA_MEM_TYPE memType, ref object value) { if (memType == SCADA_MEM_TYPE.BOOL)