Fix balluf double writing

Added baluff option
Added balluf cleat tablet
This commit is contained in:
luciomaranta
2020-06-25 13:01:49 +02:00
parent f532680641
commit 2533be1e62
7 changed files with 59 additions and 9 deletions
+6
View File
@@ -3412,6 +3412,12 @@ namespace CMS_CORE_Library.Demo
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError TOOLS_WClearBallufTablet(ushort magazineId, ushort positionId, ushort toolId)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
#endregion ToolTable
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+5
View File
@@ -3807,6 +3807,11 @@ namespace CMS_CORE_Library.Fanuc
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError TOOLS_WClearBallufTablet(ushort magazineId, ushort positionId, ushort toolId)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
#endregion Siemens Tools Management
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -516,6 +516,7 @@ namespace CMS_CORE_Library.Models
LOAD = 1,
UNLOAD = 2,
NEW_DATA = 3,
DELETE_TABLET = 90,
ABORT = 99
}
@@ -233,6 +233,8 @@ namespace CMS_CORE_Library.Models
public bool RadiusMetricType;
public bool LifeOption;
public bool SiemensBallufOption;
public List<SiemensMagazineConfigModel> Magazines;
public List<FieldsConfiguration> ToolsConfiguration;
public FamiliesConfiguration FamiliesConfiguration;
+3
View File
@@ -1835,6 +1835,9 @@ namespace CMS_CORE_Library
public abstract CmsError TOOLS_WAbortBallufTablet();
public abstract CmsError TOOLS_WClearBallufTablet(ushort magazineId, ushort positionId, ushort toolId);
#endregion Tool Table Siemens
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+6
View File
@@ -3663,6 +3663,12 @@ namespace CMS_CORE_Library.Osai
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError TOOLS_WClearBallufTablet(ushort magazineId, ushort positionId, ushort toolId)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
#endregion Siemens Tools Management
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+36 -9
View File
@@ -96,6 +96,7 @@ namespace CMS_CORE_Library.Siemens
private static bool LIFE_OPTION_ACTIVE;
private static bool MULTITOOL_OPTION_ACTIVE;
private static bool BALLUF_OPTION_IS_ACTIVE;
private const string PLC_MESSAGES_FILE_PATH = "C:\\Program Files (x86)\\Siemens\\MotionControl\\oem\\sinumerik\\hmi\\lng\\";
private static readonly string AXES_FILE_PATH = AppDomain.CurrentDomain.BaseDirectory + "\\Config\\axesConfig.xml";
@@ -424,6 +425,9 @@ namespace CMS_CORE_Library.Siemens
Array.Clear(toolsStrings, 0, toolsStrings.Count());
itemToRead = new Item("/NC/_N_CH_TEA_ACX/$MCS_TM_FUNCTION_MASK");
dataSvc.Read(itemToRead);
BALLUF_OPTION_IS_ACTIVE = Convert.ToInt32(itemToRead.Value) == 0x30D ? false : true;
//// Subscribe to multitools number
//DataSvc d = new DataSvc();
//Item i = new Item() { Path = "/Tool/MTCatalogue/numMultiTools[u1]" };
@@ -3760,6 +3764,8 @@ namespace CMS_CORE_Library.Siemens
config.MagazinePosConfiguration = SiemensMagazinePosFieldsConfig;
config.EdgesConfiguration = SiemensEdgesFieldsConfiguration;
config.SiemensBallufOption = BALLUF_OPTION_IS_ACTIVE;
config.EdgesConfiguration.EdgesAdditionalParamsConfiguration = new Dictionary<int, List<string>>();
// Remove path and set only names as additionalParams
foreach (int key in Add_Edges_Param_Config.EdgesConfig.Keys)
@@ -4816,26 +4822,26 @@ namespace CMS_CORE_Library.Siemens
{
items.AddRange(new List<Item>()
{
new Item() { Path = string.Format("DB{0}.DBD186", BALLUF_EMPTY_TABLE.Address), Value = edge.ResidualLife }, // MOP2
new Item() { Path = string.Format("DB{0}.DBD194", BALLUF_EMPTY_TABLE.Address), Value = edge.NominalLife }, // MOP11
new Item() { Path = string.Format("DB{0}.DBD182", BALLUF_EMPTY_TABLE.Address), Value = edge.PreAlmLife } // MOP1
new Item() { Path = string.Format("DB{0}.DBD186", BALLUF_EMPTY_TABLE.Address), Value = GetSiemensFormattedDouble(edge.ResidualLife) }, // MOP2
new Item() { Path = string.Format("DB{0}.DBD194", BALLUF_EMPTY_TABLE.Address), Value = GetSiemensFormattedDouble(edge.NominalLife) }, // MOP11
new Item() { Path = string.Format("DB{0}.DBD182", BALLUF_EMPTY_TABLE.Address), Value = GetSiemensFormattedDouble(edge.PreAlmLife) } // MOP1
});
}
break;
case SIEMENS_LIFE_TYPE.COUNT:
{
items.Add(new Item() { Path = string.Format("DB{0}.DBW192", BALLUF_EMPTY_TABLE.Address), Value = edge.ResidualLife }); // MOP4
items.Add(new Item() { Path = string.Format("DB{0}.DBW198", BALLUF_EMPTY_TABLE.Address), Value = edge.NominalLife }); // MOP13
items.Add(new Item() { Path = string.Format("DB{0}.DBW190", BALLUF_EMPTY_TABLE.Address), Value = edge.PreAlmLife }); // MOP3
items.Add(new Item() { Path = string.Format("DB{0}.DBW192", BALLUF_EMPTY_TABLE.Address), Value = GetSiemensFormattedDouble(edge.ResidualLife) }); // MOP4
items.Add(new Item() { Path = string.Format("DB{0}.DBW198", BALLUF_EMPTY_TABLE.Address), Value = GetSiemensFormattedDouble(edge.NominalLife) }); // MOP13
items.Add(new Item() { Path = string.Format("DB{0}.DBW190", BALLUF_EMPTY_TABLE.Address), Value = GetSiemensFormattedDouble(edge.PreAlmLife) }); // MOP3
}
break;
case SIEMENS_LIFE_TYPE.WEAR:
{
items.Add(new Item() { Path = string.Format("DB{0}.DBD204", BALLUF_EMPTY_TABLE.Address), Value = edge.ResidualLife }); // MOP6
items.Add(new Item() { Path = string.Format("DB{0}.DBD208", BALLUF_EMPTY_TABLE.Address), Value = edge.NominalLife }); // MOP15
items.Add(new Item() { Path = string.Format("DB{0}.DBD200", BALLUF_EMPTY_TABLE.Address), Value = edge.PreAlmLife }); // MOP5
items.Add(new Item() { Path = string.Format("DB{0}.DBD204", BALLUF_EMPTY_TABLE.Address), Value = GetSiemensFormattedDouble(edge.ResidualLife) }); // MOP6
items.Add(new Item() { Path = string.Format("DB{0}.DBD208", BALLUF_EMPTY_TABLE.Address), Value = GetSiemensFormattedDouble(edge.NominalLife) }); // MOP15
items.Add(new Item() { Path = string.Format("DB{0}.DBD200", BALLUF_EMPTY_TABLE.Address), Value = GetSiemensFormattedDouble(edge.PreAlmLife) }); // MOP5
}
break;
}
@@ -4864,6 +4870,27 @@ namespace CMS_CORE_Library.Siemens
return WBallufAction(SIEMENS_TDI_ACTION.ABORT);
}
public override CmsError TOOLS_WClearBallufTablet(ushort magazineId, ushort positionId, ushort toolId)
{
var mountedTool = MagazineMountedTools.Where(x => x.ToolId == toolId).FirstOrDefault();
if (mountedTool == null || (mountedTool.ToolId != toolId && mountedTool.PositionId != positionId))
return INCORRECT_PARAMETERS_ERROR;
List<ushort> words = new List<ushort>()
{
(ushort)(((int)SIEMENS_TDI_ACTION.UNLOAD << 8) + positionId),
magazineId,
toolId
};
CmsError cmsError = MEM_RWWordList(W, 1, BALLUF_ACTION_DATA.MemType, BALLUF_ACTION_DATA.Address, BALLUF_ACTION_DATA.SubAddress, 2, ref words);
if (cmsError.IsError())
return cmsError;
return WBallufAction(SIEMENS_TDI_ACTION.DELETE_TABLET);
}
private CmsError WBallufAction(SIEMENS_TDI_ACTION action)
{
byte act = (byte)action;