Files
cms-core-active/CMS_CORE_Library/Nc.cs
T
Lucio Maranta 4d7ebdcc12
2018-01-09 15:16:49 +00:00

1240 lines
60 KiB
C#

using CMS_CORE_Library;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace CMS_CORE
{
public abstract partial class Nc
{
//Private Global Variables
internal Boolean Connected;
internal String Ip;
internal ushort Port;
internal Boolean UseProxy;
internal String LibName = "CMS_CORE_Library.dll";
//Osai Variable
internal string OSAI_PlcMessagesPath = @"C:\CMS\OSAI\";
internal string OSAI_WinNbiPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\OSAI\WinNBI\";
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region LIB Methods
/**
* <summary>
* Get the NC IP-Address
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>
* </summary>
* */
public String LIB_GetIpAddress() { return Ip; }
/**
* <summary>
* Set the NC IP-Address
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>
* </summary>
* */
public void LIB_SetIpAddress(String ip) { Ip = ip; }
/**
* <summary>
* Get Nc Port
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>
* </summary>
* */
public ushort LIB_GetPort() { return Port; }
/**
* <summary>
* Set Nc Port
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>
* </summary>
* */
public void LIB_SetPort(ushort port) { Port = port; }
/**
* <summary>
* Get Library Version
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* */
public String LIB_GetLibraryVersion() { return FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion.ToString(); }
#endregion
#region LIB Methods (OSAI)
/**
* <summary>
* Get if the library uses Windows proxy
* <para>
* Compatibility: Osai
* </para>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* </summary>
* */
public Boolean LIB_GetWindowsProxy() { return UseProxy; }
/**
* <summary>
* Set if the library need to use Windows proxy
* <para>
* Compatibility: Osai
* </para>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* </summary>
* */
public void LIB_SetWindowsProxy(Boolean proxy) { UseProxy = proxy; }
/**
* <summary>
* Get the path of PLC Messages Folder
* <para>
* Compatibility: Osai
* </para>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* </summary>
* */
public string LIB_GetPlcMsgsPath() { return OSAI_PlcMessagesPath; }
/**
* <summary>
* Set the path of PLC Messages Folder
* <para>
* Compatibility: Osai
* </para>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* </summary>
* */
public void LIB_SetPlcMsgsPath(string folder) { OSAI_PlcMessagesPath = folder; }
/**
* <summary>
* Get the path of Win-Nbi installation
* <para>
* Compatibility: Osai
* </para>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* </summary>
* */
public string LIB_GetWinNbiPath() { return OSAI_WinNbiPath; }
/**
* <summary>
* Set the path of Win-Nbi installation
* <para>
* Compatibility: Osai
* </para>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* </summary>
* */
public void LIB_SetWinNbiPath(string folder) { OSAI_WinNbiPath = folder; }
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region NC High-level data (to override)
/**
* <summary>
* Connect the NC
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* </summary>
* */
public abstract CmsError NC_Connect();
/**
* <summary>
* Disconnect the NC
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* </summary>
* */
public abstract CmsError NC_Disconnect();
/**
* <summary>
* Read Nc Status
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* */
public Boolean NC_IsConnected() { return Connected; }
/**
* <summary>
* Read actual time of the NC-Software (sometimes it can be different from NC-Operative-System)
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="ActualTime">Reference of a DateTime Variable where data will be saved</param>
* */
public abstract CmsError NC_RDateTime(ref DateTime ActualTime);
/**
* <summary>
* Read Vendor NC Serial number
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="SN">Reference of a String Variable where data will be saved</param>
* */
public abstract CmsError NC_RSerialNumber(ref String SN);
/**
* <summary>
* Read Model name of the NC
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="ModelName">Reference of a String Variable where data will be saved</param>
* */
public abstract CmsError NC_RModelName(ref String ModelName);
/**
* <summary>
* Read Software Version of the Nc
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="SWV">Reference of a String Variable where data will be saved</param>
* */
public abstract CmsError NC_RSoftwareVersion(ref String SWV);
/**
* <summary>
* Read CMS Serial number of the Machine
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="MachNumber">Reference of a String Variable where data will be saved</param>
* */
public abstract CmsError NC_RMachineNumber(ref String MachNumber);
/**
* <summary>
* Read number of configured Processes/Paths
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="ProcNumber">Reference of a ushort Variable where data will be saved</param>
* */
public abstract CmsError NC_RProcessesNum(ref ushort ProcNumber);
/**
* <summary>
* Read the configured language of the NC
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="Language">Reference of a CultureInfo Variable where data will be saved</param>
* */
public abstract CmsError NC_RLanguage(ref CultureInfo Language);
/**
* <summary>
* Read active alarms of the NC (Nc-Process indipendent). For OSAI Nc the list can contain only one Message
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Alarms">Reference of a List of String Variables where data will be saved</param>
* */
public abstract CmsError NC_RActiveAlarms(ref List<String> Alarms);
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region NC Low-level data (to override)
/**
* <summary>Read Boolean Parameter Machine (Not compatible for Axis Parameter (Multiple values in a parameter)
* <para>
* Compatibility: Fanuc
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="Index">Index of the parameter</param>
* <param name="Bit">Set the Bit to Read. (0..7)</param>
* <param name="Value">Reference of a variable with Param values</param>
* */
public abstract CmsError NC_RParam(short Index, short Bit, ref Boolean Value);
/**
* <summary>Read Byte Parameter Machine (Not compatible for Axis Parameter (Multiple values in a parameter)
* <para>
* Compatibility: Fanuc
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="Index">Index of the parameter</param>
* <param name="Value">Reference of a variable with Param values</param>
* */
public abstract CmsError NC_RParam(short Index, ref byte Value);
/**
* <summary>Read 2 Byte (Short) Parameter Machine (Not compatible for Axis Parameter (Multiple values in a parameter)
* <para>
* Compatibility: Fanuc
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="Index">Index of the parameter</param>
* <param name="Value">Reference of a variable with Param values</param>
* */
public abstract CmsError NC_RParam(short Index, ref short Value);
/**
* <summary>Read 4 Byte (Integer) Parameter Machine (Not compatible for Axis Parameter (Multiple values in a parameter)
* <para>
* Compatibility: Fanuc
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="Index">Index of the parameter</param>
* <param name="Value">Reference of a variable with Param values</param>
* */
public abstract CmsError NC_RParam(short Index, ref int Value);
/**
* <summary>Read Real Parameter Machine (Not compatible for Axis Parameter (Multiple values in a parameter)
* <para>
* Compatibility: Fanuc
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="Index">Index of the parameter</param>
* <param name="Value">Reference of a variable with Param values</param>
* */
public abstract CmsError NC_RParam(short Index, ref double Value);
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region PLC High-level data (to override)
/**
* <summary>
* Read PMC active Messages
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="Alarms">Reference of a List of String Variables where data will be saved</param>
* */
public abstract CmsError PLC_RActiveMessages(ref List<String> Alarms);
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region PROCESS (PATH, CHANNEL) data (to override)
/**
* <summary>
* Read the actual status of the Process "ProcNumber"
* <para>See <see cref="Nc.PROC_Status"/> for information about the PROC_Status type</para>
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Status">Reference of a PROC_Status Variable where data will be saved</param>
* */
public abstract CmsError PROC_RStatus(ushort ProcNumber, ref PROC_Status Status);
/**
* <summary>
* Read the selected Mode Process "ProcNumber"
* <para>See <see cref="Nc.PROC_Mode"/> for information about the PROC_Status type</para>
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Mode">Reference of a PROC_Mode Variable where data will be saved</param>
* */
public abstract CmsError PROC_RMode(ushort ProcNumber, ref PROC_Mode Mode);
/**
* <summary>
* Read active alarms of the process "ProcNumber". For OSAI Nc the list can contain only one Message
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Alarms">Reference of a List of String Variables where data will be saved</param>
* */
public abstract CmsError PROC_RActiveAlarms(ushort ProcNumber, ref List<String> Alarms);
/**
* <summary>
* Read actual & Next Lines of active PP
* <para>
* Compatibility: Fanuc | Osai | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Lines">Reference of a List of String Variables where data will be saved</param>
* */
public abstract CmsError PROC_RPPLines(ushort ProcNumber, ref List<String> Lines);
/**
* <summary>
* Read active PP Name
* <para>
* Compatibility: Fanuc | Osai | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Name">Reference of a String Variables where data will be saved</param>
* */
public abstract CmsError PROC_RPPName(ushort ProcNumber, ref String Name);
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region AXES data (to override)
/**
* <summary>
* Read the Interpolated position of all axes in Process "ProcNumber"
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
* */
public abstract CmsError AXES_RInterpPosition(ushort ProcNumber, ref Dictionary<String, double> Axes);
/**
* <summary>
* Read the Programmed position of all axes in Process "ProcNumber".
* For Fanuc-Nc there's not "Programmed position" variables. Si it is calculated from Machine-Pos and Distance-to-go
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
* */
public abstract CmsError AXES_RProgrPosition(ushort ProcNumber, ref Dictionary<String, double> Axes);
/**
* <summary>
* Read the Machine position of all axes in Process "ProcNumber"
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
* */
public abstract CmsError AXES_RMachinePosition(ushort ProcNumber, ref Dictionary<String, double> Axes);
/**
* <summary>
* Read the Following-Error of all axes in Process "ProcNumber"
* <para>
* Compatibility: Osai | Demo
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
* */
public abstract CmsError AXES_RFollowingError(ushort ProcNumber, ref Dictionary<String, double> Axes);
/**
* <summary>
* Read the Distance-to-go of all axes in Process "ProcNumber"
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
* */
public abstract CmsError AXES_RDistanceToGo(ushort ProcNumber, ref Dictionary<String, double> Axes);
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region MEMORY Low-level function: single valiable in memory (to override)
/**
* <summary>Read/Write Boolean variable from/into NC Memory Area
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="MemBit">Set the Bit to Read-Write. (0..7)</param>
* <param name="Value">Reference to variable to read/Write</param>
* */
public abstract CmsError MEM_RWBoolean(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemBit, ref Boolean Value);
/**
* <summary>Read/Write Boolean variable from/into NC Memory Area (including Siemens Nc)
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemTable">Siemens Memory Table (Used only in Siemens-Nc)</param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="MemBit">Set the Bit to Read-Write. (0..7)</param>
* <param name="Value">Reference to variable to read/Write</param>
* */
public abstract CmsError MEM_RWBoolean(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemBit, ref Boolean Value);
/**
* <summary>Read/Write Byte variable from/into NC Memory Area
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="MemByteStart">Set to 1 if the Byte is the second of a WORD (only for OSAI Nc)</param>
* <param name="Value">Reference to variable to read/Write</param>
* */
public abstract CmsError MEM_RWByte(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemByte, ref Byte Value);
/**
* <summary>Read/Write Byte variable from/into NC Memory Area (including Siemens Nc)
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemTable">Siemens Memory Table (Used only in Siemens-Nc)</param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="MemByteStart">Set to 1 if the Byte is the second of a WORD (only for OSAI Nc)</param>
* <param name="Value">Reference to variable to read/Write</param>
* */
public abstract CmsError MEM_RWByte(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemByte, ref Byte Value);
/**
* <summary>Read/Write unsigned 2 Byte (NC: Word:, .NET: ushort) variable from/into NC Memory Area
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWWord(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref ushort Value);
/**
* <summary>Read/Write unsigned 2 Byte (NC: Word:, .NET: ushort) variable from/into NC Memory Area (including Siemens Nc)
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemTable">Siemens Memory Table (Used only in Siemens-Nc)</param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWWord(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref ushort Value);
/**
* <summary>Read/Write signed 2 Byte (NC: Word:, .NET: short) variable from/into NC Memory Area
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWShort(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref short Value);
/**
* <summary>Read/Write signed 2 Byte (NC: Word:, .NET: short) variable from/into NC Memory Area (including Siemens Nc)
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemTable">Siemens Memory Table (Used only in Siemens-Nc)</param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWShort(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref short Value);
/**
* <summary>Read/Write signed 4 Byte (NC: DWord:, .NET: uint) variable from/into NC Memory Area
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>uW
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWDWord(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref uint Value);
/**
* <summary>Read/Write signed 4 Byte (NC: DWord:, .NET: uint) variable from/into NC Memory Area (including Siemens Nc)
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>uW
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemTable">Siemens Memory Table (Used only in Siemens-Nc)</param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWDWord(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref uint Value);
/**
* <summary>Read/Write signed 4 Byte (NC: DWord:, .NET: int) variable from/into NC Memory Area
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWInteger(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref int Value);
/**
* <summary>Read/Write signed 4 Byte (NC: DWord:, .NET: int) variable from/into NC Memory Area (including Siemens Nc)
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemTable">Siemens Memory Table (Used only in Siemens-Nc)</param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWInteger(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref int Value);
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region NC Low-level function: variables List in memory (to override)
/**
* <summary>Read/Write List of Byte from/into NC Memory Area
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="MemByteStart">Set to 1 if the starting Byte is the second of a WORD (only for OSAI Nc)</param>
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWByteList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemByteStart, int Number, ref List<Byte> Value);
/**
* <summary>Read/Write List of Byte from/into NC Memory Area (including Siemens Nc)
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemTable">Siemens Memory Table (Used only in Siemens-Nc)</param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="MemByteStart">Set to 1 if the starting Byte is the second of a WORD (only for OSAI Nc)</param>
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWByteList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemByteStart, int Number, ref List<Byte> Value);
/**
* <summary>Read/Write List of unsigned 2 Byte (NC: Word:, .NET: ushort) from/into NC Memory Area
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWWordList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<ushort> Value);
/**
* <summary>Read/Write List of unsigned 2 Byte (NC: Word:, .NET: ushort) from/into NC Memory Area (including Siemens Nc)
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemTable">Siemens Memory Table (Used only in Siemens-Nc)</param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWWordList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<ushort> Value);
/**
* <summary>Read/Write List of signed 2 Byte (NC: Word:, .NET: short) from/into NC Memory Area
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWShortList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<short> Value);
/**
* <summary>Read/Write List of signed 2 Byte (NC: Word:, .NET: short) from/into NC Memory Area (including Siemens Nc)
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemTable">Siemens Memory Table (Used only in Siemens-Nc)</param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWShortList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<short> Value);
/**
* <summary>Read/Write List of unsigned 4 Byte (NC: DWord:, .NET: uint) from/into NC Memory Area
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWDWordList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<uint> Value);
/**
* <summary>Read/Write List of unsigned 4 Byte (NC: DWord:, .NET: uint) from/into NC Memory Area (including Siemens Nc)
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or <see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemTable">Siemens Memory Table (Used only in Siemens-Nc)</param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWDWordList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<uint> Value);
/**
* <summary>Read/Write List of signed 4 Byte (NC: DWord:, .NET: int) from/into NC Memory Area
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or Nc.<see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWIntegerList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<int> Value);
/**
* <summary>Read/Write List of signed 4 Byte (NC: DWord:, .NET: int) from/into NC Memory Area (including Siemens Nc)
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
* <param name="Process">Process to perform operation (If the area is process-indipendent use 0 or Nc.<see cref="Nc.UNDEF_PROC"/>)</param>
* <param name="MemType">Nc Memory Area. See <see cref="Nc.MEMORY_Type"/></param>
* <param name="MemTable">Siemens Memory Table (Used only in Siemens-Nc)</param>
* <param name="MemIndex">Starting Index of Memory Area</param>
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWIntegerList(Boolean bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<int> Value);
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region File Management (To override)
/**
* <summary>Read a Part Program by path and name
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="partProgramPath">Path of the Part Program stored in the Nc</param>
* <param name="partProgramLocalName">Name of the Part Program and name of new local file</param>
* <param name="localFile">Reference to the new local file where the NC Part Program data will be saved</param>
* */
public abstract CmsError FILES_RProgramToFile(string partProgramPath, FileStream localFile);
/**
* <summary>Write/Overwrite a Part Program by path and name
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="partProgramPath">Path of the Part Program stored in the Nc</param>
* <param name="localFile">Reference to the local Part Program file</param>
* */
public abstract CmsError FILES_WProgramFromFile(string partProgramPath, FileStream localFile);
/**
* <summary>Copy a Part Program into another path
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="partProgramPath">Path where the Part Program is saved in the NC</param>
* <param name="newPartProgramPath">Path of the copy Part Program destination</param>
* <param name="failIfExist"></param>
* */
public abstract CmsError FILES_CopyProgram(string partProgramPath, string newPartProgramPath, bool failIfExist);
/**
* <summary>Delete a Nc Part Program
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
* <param name="partProgramPath">Path where the Nc Part Program is saved in the NC</param>
* <param name="partProgramName">Name of the Part Program file</param>
* */
public abstract CmsError FILES_DeleteProgram(string partProgramPath, string partProgramName);
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region CONSTANTS (Struct and Enum are Static for definition)
// Read Write type
/** <summary>Write action</summary> */
public const Boolean W = true;
/** <summary>Read action</summary> */
public const Boolean R = false;
/** <summary>Not-Defined Process</summary> */
public const ushort UNDEF_PROC = 0;
/** <summary>Process-Status</summary> */
public enum PROC_Status : ushort
{
/** <summary>Idle-Status</summary> */
IDLE = 1,
/** <summary>Run-Status</summary> */
RUN = 2,
/** <summary>Hold-Status</summary> */
HOLD = 3,
/** <summary>Error-Status</summary> */
ERROR = 4,
/** <summary>Reset-Status</summary> */
RESET = 5,
/** <summary>Emergency-Status</summary> */
EMERG = 6
};
/** <summary>CMS-Process-Mode</summary> */
public enum PROC_Mode : ushort
{
/** <summary>Automatic-Mode</summary> */
AUTO = 1,
/** <summary>Edit-Mode</summary> */
EDIT = 2,
/** <summary>Mdi-Mode</summary> */
MDI = 3,
/** <summary>Remote-Mode</summary> */
REMOTE = 4,
/** <summary>Teach-Mode</summary> */
TEACH = 5,
/** <summary>Ref-Mode</summary> */
REF = 6,
/** <summary>Jog-Mode</summary> */
JOG = 7,
/** <summary>Joginc-Mode</summary> */
JOGINC = 8,
/** <summary>Ret_on_Profile-Mode</summary> */
RETPROF = 9,
/** <summary>Handle-Mode</summary> */
HANDLE = 10,
/** <summary>Restart-Mode</summary> */
RESTART = 11,
/** <summary>Error-Mode</summary> */
ERROR = 12
};
// R-W MEMORY Type
/** <summary>Nc Memory Type (Table)</summary> */
public enum MEMORY_Type
{
/** <summary>Null Type</summary> */
Null = -1,
///////////////////////////////////////////////////////////////////
//Fanuc Memory Type
/** <summary>Fanuc G Area</summary> */
Fanuc_G = 0,
/** <summary>Fanuc F Area</summary> */
Fanuc_F = 1,
/** <summary>Fanuc Y Area</summary> */
Fanuc_Y = 2,
/** <summary>Fanuc X Area</summary> */
Fanuc_X = 3,
/** <summary>Fanuc A Area</summary> */
Fanuc_A = 4,
/** <summary>Fanuc R Area</summary> */
Fanuc_R = 5,
/** <summary>Fanuc T Area</summary> */
Fanuc_T = 6,
/** <summary>Fanuc K Area</summary> */
Fanuc_K = 7,
/** <summary>Fanuc C Area</summary> */
Fanuc_C = 8,
/** <summary>Fanuc D Area</summary> */
Fanuc_D = 9,
/** <summary>Fanuc M Area</summary> */
Fanuc_M = 10,
/** <summary>Fanuc N Area</summary> */
Fanuc_N = 11,
/** <summary>Fanuc E Area</summary> */
Fanuc_E = 12,
/** <summary>Fanuc Z Area</summary> */
Fanuc_Z = 13,
/** <summary>Fanuc CM Area</summary> */
Fanuc_CM = 100,
///////////////////////////////////////////////////////////////////
//Osai Memory Type
/** <summary>Osai I Area</summary> */
Osai_I = 0,
/** <summary>Osai O Area</summary> */
Osai_O = 1,
/** <summary>Osai MW Area</summary> */
Osai_MW = 20,
/** <summary>Osai GW Area</summary> */
Osai_GW = 21,
/** <summary>Osai SW Area</summary> */
Osai_SW = 22,
/** <summary>Osai PW Area</summary> */
Osai_PW = 62,
/** <summary>Osai UW Area</summary> */
Osai_UW = 63,
/** <summary>Osai MD Area</summary> */
Osai_MD = 40,
/** <summary>Osai GD Area</summary> */
Osai_GD = 41,
/** <summary>Osai SD Area</summary> */
Osai_SD = 42,
/** <summary>Osai PD Area</summary> */
Osai_PD = 43,
/** <summary>Osai UD Area</summary> */
Osai_UD = 44,
/** <summary>Osai L Area</summary> */
Osai_L = 145,
/** <summary>Osai LS Area</summary> */
Osai_LS = 18,
/** <summary>Osai AA Area</summary> */
Osai_AA = 28,
/** <summary>Osai A Area</summary> */
Osai_A = 45,
/** <summary>Osai SC Area</summary> */
Osai_SC = 50,
/** <summary>Osai SYMO Area</summary> */
Osai_SYMO = 102,
///////////////////////////////////////////////////////////////////
//Siemens Memory Type,
/** <summary>Siemens DB</summary> */
Siemens_DB = 0
};
// NC Memory Type Name
internal const String FANUC_MEMTYPE = "Fanuc_";
internal const String SIEMENS_MEMTYPE = "Siemens_";
internal const String OSAI_MEMTYPE = "Osai_";
internal const String DEMO_MEMTYPE = "Demo_";
internal const String UNDEFINED_MEMTYPE = "Null";
// min-time to read static data (Cached values)
internal const ushort NC_MIN_SEC_READ_STATIC_DATA = 10;
//Fanuc Variable & Const
internal const short FANUC_MAXNVAR = 5;
internal const short FANUC_MAXMSGCNC = 10;
internal const short FANUC_MAXMSGPMC = 5;
internal const short FANUC_ABSOLUTEPOS = 0;
internal const short FANUC_MACHINEPOS = 1;
internal const short FANUC_RELATIVEPOS = 2;
internal const short FANUC_DISTTOGO = 3;
internal const short FANUC_ALLPOS = -1;
internal enum FANUC_DType : short { BYTE = 0, WORD = 1, LONG = 2 };
internal const ushort OSAI_PROGRAMMEDPOS = 1;
internal const ushort OSAI_INTERPOLPOS = 2;
internal const ushort OSAI_TRANSDUCERPOS = 3;
internal const ushort OSAI_FOLLERROR = 4;
internal const ushort OSAI_DISTTOGO = 5;
internal const ushort OSAI_MACHINEPOS = 6;
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Fixed memory area
// R-W MEMORY Cell
internal struct MEMORY_Cell
{
public readonly MEMORY_Type MemType;
public readonly int Address;
public readonly int SubAddress; //Only for Siemens
public readonly int Size;
public MEMORY_Cell(MEMORY_Type MType, int Addr, int SubAddr,int Sz)
{
MemType = MType;
Address = Addr;
SubAddress = SubAddr;
Size = Sz;
}
}
//Lingua CN
internal MEMORY_Cell PARAM_LING_FANUC = new MEMORY_Cell(MEMORY_Type.Null, 3281, 0, 1);
//Matricola Macchina
internal MEMORY_Cell MATR_MACCH_OSAI = new MEMORY_Cell(MEMORY_Type.Osai_MW , 3403, 0, 1);
internal MEMORY_Cell MATR_MACCH_FANUC = new MEMORY_Cell(MEMORY_Type.Fanuc_D , 4018, 0, 1);
internal MEMORY_Cell MATR_MACCH_SIEMENS = new MEMORY_Cell(MEMORY_Type.Siemens_DB, 255 , 0, 1);
//Messaggi PLC
internal MEMORY_Cell PLC_MESS_OSAI = new MEMORY_Cell(MEMORY_Type.Osai_MW, 12000, 0, 64);
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Cms Errors Codes
internal const uint OK = 0;
internal const uint NC_PROD_ERROR = 1;
internal const uint NOT_CONNECTED = 2;
internal const uint PROC_NOT_FOUND = 3;
internal const uint FUNCTION_NOT_ALLOWED = 4;
internal const uint BIT_NOT_IN_RANGE = 5;
internal const uint BYTE_NOT_IN_RANGE = 6;
internal const uint INTERNAL_ERROR = 7;
internal const uint INCORRECT_PARAMETERS = 8;
internal const uint NC_LANGUAGE_ERROR = 9;
internal const uint SIEMENS_ENVIRONMENT_NOT_FOUND = 10;
internal const uint SIEMENS_HMI_NOT_RUNNING = 11;
public class CmsError
{
public uint errorCode;
public string message;
public CmsError(uint errorCode, string message)
{
this.errorCode = errorCode;
this.message = message;
}
}
internal static CmsError NO_ERROR = new CmsError(OK, "");
internal static CmsError NOT_CONNECTED_ERROR = new CmsError(FUNCTION_NOT_ALLOWED, "CMS-Core-Error: Nc not Connected");
internal static CmsError PROC_NOT_FOUND_ERROR = new CmsError(FUNCTION_NOT_ALLOWED, "CMS-Core-Error: Function not allowed for this type of NC");
internal static CmsError FUNCTION_NOT_ALLOWED_ERROR = new CmsError(FUNCTION_NOT_ALLOWED, "CMS-Core-Error: Function not allowed for this type of NC");
internal static CmsError BIT_NOT_IN_RANGE_ERROR = new CmsError(BIT_NOT_IN_RANGE, "CMS-Core-Error: Bit - number must be between 0 and 7");
internal static CmsError BYTE_NOT_IN_RANGE_ERROR = new CmsError(BIT_NOT_IN_RANGE, "CMS-Core-Error: Byte - number must be between 0 and 1");
internal static CmsError INCORRECT_PARAMETERS_ERROR = new CmsError(BIT_NOT_IN_RANGE, "CMS-Core-Error: Incorrect Parameters error");
internal static CmsError LANGUAGE_ERROR = new CmsError(BIT_NOT_IN_RANGE, "CMS-Core-Error: Incorrect Language");
internal static CmsError SIEMENS_ENVIRONMENT_NOT_FOUND_ERROR = new CmsError(BIT_NOT_IN_RANGE, "CMS-Core-Error: Siemens Environment not found");
internal static CmsError SIEMENS_HMI_NOT_RUNNING_ERROR = new CmsError(BIT_NOT_IN_RANGE, "CMS-Core-Error: Siemens HMI is not Running / Ready");
#endregion
}
}