22f732ab9d
* CMS_CORE_Nc_Demo_Application (Server) * Added new Nc Demo into CMS_CORE_Library (Client)
667 lines
32 KiB
C#
667 lines
32 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace CMS_CORE
|
|
{
|
|
public abstract partial class Nc
|
|
{
|
|
//Private Global Variables
|
|
protected Boolean Connected;
|
|
protected String Ip;
|
|
protected ushort Port;
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
#region Global Methods
|
|
|
|
/**
|
|
* <summary>
|
|
* Read Nc Status
|
|
* <para>
|
|
* Compatibility: Fanuc | Osai
|
|
* </para>
|
|
* </summary>
|
|
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
|
* */
|
|
public Boolean isConnected() { return Connected; }
|
|
|
|
/**
|
|
* <summary>
|
|
* Get the NC IP-Address
|
|
* <para>
|
|
* Compatibility: Fanuc | Osai
|
|
* </para
|
|
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
|
* </summary>
|
|
* */
|
|
public String getIpAddress() { return Ip; }
|
|
|
|
/**
|
|
* <summary>
|
|
* Read Nc Port
|
|
* <para>
|
|
* Compatibility: Fanuc | Osai
|
|
* </para>
|
|
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
|
* </summary>
|
|
* */
|
|
public ushort getPort() { return Port; }
|
|
|
|
//General Methods
|
|
|
|
/**
|
|
* <summary>
|
|
* Connect the NC
|
|
* <para>
|
|
* Compatibility: Fanuc | Osai
|
|
* </para>
|
|
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
|
* </summary>
|
|
* */
|
|
public abstract void Connect();
|
|
|
|
/**
|
|
* <summary>
|
|
* Disconnect the NC
|
|
* <para>
|
|
* Compatibility: Fanuc | Osai
|
|
* </para>
|
|
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
|
* </summary>
|
|
* */
|
|
public abstract void Disconnect();
|
|
|
|
|
|
#endregion
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
#region NC High-level data (to override)
|
|
|
|
|
|
/**
|
|
* <summary>
|
|
* Read actual time of the NC-Software (sometimes it can be different from NC-Operative-System)
|
|
* <para>
|
|
* Compatibility: Fanuc | Osai
|
|
* </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 void R_NCDateTime(ref DateTime ActualTime);
|
|
|
|
/**
|
|
* <summary>
|
|
* Read CMS Serial number of the NC
|
|
* <para>
|
|
* Compatibility: Fanuc | Osai
|
|
* </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 void R_NCSerialNumber(ref String SN);
|
|
|
|
/**
|
|
* <summary>
|
|
* Read Model name of the NC
|
|
* <para>
|
|
* Compatibility: Fanuc | Osai
|
|
* </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 void R_NCModelName(ref String ModelName);
|
|
|
|
/**
|
|
* <summary>
|
|
* Read Software Version of the Nc
|
|
* <para>
|
|
* Compatibility: Fanuc | Osai
|
|
* </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 void R_NCSoftwareVersion(ref String SWV);
|
|
|
|
/**
|
|
* <summary>
|
|
* Read CMS Serial number of the Machine
|
|
* <para>
|
|
* Compatibility: Fanuc | Osai
|
|
* </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 void R_NCMachineNumber(ref String MachNumber);
|
|
|
|
/**
|
|
* <summary>
|
|
* Read number of configured Processes/Paths
|
|
* <para>
|
|
* Compatibility: Fanuc | Osai
|
|
* </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 void R_NCProcessesNum(ref ushort ProcNumber);
|
|
|
|
/**
|
|
* <summary>
|
|
* Read the configured language of the NC
|
|
* <para>
|
|
* Compatibility: Fanuc | Osai
|
|
* </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 void R_NCLanguage(ref CultureInfo Language);
|
|
|
|
|
|
#endregion
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
#region PLC High-level data (to override)
|
|
|
|
/**
|
|
* <summary>
|
|
* Read PMC active Alarms
|
|
* <para>
|
|
* Compatibility: Fanuc | Osai
|
|
* </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 void R_PLCActiveAlarms(ref List<String> Alarms);
|
|
|
|
//Read PROCESS High-level data (to override)
|
|
|
|
|
|
#endregion
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
#region PROCESS (PATH) High-level 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
|
|
* </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 void R_PROCStatus(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
|
|
* </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 void R_PROCMode(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
|
|
* </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 void R_PROCActiveAlarms(ushort ProcNumber, ref List<String> Alarms);
|
|
|
|
|
|
#endregion
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
#region PROCESS-AXES (PATH) High-level data (to override)
|
|
|
|
/**
|
|
* <summary>
|
|
* Read the Interpolated position of all axes in Process "ProcNumber"
|
|
* <para>
|
|
* Compatibility: Fanuc | Osai
|
|
* </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 void R_PROCAxis_InterpPosition(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
|
|
* </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 void R_PROCAxis_ProgrPosition(ushort ProcNumber, ref Dictionary<String, double> Axes);
|
|
|
|
/**
|
|
* <summary>
|
|
* Read the Machine position of all axes in Process "ProcNumber"
|
|
* <para>
|
|
* Compatibility: Fanuc | Osai
|
|
* </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 void R_PROCAxis_MachinePosition(ushort ProcNumber, ref Dictionary<String, double> Axes);
|
|
|
|
/**
|
|
* <summary>
|
|
* Read the Following-Error of all axes in Process "ProcNumber"
|
|
* <para>
|
|
* Compatibility: Osai
|
|
* </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 void R_PROCAxis_FollError(ushort ProcNumber, ref Dictionary<String, double> Axes);
|
|
|
|
/**
|
|
* <summary>
|
|
* Read the Distance-to-go of all axes in Process "ProcNumber"
|
|
* <para>
|
|
* Compatibility: Fanuc | Osai
|
|
* </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 void R_PROCAxis_DistToGo(ushort ProcNumber, ref Dictionary<String, double> Axes);
|
|
|
|
|
|
#endregion
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
#region NC Low-level function: single valiable in memory (to override)
|
|
|
|
/**
|
|
* <summary>Read/Write Boolean variable from/into NC Memory Area
|
|
* <para>
|
|
* Compatibility: Fanuc | Osai
|
|
* </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 void RW_Boolean(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemBit, ref Boolean Value);
|
|
|
|
/**
|
|
* <summary>Read/Write Byte variable from/into NC Memory Area
|
|
* <para>
|
|
* Compatibility: Fanuc | Osai
|
|
* </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 void RW_Byte(Boolean bWrite, int Process, MEMORY_Type MemType, 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
|
|
* </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 void RW_Word(Boolean bWrite, int Process, MEMORY_Type MemType, 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
|
|
* </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 void RW_Short(Boolean bWrite, int Process, MEMORY_Type MemType, 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
|
|
* </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 void RW_DWord(Boolean bWrite, int Process, MEMORY_Type MemType, 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
|
|
* </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 void RW_Integer(Boolean bWrite, int Process, MEMORY_Type MemType, 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
|
|
* </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 void RW_Byte_List(Boolean bWrite, int Process, MEMORY_Type MemType, 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
|
|
* </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 void RW_Word_List(Boolean bWrite, int Process, MEMORY_Type MemType, 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
|
|
* </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 void RW_Short_List(Boolean bWrite, int Process, MEMORY_Type MemType, 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
|
|
* </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 void RW_DWord_List(Boolean bWrite, int Process, MEMORY_Type MemType, 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
|
|
* </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 void RW_Integer_List(Boolean bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<int> Value);
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
#region NC Low-level function: Parameters (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 void R_NCParam(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 void R_NCParam(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 void R_NCParam(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 void R_NCParam(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 void R_NCParam(short Index, ref double Value);
|
|
|
|
#endregion
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
#region CONSTANTS (Struct and Enum are Static for definition)
|
|
|
|
// Read Write type
|
|
public const Boolean W = true;
|
|
public const Boolean R = false;
|
|
public const ushort UNDEF_PROC = 0;
|
|
|
|
// min-time to read static data (Cached values)
|
|
protected const ushort NC_MIN_SEC_READ_STATIC_DATA = 10;
|
|
|
|
// CMS Process Status
|
|
public enum PROC_Status : ushort { IDLE = 1, RUN = 2, HOLD = 3, ERROR = 4, RESET = 5, EMERG = 6 };
|
|
|
|
// CMS Process mode
|
|
public enum PROC_Mode : ushort { AUTO = 1, EDIT = 2, MDI = 3, REMOTE = 4, TEACH = 5, REF = 6, JOG = 7, JOGINC = 8, RETPROF = 9, HANDLE = 10, RESTART = 11, ERROR = 12 };
|
|
|
|
// R-W MEMORY Type
|
|
public enum MEMORY_Type
|
|
{
|
|
NullVariable = -1,
|
|
//Fanuc Memory Type
|
|
Fanuc_G = 0, Fanuc_F = 1, Fanuc_Y = 2, Fanuc_X = 3, Fanuc_A = 4, Fanuc_R = 5, Fanuc_T = 6, Fanuc_K = 7, Fanuc_C = 8, Fanuc_D = 9, Fanuc_M = 10, Fanuc_N = 11, Fanuc_E = 12, Fanuc_Z = 13, Fanuc_CM = 100,
|
|
//Osai Memory Type
|
|
Osai_I = 0, Osai_O = 1, Osai_MW = 20, Osai_GW = 21, Osai_SW = 22, Osai_PW = 62, Osai_UW = 63, Osai_MD = 40, Osai_GD = 41, Osai_SD = 42, Osai_PD = 43, Osai_UD = 44, Osai_L = 145, Osai_LS = 18, Osai_AA = 28, Osai_A = 45, Osai_SC = 50, Osai_SYMO = 102
|
|
};
|
|
|
|
|
|
//Fanuc Variable & Const
|
|
protected const short FANUC_MAXNVAR = 5;
|
|
protected const short FANUC_MAXMSGCNC = 10;
|
|
protected const short FANUC_MAXMSGPMC = 5;
|
|
protected const short FANUC_ABSOLUTEPOS = 0;
|
|
protected const short FANUC_MACHINEPOS = 1;
|
|
protected const short FANUC_RELATIVEPOS = 2;
|
|
protected const short FANUC_DISTTOGO = 3;
|
|
protected const short FANUC_ALLPOS = -1;
|
|
protected enum FANUC_DType : short { BYTE = 0, WORD = 1, LONG = 2 };
|
|
|
|
//Osai Variable & Const
|
|
public string NC_OSAI_PLC_MESSAGES = @"C:\CMS\OSAI\";
|
|
public string NC_OSAI_WINBI_PATH = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\OSAI\WinNBI\";
|
|
|
|
protected const ushort OSAI_PROGRAMMEDPOS = 1;
|
|
protected const ushort OSAI_INTERPOLPOS = 2;
|
|
protected const ushort OSAI_TRANSDUCERPOS = 3;
|
|
protected const ushort OSAI_FOLLERROR = 4;
|
|
protected const ushort OSAI_DISTTOGO = 5;
|
|
protected const ushort OSAI_MACHINEPOS = 6;
|
|
|
|
|
|
#endregion
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
#region Fixed memory area
|
|
|
|
// R-W MEMORY Cell
|
|
protected struct MEMORY_Cell
|
|
{
|
|
public readonly MEMORY_Type MemType;
|
|
public readonly int Address;
|
|
|
|
public MEMORY_Cell(MEMORY_Type MType, int Addr)
|
|
{
|
|
MemType = MType;
|
|
Address = Addr;
|
|
}
|
|
|
|
}
|
|
|
|
//Lingua CN
|
|
protected MEMORY_Cell PARAM_LING_FANUC = new MEMORY_Cell(MEMORY_Type.NullVariable, 3281);
|
|
|
|
//Matricola Macchina
|
|
protected MEMORY_Cell MATR_MACCH_OSAI = new MEMORY_Cell(MEMORY_Type.Osai_MW , 3403 );
|
|
protected MEMORY_Cell MATR_MACCH_FANUC = new MEMORY_Cell(MEMORY_Type.Fanuc_D , 4018 );
|
|
|
|
|
|
#endregion
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
#region Error Codes
|
|
|
|
protected const uint NC_PROD_ERROR = 0;
|
|
protected const uint NOT_CONNECTED_ERROR = 1;
|
|
protected const uint PROC_NOT_FOUND_ERROR = 2;
|
|
protected const uint FUNC_NOTALL_NC_ERROR = 3;
|
|
protected const uint BIT_NOT_IN_RANGE_ERROR = 4;
|
|
protected const uint BYTE_NOT_IN_RANGE_ERROR = 5;
|
|
protected const uint INTERNAL_ERROR = 6;
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
}
|