From 636032419e546784eb29059056c028f0acda8b48 Mon Sep 17 00:00:00 2001 From: Nicola Carminati Date: Mon, 1 Apr 2019 15:05:07 +0000 Subject: [PATCH] Added Working time on Heads --- CMS_CORE_Application/Form1.cs | 5 +++++ CMS_CORE_Library/Demo/Nc_Demo.cs | 4 ++-- CMS_CORE_Library/Fanuc/Nc_Fanuc.cs | 12 +++++++++++- CMS_CORE_Library/Models/DataStructures.cs | 1 + 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CMS_CORE_Application/Form1.cs b/CMS_CORE_Application/Form1.cs index f693831..c5ce8a7 100644 --- a/CMS_CORE_Application/Form1.cs +++ b/CMS_CORE_Application/Form1.cs @@ -69,6 +69,7 @@ namespace CMS_CORE_Application PreAndPostPowerOnModel powerOn = new PreAndPostPowerOnModel(); List ncAlarms = new List(); List Lines = new List(); + List < HeadDataModel> Heads = new List(); N = SetNcByType(); @@ -100,6 +101,10 @@ namespace CMS_CORE_Application cmsError = N.NC_RDateTime(ref NcTime); if (cmsError.IsError()) { error = true; SetError(Lines, cmsError); } + cmsError = N.PLC_RHeadsData(Heads,3); + if (cmsError.IsError()) { error = true; SetError(Lines, cmsError); } + + cmsError = N.NC_RSerialNumber(ref serial); if (cmsError.IsError()){ error = true; SetError(Lines, cmsError); } Dictionary dictionary = new Dictionary(); diff --git a/CMS_CORE_Library/Demo/Nc_Demo.cs b/CMS_CORE_Library/Demo/Nc_Demo.cs index f85a645..de73768 100644 --- a/CMS_CORE_Library/Demo/Nc_Demo.cs +++ b/CMS_CORE_Library/Demo/Nc_Demo.cs @@ -3467,8 +3467,8 @@ namespace CMS_CORE_Library.Demo internal static MEMORY_CELL ASSISTED_TOOLING_FINAL_VALUE = new MEMORY_CELL(MEMORY_TYPE.Demo, 469, 1); internal static MEMORY_CELL UNIT_OF_MEASURE = new MEMORY_CELL(MEMORY_TYPE.Demo, 470, 1); - internal static MEMORY_CELL EXP_CANDY_MEM = new MEMORY_CELL(MEMORY_TYPE.Demo, 472, 1); - internal static MEMORY_CELL CANDY_MEM = new MEMORY_CELL(MEMORY_TYPE.Demo, 471, 1); + internal static MEMORY_CELL EXP_CANDY_MEM = new MEMORY_CELL(MEMORY_TYPE.Demo, 471, 1); + internal static MEMORY_CELL CANDY_MEM = new MEMORY_CELL(MEMORY_TYPE.Demo, 472, 1); } diff --git a/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs b/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs index 0c137ce..b0a8770 100644 --- a/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs +++ b/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs @@ -791,6 +791,7 @@ namespace CMS_CORE_Library.Fanuc heads.Clear(); List readInts = new List(); + List readHours = new List(); List readValues = new List(); // Find the size of a single head int headsByte = (HEADS_DATA.Size / MAX_HEADS_NUMBER); @@ -802,6 +803,11 @@ namespace CMS_CORE_Library.Fanuc return cmsError; readValues = readInts.SelectMany(BitConverter.GetBytes).ToList(); + // Read Worked time heads + cmsError = MEM_RWDWordList(R, 0, HEADS_WORKED_TIMES.MemType, HEADS_WORKED_TIMES.Address, number, ref readHours); + if (cmsError.IsError()) + return cmsError; + // Parse and format read data for (int i = 0; i < number; i++) { @@ -819,7 +825,8 @@ namespace CMS_CORE_Library.Fanuc IsSelected = (readValues[headOffset + 10] & 2) != 0, // bit 1 OverrideEditable = (readValues[headOffset + 10] & 4) != 0, // bit 2 Configured = (readValues[headOffset + 10] & 8) != 0, // bit 3 - Rotation = (readValues[headOffset + 10] & 16) == 0 ? ROTATION.CLOCKWHISE : ROTATION.COUNTERCLOCKWHISE // bit 4 + Rotation = (readValues[headOffset + 10] & 16) == 0 ? ROTATION.CLOCKWHISE : ROTATION.COUNTERCLOCKWHISE, // bit 4 + WorkedTime = readHours[i] }); } @@ -4618,5 +4625,8 @@ namespace CMS_CORE_Library.Fanuc internal static MEMORY_CELL FAMILY_TABLE_INDEX = new MEMORY_CELL(MEMORY_TYPE.Fanuc_D, 17000, 7500); internal static MEMORY_CELL SHANK_TABLE_INDEX = new MEMORY_CELL(MEMORY_TYPE.Fanuc_D, 24600, 3300); internal static MEMORY_CELL MAG_POS_TABLE_INDEX = new MEMORY_CELL(MEMORY_TYPE.Fanuc_D, 28000, 1200); + + //old variables + internal static MEMORY_CELL HEADS_WORKED_TIMES = new MEMORY_CELL(MEMORY_TYPE.Fanuc_D, 3060, 4); } } \ No newline at end of file diff --git a/CMS_CORE_Library/Models/DataStructures.cs b/CMS_CORE_Library/Models/DataStructures.cs index f149f16..d16d60d 100644 --- a/CMS_CORE_Library/Models/DataStructures.cs +++ b/CMS_CORE_Library/Models/DataStructures.cs @@ -353,6 +353,7 @@ namespace CMS_CORE_Library.Models public bool Configured; public ROTATION Rotation; + public uint WorkedTime; public ToolInSpindleModel Tool; }