WIP Tool Movement
WIP new exception manager WIP m156
This commit is contained in:
@@ -131,12 +131,11 @@ namespace CMS_CORE_Application
|
||||
{ error = true; SetError(Lines, cmsError); }
|
||||
}
|
||||
|
||||
ToolMovementModel mov = new ToolMovementModel();
|
||||
MovementBetweenMagazinesModel mov = new MovementBetweenMagazinesModel();
|
||||
cmsError = N.PLC_RToolMovement(ref mov);
|
||||
if (cmsError.IsError()) { error = true; SetError(Lines, cmsError); }
|
||||
|
||||
|
||||
N.PLC_WTerminateMovementProcedure(MOVEMENT_RESPONSE.OK);
|
||||
N.NC_Connect();
|
||||
|
||||
sw.Stop();
|
||||
Console.WriteLine("TEMPO PER FUNZIONE " + sw.ElapsedMilliseconds);
|
||||
|
||||
@@ -357,7 +357,16 @@ namespace CMS_CORE_Library.Demo
|
||||
|
||||
public override CmsError PLC_RWManageWatchdog()
|
||||
{
|
||||
return NO_ERROR;
|
||||
bool plcWatchdog = false;
|
||||
CmsError cmsError = MEM_RWBoolean(R, 0, NC_WATCHDOG.MemType, NC_WATCHDOG.Address, 0, ref plcWatchdog);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
if (plcWatchdog)
|
||||
return PLC_NOT_RUNNING_ERROR;
|
||||
|
||||
plcWatchdog = true;
|
||||
return MEM_RWBoolean(W, 0, NC_WATCHDOG.MemType, NC_WATCHDOG.Address, 0, ref plcWatchdog);
|
||||
}
|
||||
|
||||
public override CmsError PLC_RActiveMessages(ref List<PlcAlarmModel> alarms)
|
||||
@@ -923,6 +932,20 @@ namespace CMS_CORE_Library.Demo
|
||||
|
||||
public override CmsError PLC_RScadaValue(string memIndex, SCADA_MEM_TYPE memType, ref object value)
|
||||
{
|
||||
if (memType == SCADA_MEM_TYPE.BOOL)
|
||||
{
|
||||
if (memIndex.ToUpper() == "FALSE")
|
||||
{
|
||||
value = false;
|
||||
return NO_ERROR;
|
||||
}
|
||||
else if (memIndex.ToUpper() == "TRUE")
|
||||
{
|
||||
value = true;
|
||||
return NO_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
string[] index = memIndex.Split('.');
|
||||
|
||||
if (index.Count() == 0)
|
||||
@@ -1258,7 +1281,7 @@ namespace CMS_CORE_Library.Demo
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError PLC_RToolMovement(ref ToolMovementModel toolMovement)
|
||||
public override CmsError PLC_RToolMovement(ref MovementBetweenMagazinesModel toolMovement)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
@@ -3556,7 +3579,7 @@ namespace CMS_CORE_Library.Demo
|
||||
return NOT_CONNECTED_ERROR;
|
||||
}
|
||||
else
|
||||
return CmsError.InternalError(ex.Message);
|
||||
return CmsError.InternalError(ex.Message, ex);
|
||||
}
|
||||
|
||||
//Check Bit In Range
|
||||
@@ -3605,6 +3628,7 @@ namespace CMS_CORE_Library.Demo
|
||||
{
|
||||
internal const int STARTING_ADDRESS = 0;
|
||||
|
||||
internal static MEMORY_CELL NC_WATCHDOG = new MEMORY_CELL(MEMORY_TYPE.Demo, 0, 1);
|
||||
internal static MEMORY_CELL FUNCTION_ACCESS = new MEMORY_CELL(MEMORY_TYPE.Demo, 13, 8);
|
||||
|
||||
internal static MEMORY_CELL PRE_POWER_ON = new MEMORY_CELL(MEMORY_TYPE.Demo, 21, 1);
|
||||
|
||||
@@ -558,7 +558,7 @@ namespace CMS_CORE_Library.Fanuc
|
||||
public override CmsError PLC_RWManageWatchdog()
|
||||
{
|
||||
bool plcWatchdog = false;
|
||||
CmsError cmsError = MEM_RWBoolean(R, 0, NC_WATCHDOG.MemType, NC_WATCHDOG.Address, 1, ref plcWatchdog);
|
||||
CmsError cmsError = MEM_RWBoolean(R, 0, NC_WATCHDOG.MemType, NC_WATCHDOG.Address, 0, ref plcWatchdog);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
@@ -566,7 +566,7 @@ namespace CMS_CORE_Library.Fanuc
|
||||
return PLC_NOT_RUNNING_ERROR;
|
||||
|
||||
plcWatchdog = true;
|
||||
return MEM_RWBoolean(W, 0, NC_WATCHDOG.MemType, NC_WATCHDOG.Address, 1, ref plcWatchdog);
|
||||
return MEM_RWBoolean(W, 0, NC_WATCHDOG.MemType, NC_WATCHDOG.Address, 0, ref plcWatchdog);
|
||||
}
|
||||
|
||||
// Get PMC Messages
|
||||
@@ -1524,7 +1524,7 @@ namespace CMS_CORE_Library.Fanuc
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError PLC_RToolMovement(ref ToolMovementModel toolMovement)
|
||||
public override CmsError PLC_RToolMovement(ref MovementBetweenMagazinesModel toolMovement)
|
||||
{
|
||||
List<ushort> values = new List<ushort>();
|
||||
CmsError cmsError = MEM_RWWordList(R, 0, TOOL_MOVEMENT_AREA.MemType, TOOL_MOVEMENT_AREA.Address, TOOL_MOVEMENT_AREA.Size/2, ref values);
|
||||
@@ -1533,7 +1533,7 @@ namespace CMS_CORE_Library.Fanuc
|
||||
|
||||
if (GetBitValue(values[0], 8))
|
||||
{
|
||||
toolMovement = new ToolMovementModel()
|
||||
toolMovement = new MovementBetweenMagazinesModel()
|
||||
{
|
||||
NewMagazineId = values[1],
|
||||
NewPositionId = values[2],
|
||||
@@ -1546,7 +1546,6 @@ namespace CMS_CORE_Library.Fanuc
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
public override CmsError PLC_WTerminateMovementProcedure(MOVEMENT_RESPONSE resp)
|
||||
{
|
||||
byte val = (byte)resp;
|
||||
@@ -3306,7 +3305,7 @@ namespace CMS_CORE_Library.Fanuc
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return CmsError.InternalError(ex.Message);
|
||||
return CmsError.InternalError(ex.Message, ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -3323,7 +3322,7 @@ namespace CMS_CORE_Library.Fanuc
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return CmsError.InternalError(ex.Message);
|
||||
return CmsError.InternalError(ex.Message, ex);
|
||||
}
|
||||
|
||||
return WritePartProgramContent(partProgramPath, partProgramContent);
|
||||
@@ -5303,7 +5302,7 @@ namespace CMS_CORE_Library.Fanuc
|
||||
{
|
||||
Connected = false;
|
||||
|
||||
return CmsError.InternalError(ex.Message);
|
||||
return CmsError.InternalError(ex.Message, ex);
|
||||
}
|
||||
|
||||
// Convert the internal error in a readable-String error
|
||||
@@ -5426,7 +5425,7 @@ namespace CMS_CORE_Library.Fanuc
|
||||
internal static MEMORY_CELL M156_INPUT_ID_LIST = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 23056, 8);
|
||||
|
||||
internal static int M155_RESPONSE_MEMORY = 955;
|
||||
internal static int M156_RESPONSE_MEMORY = 956;
|
||||
internal static int M156_RESPONSE_MEMORY = 954;
|
||||
|
||||
internal static MEMORY_CELL AXES_BUTTON_VISIBLE = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, STARTING_ADDRESS + 3033, 16);
|
||||
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
namespace CMS_CORE_Library.Models
|
||||
using System;
|
||||
|
||||
namespace CMS_CORE_Library.Models
|
||||
{
|
||||
public class CmsError
|
||||
{
|
||||
public CMS_ERROR_CODES errorCode;
|
||||
public string localizationKey;
|
||||
public Exception exception;
|
||||
|
||||
public CmsError(CMS_ERROR_CODES errorCode, string message, Exception exception)
|
||||
{
|
||||
this.errorCode = errorCode;
|
||||
this.localizationKey = message;
|
||||
this.exception = exception;
|
||||
}
|
||||
|
||||
public CmsError(CMS_ERROR_CODES errorCode, string message)
|
||||
{
|
||||
@@ -19,9 +29,9 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
public static CmsError InternalError(string message)
|
||||
public static CmsError InternalError(string message, Exception exception)
|
||||
{
|
||||
return new CmsError(CMS_ERROR_CODES.INTERNAL_ERROR, message);
|
||||
return new CmsError(CMS_ERROR_CODES.INTERNAL_ERROR, message, exception);
|
||||
}
|
||||
|
||||
public static CmsError NcError(string message)
|
||||
@@ -61,6 +71,7 @@
|
||||
SELECTED_PROCESS = 26,
|
||||
OSAI_TT_FOLDER_NOT_FOUND = 27,
|
||||
OPTION_NOT_CONSISTENT = 28,
|
||||
WRONG_CMS_PP = 29
|
||||
WRONG_CMS_PP = 29,
|
||||
SIEMENS_TOOL_TABLE_ERROR = 30
|
||||
}
|
||||
}
|
||||
@@ -198,6 +198,7 @@ namespace CMS_CORE_Library.Models
|
||||
public static CmsError OSAI_TT_FOLDER_NOT_FOUND_ERROR = new CmsError(CMS_ERROR_CODES.OSAI_TT_FOLDER_NOT_FOUND, "osai_tt_folder_not_found_error");
|
||||
public static CmsError OPTION_NOT_CONSISTENT_ERROR = new CmsError(CMS_ERROR_CODES.OPTION_NOT_CONSISTENT, "error_option_not_consistent");
|
||||
public static CmsError WRONG_CMS_PP_ERROR = new CmsError(CMS_ERROR_CODES.WRONG_CMS_PP, "error_wrong_custom_part_program");
|
||||
public static CmsError SIEMENS_TOOL_TABLE_ERROR = new CmsError(CMS_ERROR_CODES.SIEMENS_TOOL_TABLE_ERROR, "error_siemens_tool_table_error");
|
||||
|
||||
|
||||
#endregion Cms Errors Codes
|
||||
@@ -445,7 +446,7 @@ namespace CMS_CORE_Library.Models
|
||||
public ASSISTED_TOOLING_ACTION Action { get; set; }
|
||||
}
|
||||
|
||||
public class ToolMovementModel
|
||||
public class MovementBetweenMagazinesModel
|
||||
{
|
||||
public ushort NewMagazineId { get; set; }
|
||||
public ushort NewPositionId { get; set; }
|
||||
|
||||
@@ -605,7 +605,7 @@ namespace CMS_CORE_Library
|
||||
|
||||
public abstract CmsError PLC_RActiveClient(ref int clientId);
|
||||
|
||||
public abstract CmsError PLC_RToolMovement(ref ToolMovementModel toolMovement);
|
||||
public abstract CmsError PLC_RToolMovement(ref MovementBetweenMagazinesModel toolMovement);
|
||||
|
||||
public abstract CmsError PLC_WTerminateMovementProcedure(MOVEMENT_RESPONSE resp);
|
||||
|
||||
|
||||
@@ -7,9 +7,11 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.ServiceModel;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
@@ -518,7 +520,7 @@ namespace CMS_CORE_Library.Osai
|
||||
public override CmsError PLC_RWManageWatchdog()
|
||||
{
|
||||
bool plcWatchdog = false;
|
||||
CmsError cmsError = MEM_RWBoolean(R, 0, NC_WATCHDOG.MemType, NC_WATCHDOG.Address, 1, ref plcWatchdog);
|
||||
CmsError cmsError = MEM_RWBoolean(R, 0, NC_WATCHDOG.MemType, NC_WATCHDOG.Address, 0, ref plcWatchdog);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
@@ -526,7 +528,7 @@ namespace CMS_CORE_Library.Osai
|
||||
return PLC_NOT_RUNNING_ERROR;
|
||||
|
||||
plcWatchdog = true;
|
||||
return MEM_RWBoolean(W, 0, NC_WATCHDOG.MemType, NC_WATCHDOG.Address, 1, ref plcWatchdog);
|
||||
return MEM_RWBoolean(W, 0, NC_WATCHDOG.MemType, NC_WATCHDOG.Address, 0, ref plcWatchdog);
|
||||
}
|
||||
|
||||
public override CmsError PLC_RActiveMessages(ref List<PlcAlarmModel> alarms)
|
||||
@@ -1627,7 +1629,7 @@ namespace CMS_CORE_Library.Osai
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError PLC_RToolMovement(ref ToolMovementModel toolMovement)
|
||||
public override CmsError PLC_RToolMovement(ref MovementBetweenMagazinesModel toolMovement)
|
||||
{
|
||||
//List<ushort> values = new List<ushort>();
|
||||
//CmsError cmsError = MEM_RWWordList(R, 0, TOOL_MOVEMENT_AREA.MemType, TOOL_MOVEMENT_AREA.Address, TOOL_MOVEMENT_AREA.Size / 2, ref values);
|
||||
@@ -4582,7 +4584,7 @@ namespace CMS_CORE_Library.Osai
|
||||
|
||||
//Read From Files
|
||||
PlcMessages = File.ReadAllLines(Path).Select(line => line.Split(',')).ToDictionary(line => Convert.ToInt32(line[0]), line => line[1]);
|
||||
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -4673,21 +4675,12 @@ namespace CMS_CORE_Library.Osai
|
||||
private CmsError ManageException(Exception ex)
|
||||
{
|
||||
Connected = false;
|
||||
|
||||
|
||||
//Catch the .Net exceptions
|
||||
if (ex is EndpointNotFoundException || ex is TimeoutException || ex is CommunicationException)
|
||||
return NOT_CONNECTED_ERROR;
|
||||
else
|
||||
{
|
||||
string message = ex.Message;
|
||||
if(ex.InnerException != null)
|
||||
{
|
||||
message += " / " + ex.Message + " / " + ex.GetType();
|
||||
}
|
||||
|
||||
return CmsError.InternalError(message);
|
||||
}
|
||||
return CmsError.InternalError(ex.Message, ex);
|
||||
}
|
||||
|
||||
private CmsError GetNCError(uint errorClass, uint errorNum)
|
||||
|
||||
@@ -772,7 +772,7 @@ namespace CMS_CORE_Library.Siemens
|
||||
public override CmsError PLC_RWManageWatchdog()
|
||||
{
|
||||
bool plcWatchdog = false;
|
||||
CmsError cmsError = MEM_RWBoolean(R, 0, NC_WATCHDOG.MemType, NC_WATCHDOG.Address, 1, ref plcWatchdog);
|
||||
CmsError cmsError = MEM_RWBoolean(R, 0, NC_WATCHDOG.MemType, NC_WATCHDOG.Address, NC_WATCHDOG.SubAddress, 0, ref plcWatchdog);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
@@ -780,7 +780,7 @@ namespace CMS_CORE_Library.Siemens
|
||||
return PLC_NOT_RUNNING_ERROR;
|
||||
|
||||
plcWatchdog = true;
|
||||
return MEM_RWBoolean(W, 0, NC_WATCHDOG.MemType, NC_WATCHDOG.Address, 1, ref plcWatchdog);
|
||||
return MEM_RWBoolean(W, 0, NC_WATCHDOG.MemType, NC_WATCHDOG.Address, NC_WATCHDOG.SubAddress, 0, ref plcWatchdog);
|
||||
}
|
||||
|
||||
public override CmsError PLC_RActiveMessages(ref List<PlcAlarmModel> alarms)
|
||||
@@ -1492,6 +1492,7 @@ namespace CMS_CORE_Library.Siemens
|
||||
return PLC_ManageActiveAck(M154_STROBE.Address, M154_STROBE.SubAddress, processId - 1, M154_ACK.Address, M154_ACK.SubAddress, processId - 1, M154_STROBE.MemType);
|
||||
}
|
||||
|
||||
|
||||
public override CmsError PLC_RM156Data(ref List<M156InputIsNeededModel> value)
|
||||
{
|
||||
byte val = 0;
|
||||
@@ -1510,11 +1511,26 @@ namespace CMS_CORE_Library.Siemens
|
||||
{
|
||||
if (bits[processId - 1])
|
||||
{
|
||||
Item item = new Item()
|
||||
{
|
||||
Path = string.Format("/channel/parameter/r[c{0} , 154]", processId),
|
||||
};
|
||||
try
|
||||
{
|
||||
DataSvc dataSvc = new DataSvc();
|
||||
dataSvc.Read(item);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
// Parse line & get parameters
|
||||
value.Add(new M156InputIsNeededModel()
|
||||
{
|
||||
Process = (uint)processId,
|
||||
Id = vals.ElementAt(processId - 1)
|
||||
Id = vals.ElementAt(processId - 1),
|
||||
Value = Convert.ToDouble(item.Value)
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1524,18 +1540,31 @@ namespace CMS_CORE_Library.Siemens
|
||||
|
||||
public override CmsError PLC_WM156Response(int process, double responseVal)
|
||||
{
|
||||
CmsError cmsError = MEM_RWDouble(W, 0, MEMORY_TYPE.Osai_GD, 900 + (process - 1), ref responseVal);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
//CmsError cmsError = MEM_RWDouble(W, 0, MEMORY_TYPE.Osai_GD, 900 + (process - 1), ref responseVal);
|
||||
//if (cmsError.IsError())
|
||||
// return cmsError;
|
||||
|
||||
return PLC_WStrobe(M156_INPUT_ACK, M156_INPUT_STROBE, (uint)process);
|
||||
}
|
||||
|
||||
public override CmsError PLC_RScadaValue(string memIndex, SCADA_MEM_TYPE memType, ref object value)
|
||||
{
|
||||
if (memType == SCADA_MEM_TYPE.BOOL)
|
||||
{
|
||||
if (memIndex.ToUpper() == "FALSE")
|
||||
{
|
||||
value = false;
|
||||
return NO_ERROR;
|
||||
}
|
||||
else if (memIndex.ToUpper() == "TRUE")
|
||||
{
|
||||
value = true;
|
||||
return NO_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
string[] index = memIndex.Split('.');
|
||||
CmsError cmsError = NO_ERROR;
|
||||
|
||||
try
|
||||
{
|
||||
if (index.Count() == 0 || index.Count() == 1)
|
||||
@@ -1594,36 +1623,35 @@ namespace CMS_CORE_Library.Siemens
|
||||
CmsError cmsError = NO_ERROR;
|
||||
if (index.Count() == 0)
|
||||
return INCORRECT_PARAMETERS_ERROR;
|
||||
else if (index.Count() == 1)
|
||||
|
||||
else if (index.Count() == 2)
|
||||
{
|
||||
if (memType == SCADA_MEM_TYPE.INT)
|
||||
{
|
||||
// write INT
|
||||
int val = 0;
|
||||
cmsError = MEM_RWInteger(W, 0, MEMORY_TYPE.Osai_MW, Convert.ToInt32(index[0]), ref val);
|
||||
int val = Convert.ToInt32(value);
|
||||
cmsError = MEM_RWInteger(W, 0, MEMORY_TYPE.Siemens_DB, Convert.ToInt32(index[0]), Convert.ToInt32(index[1]), ref val);
|
||||
}
|
||||
else if (memType == SCADA_MEM_TYPE.WORD)
|
||||
{ // write WORD
|
||||
short val = 0;
|
||||
cmsError = MEM_RWShort(W, 0, MEMORY_TYPE.Osai_MW, Convert.ToInt32(index[0]), ref val);
|
||||
short val = Convert.ToInt16(value);
|
||||
cmsError = MEM_RWShort(W, 0, MEMORY_TYPE.Siemens_DB, Convert.ToInt32(index[0]), Convert.ToInt32(index[1]), ref val);
|
||||
}
|
||||
else if (memType == SCADA_MEM_TYPE.REAL)
|
||||
{ // write DOUBLE
|
||||
double val = 0;
|
||||
cmsError = MEM_RWDouble(W, 0, MEMORY_TYPE.Osai_GD, Convert.ToInt32(index[0]), ref val);
|
||||
|
||||
value = val;
|
||||
double val = Convert.ToDouble(value);
|
||||
cmsError = MEM_RWDouble(W, 0, MEMORY_TYPE.Siemens_DB, Convert.ToInt32(index[0]), Convert.ToInt32(index[1]), ref val);
|
||||
}
|
||||
else
|
||||
{ // write byte
|
||||
byte val = 0;
|
||||
cmsError = MEM_RWByte(W, 0, MEMORY_TYPE.Osai_MW, Convert.ToInt32(index[0]), 0, ref val);
|
||||
byte val = Convert.ToByte(value);
|
||||
cmsError = MEM_RWByte(W, 0, MEMORY_TYPE.Siemens_DB, Convert.ToInt32(index[0]), Convert.ToInt32(index[1]), 0, ref val);
|
||||
}
|
||||
}
|
||||
else if (index.Count() == 2 && memType == SCADA_MEM_TYPE.BOOL)
|
||||
else if (index.Count() == 3 && memType == SCADA_MEM_TYPE.BOOL)
|
||||
{ // write BOOL
|
||||
bool val = false;
|
||||
cmsError = MEM_RWBoolean(W, 0, MEMORY_TYPE.Demo, Convert.ToInt32(index[0]), Convert.ToInt32(index[1]), ref val);
|
||||
bool val = Convert.ToBoolean(value);
|
||||
cmsError = MEM_RWBoolean(W, 0, MEMORY_TYPE.Siemens_DB, Convert.ToInt32(index[0]), Convert.ToInt32(index[1]), Convert.ToInt32(index[2]), ref val);
|
||||
}
|
||||
|
||||
return cmsError;
|
||||
@@ -1875,7 +1903,7 @@ namespace CMS_CORE_Library.Siemens
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError PLC_RToolMovement(ref ToolMovementModel toolMovement)
|
||||
public override CmsError PLC_RToolMovement(ref MovementBetweenMagazinesModel toolMovement)
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
@@ -2445,10 +2473,11 @@ namespace CMS_CORE_Library.Siemens
|
||||
|
||||
public override CmsError AXES_RAxesNames(ushort channel, ref List<AxisModel> axesData)
|
||||
{
|
||||
throw new Exception("Messaggio", new Exception("inner"));
|
||||
if (!File.Exists(AXES_FILE_PATH))
|
||||
return CmsError.InternalError("File" + AXES_FILE_PATH + " not found");
|
||||
return CmsError.InternalError("File" + AXES_FILE_PATH + " not found", new Exception("File" + AXES_FILE_PATH + " not found"));
|
||||
|
||||
//Check if the NC is Connected
|
||||
// Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
@@ -2497,10 +2526,10 @@ namespace CMS_CORE_Library.Siemens
|
||||
// Set visible field
|
||||
axesAreVisible[i] = (Convert.ToInt32(ncAxes[i + MAX_AXES_FOR_PROCESS].Value) & 1) == 1;
|
||||
int processAxes = Convert.ToInt32(ncAxes[i].Value);
|
||||
// If axis is active
|
||||
// If axis is visible, add it to the output
|
||||
if (processAxes == channel && axesAreVisible[i])
|
||||
{
|
||||
// Find configurated axes
|
||||
{
|
||||
// Check if axes is configurated axes
|
||||
var axis = configuredAxes.Where(x => x.Id == (i + 1)).FirstOrDefault();
|
||||
if (axis != null)
|
||||
{
|
||||
@@ -2704,23 +2733,32 @@ namespace CMS_CORE_Library.Siemens
|
||||
try
|
||||
{
|
||||
// Setup variables
|
||||
DataSvc Data = HighPriorityDataSvc();
|
||||
DataSvc Data = new DataSvc
|
||||
{
|
||||
Timeout = TimeoutConn,
|
||||
PriorityFlag = SlPriority.highPriority
|
||||
};
|
||||
|
||||
cmsError = ConvertMemToPath(memType, memTable, memIndex, 0, 1, 'D', out string itemString);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
Item item = new Item(itemString);
|
||||
|
||||
|
||||
byte[] byteVal;
|
||||
|
||||
// Read-Write Data
|
||||
if (bWrite)
|
||||
{
|
||||
item.Value = value;
|
||||
byteVal = BitConverter.GetBytes((Single)value);
|
||||
item.Value = BitConverter.ToUInt32(byteVal, 0);
|
||||
Data.Write(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
Data.Read(item);
|
||||
value = Convert.ToDouble(item.Value);
|
||||
byteVal = BitConverter.GetBytes((uint)item.Value);
|
||||
value = unchecked(Convert.ToDouble(BitConverter.ToSingle(byteVal, 0)));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -4981,7 +5019,6 @@ namespace CMS_CORE_Library.Siemens
|
||||
//Manage the Exception Launch
|
||||
private CmsError ManageException(Exception ex)
|
||||
{
|
||||
var a = ex.GetType();
|
||||
//Catch the Siemens exceptions
|
||||
if (ex is OperateMissingOptionException && ex.Message.Contains(OptionHMINotRunning) || ex.Message.Contains("CORBA"))
|
||||
{
|
||||
@@ -4997,8 +5034,14 @@ namespace CMS_CORE_Library.Siemens
|
||||
Connected = false;
|
||||
return NOT_CONNECTED_ERROR;
|
||||
}
|
||||
else if (ex.Message.Contains("m_pSlToolMngmntSvc"))
|
||||
{
|
||||
return SIEMENS_TOOL_TABLE_ERROR;
|
||||
}
|
||||
else
|
||||
return CmsError.InternalError(ex.Message);
|
||||
{
|
||||
return CmsError.InternalError(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
|
||||
// Create and return CmsError object
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using static CMS_CORE_Library.Models.DataStructures;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user