From 6186932563ac5d5a94adff6eaee6d8efcfde8c0c Mon Sep 17 00:00:00 2001 From: luciomaranta Date: Tue, 14 Jul 2020 09:15:18 +0200 Subject: [PATCH 1/2] Fix siemens multiprocess --- CMS_CORE_Library/Siemens/Nc_Siemens.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CMS_CORE_Library/Siemens/Nc_Siemens.cs b/CMS_CORE_Library/Siemens/Nc_Siemens.cs index 30d8bb2..572a6c1 100644 --- a/CMS_CORE_Library/Siemens/Nc_Siemens.cs +++ b/CMS_CORE_Library/Siemens/Nc_Siemens.cs @@ -279,7 +279,7 @@ namespace CMS_CORE_Library.Siemens { // Clean listener AxesSvc.UnSubscribe(ManageAxes); - + //AxesData = new List(); if (SelectedProcess > 0) { List axesConf = new List(); @@ -2305,7 +2305,7 @@ namespace CMS_CORE_Library.Siemens int readValue = 0; // Read processes status from memory - cmsError = MEM_RWInteger(R, 0, PROCESS_STATUS.MemType, PROCESS_STATUS.Address, PROCESS_STATUS.SubAddress + ((procNumber - 1) * 2), ref readValue); + cmsError = MEM_RWInteger(R, 0, PROCESS_STATUS.MemType, PROCESS_STATUS.Address, PROCESS_STATUS.SubAddress + ((procNumber - 1) * 4), ref readValue); if (cmsError.IsError()) return cmsError; @@ -2378,7 +2378,7 @@ namespace CMS_CORE_Library.Siemens return INCORRECT_PARAMETERS_ERROR; // Write process number - cmsError = MEM_RWByte(W, 0, SELECT_PROCESS.MemType, SELECT_PROCESS.Address, SELECT_PROCESS.SubAddress, ref processNum); + cmsError = MEM_RWByte(W, 0, SELECT_PROCESS.MemType, SELECT_PROCESS.Address, SELECT_PROCESS.SubAddress + 1, 0, ref processNum); if (cmsError.IsError()) return cmsError; @@ -2693,6 +2693,7 @@ namespace CMS_CORE_Library.Siemens CmsError cmsError = CheckConnection(); if (cmsError.IsError()) return cmsError; + List configuredAxes = new List(); Item[] ncAxes = new Item[MAX_AXES_FOR_PROCESS * 3]; @@ -2758,7 +2759,7 @@ namespace CMS_CORE_Library.Siemens return cmsError; // Remove not visible axes - axesData = axesData.Where(x => ids.Contains((byte)x.Id)).ToList(); + axesData = AxesData.Where(x => ids.Contains((byte)x.Id)).ToList(); // Set to true (old compatibility) foreach (var axis in axesData) @@ -2778,7 +2779,7 @@ namespace CMS_CORE_Library.Siemens // } //} - axesData = AxesData; + //axesData = AxesData; } catch (Exception ex) { From 2e59c6f2fe17f9dba3e377a375483a3c319298a9 Mon Sep 17 00:00:00 2001 From: luciomaranta Date: Thu, 16 Jul 2020 11:57:14 +0200 Subject: [PATCH 2/2] Fix osai comunication --- CMS_CORE_Library/Osai/Nc_Osai.cs | 6 +++--- CMS_CORE_Library/Siemens/Nc_Siemens.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMS_CORE_Library/Osai/Nc_Osai.cs b/CMS_CORE_Library/Osai/Nc_Osai.cs index 7aed046..072ca2c 100644 --- a/CMS_CORE_Library/Osai/Nc_Osai.cs +++ b/CMS_CORE_Library/Osai/Nc_Osai.cs @@ -110,12 +110,12 @@ namespace CMS_CORE_Library.Osai HttpBinding.MaxReceivedMessageSize = int.MaxValue; HttpBinding.MaxBufferPoolSize = int.MaxValue; - //Open the connection - OpenNC = new OPENcontrolPortTypeClient(HttpBinding, endPointAddress); - //Try to get information try { + + //Open the connection + OpenNC = new OPENcontrolPortTypeClient(HttpBinding, endPointAddress); //Try to retireve the NC-Status nReturn = OpenNC.BootPhaseEnquiry(out CNCPhase, out uint errorClass, out uint errorNum); diff --git a/CMS_CORE_Library/Siemens/Nc_Siemens.cs b/CMS_CORE_Library/Siemens/Nc_Siemens.cs index 572a6c1..bf9141e 100644 --- a/CMS_CORE_Library/Siemens/Nc_Siemens.cs +++ b/CMS_CORE_Library/Siemens/Nc_Siemens.cs @@ -2721,7 +2721,7 @@ namespace CMS_CORE_Library.Siemens DataSvc svcData = new DataSvc(); bool[] axesAreVisible = new bool[MAX_AXES_FOR_PROCESS]; - // Read from Nc + // Setup data to be readed for (int i = 1; i <= MAX_AXES_FOR_PROCESS; i++) { // Set the path to read on which process is the axis