This commit is contained in:
@@ -56,8 +56,8 @@ namespace CMS_CORE_Application
|
||||
|
||||
private void ReadBasicData()
|
||||
{
|
||||
Nc.PROC_Mode mode = Nc.PROC_Mode.AUTO;
|
||||
Nc.PROC_Status status = Nc.PROC_Status.ERROR;
|
||||
Nc.PROC_MODE mode = Nc.PROC_MODE.AUTO;
|
||||
Nc.PROC_STATUS status = Nc.PROC_STATUS.ERROR;
|
||||
ushort procnum = 0;
|
||||
String MachNumber = "";
|
||||
String ModelName = "";
|
||||
@@ -133,7 +133,8 @@ namespace CMS_CORE_Application
|
||||
// error = true;
|
||||
// SetError(Lines, cmsError);
|
||||
//}
|
||||
|
||||
ProcessPartProgramData process = new ProcessPartProgramData();
|
||||
cmsError = N.PROC_RPartProgramData(1, ref process);
|
||||
cmsError = N.NC_RDateTime(ref NcTime);
|
||||
if (cmsError.IsError())
|
||||
{
|
||||
@@ -193,6 +194,8 @@ namespace CMS_CORE_Application
|
||||
|
||||
public void ChangeTool()
|
||||
{
|
||||
if (NCType != "Fanuc")
|
||||
return;
|
||||
N = SetNcByType();
|
||||
ToolModel toola = RicercaPerManina(1);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static CMS_CORE.Nc;
|
||||
|
||||
namespace CMS_CORE_Library
|
||||
{
|
||||
@@ -109,6 +110,15 @@ namespace CMS_CORE_Library
|
||||
public bool isWarning;
|
||||
public int process;
|
||||
}
|
||||
|
||||
public class ProcessPartProgramData
|
||||
{
|
||||
public ushort Id;
|
||||
public string PartProgramName;
|
||||
public PROC_STATUS Status;
|
||||
public bool Visible;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,6 +289,35 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
// Check if the NC is in running state
|
||||
public override CmsError NC_RIsRunning(ref bool running)
|
||||
{
|
||||
ushort nProcess = 0;
|
||||
// Get the number of processes
|
||||
CmsError cmsError = NC_RProcessesNum(ref nProcess);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
ushort i = 1;
|
||||
running = false;
|
||||
do
|
||||
{
|
||||
PROC_STATUS procStatus = PROC_STATUS.IDLE;
|
||||
|
||||
// Read process status
|
||||
cmsError = PROC_RStatus(i, ref procStatus);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
// If one process is runninc, nc is running
|
||||
if (procStatus == PROC_STATUS.RUN)
|
||||
running = true;
|
||||
i++;
|
||||
} while (!running || i <= nProcess);
|
||||
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
#endregion
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -327,7 +356,7 @@ namespace CMS_CORE.Demo
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#region PROCESS (PATH) High-level data
|
||||
|
||||
public override CmsError PROC_RStatus(ushort ProcNumber, ref PROC_Status Status)
|
||||
public override CmsError PROC_RStatus(ushort ProcNumber, ref PROC_STATUS Status)
|
||||
{
|
||||
// Check if the NC Demo is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
@@ -339,7 +368,7 @@ namespace CMS_CORE.Demo
|
||||
// Get status from server
|
||||
serverService.GetProcessStatus(ProcNumber.ToString(), out int demoStatus);
|
||||
|
||||
Status = (PROC_Status)demoStatus;
|
||||
Status = (PROC_STATUS)demoStatus;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -349,7 +378,7 @@ namespace CMS_CORE.Demo
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError PROC_RMode(ushort ProcNumber, ref PROC_Mode Mode)
|
||||
public override CmsError PROC_RMode(ushort ProcNumber, ref PROC_MODE Mode)
|
||||
{
|
||||
// Check if the NC Demo is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
@@ -361,7 +390,7 @@ namespace CMS_CORE.Demo
|
||||
// Get mode from server
|
||||
serverService.GetProcessMode(ProcNumber.ToString(), out int demoMode);
|
||||
|
||||
Mode = (PROC_Mode)demoMode;
|
||||
Mode = (PROC_MODE)demoMode;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -402,6 +431,24 @@ namespace CMS_CORE.Demo
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
// Get process part program data
|
||||
public override CmsError PROC_RPartProgramData(ushort procNumber, ref ProcessPartProgramData processData)
|
||||
{
|
||||
processData.Id = procNumber;
|
||||
// Read part program name
|
||||
CmsError cmsError = PROC_RPPName(procNumber, ref processData.PartProgramName);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
// Read process status
|
||||
cmsError = PROC_RStatus(procNumber, ref processData.Status);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
// Read part program info visibility
|
||||
processData.Visible = true;
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
#endregion
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -258,8 +258,8 @@ namespace CMS_CORE.Fanuc
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public override CmsError Nc_RPowerOnData(ref PreAndPostPowerOnModel powerOnModel)
|
||||
{
|
||||
return NO_ERROR;
|
||||
@@ -275,7 +275,7 @@ namespace CMS_CORE.Fanuc
|
||||
|
||||
|
||||
//Get the process status
|
||||
public override CmsError PROC_RStatus(ushort Number, ref PROC_Status Status)
|
||||
public override CmsError PROC_RStatus(ushort Number, ref PROC_STATUS Status)
|
||||
{
|
||||
Focas1.ODBST StatInfo = new Focas1.ODBST();
|
||||
short nReturn;
|
||||
@@ -305,7 +305,7 @@ namespace CMS_CORE.Fanuc
|
||||
|
||||
|
||||
//Get the process Mode
|
||||
public override CmsError PROC_RMode(ushort Number, ref PROC_Mode Mode)
|
||||
public override CmsError PROC_RMode(ushort Number, ref PROC_MODE Mode)
|
||||
{
|
||||
Focas1.ODBST StatInfo = new Focas1.ODBST();
|
||||
short nReturn = 0;
|
||||
@@ -477,7 +477,53 @@ namespace CMS_CORE.Fanuc
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
// Check if the NC is in running state
|
||||
public override CmsError NC_RIsRunning(ref bool running)
|
||||
{
|
||||
ushort nProcess = 0;
|
||||
// Get the number of processes
|
||||
CmsError cmsError = NC_RProcessesNum(ref nProcess);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
ushort i = 1;
|
||||
running = false;
|
||||
do
|
||||
{
|
||||
PROC_STATUS procStatus = PROC_STATUS.IDLE;
|
||||
|
||||
// Read process status
|
||||
cmsError = PROC_RStatus(i, ref procStatus);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
if (procStatus == PROC_STATUS.RUN)
|
||||
running = true;
|
||||
i++;
|
||||
} while (!running || i <= nProcess);
|
||||
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
// Get process part program data
|
||||
public override CmsError PROC_RPartProgramData(ushort procNumber, ref ProcessPartProgramData processData)
|
||||
{
|
||||
processData.Id = procNumber;
|
||||
// Read part program name
|
||||
CmsError cmsError = PROC_RPPName(procNumber, ref processData.PartProgramName);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
// Read process status
|
||||
cmsError = PROC_RStatus(procNumber, ref processData.Status);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
// Read part program info visibility
|
||||
processData.Visible = true;
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
//Get the PMC Messages
|
||||
public override CmsError PLC_RActiveMessages(ref List<AlarmModel> alarms)
|
||||
@@ -1647,47 +1693,47 @@ namespace CMS_CORE.Fanuc
|
||||
|
||||
|
||||
//Manage the Status Process
|
||||
private PROC_Status ConverToSTEPStatus(Focas1.ODBST status)
|
||||
private PROC_STATUS ConverToSTEPStatus(Focas1.ODBST status)
|
||||
{
|
||||
if (status.emergency != 0)
|
||||
return PROC_Status.EMERG;
|
||||
return PROC_STATUS.EMERG;
|
||||
|
||||
if (status.alarm != 0)
|
||||
return PROC_Status.ERROR;
|
||||
return PROC_STATUS.ERROR;
|
||||
|
||||
switch (status.run)
|
||||
{
|
||||
case 0: return PROC_Status.IDLE;
|
||||
case 1: return PROC_Status.HOLD;
|
||||
case 2: return PROC_Status.RUN;
|
||||
case 3: return PROC_Status.RUN;
|
||||
case 4: return PROC_Status.RUN;
|
||||
case 5: return PROC_Status.RUN;
|
||||
case 7: return PROC_Status.RUN;
|
||||
case 8: return PROC_Status.RESET;
|
||||
case 0: return PROC_STATUS.IDLE;
|
||||
case 1: return PROC_STATUS.HOLD;
|
||||
case 2: return PROC_STATUS.RUN;
|
||||
case 3: return PROC_STATUS.RUN;
|
||||
case 4: return PROC_STATUS.RUN;
|
||||
case 5: return PROC_STATUS.RUN;
|
||||
case 7: return PROC_STATUS.RUN;
|
||||
case 8: return PROC_STATUS.RESET;
|
||||
}
|
||||
return PROC_Status.ERROR;
|
||||
return PROC_STATUS.ERROR;
|
||||
}
|
||||
|
||||
|
||||
//Manage the Status Mode
|
||||
private PROC_Mode ConverToSTEPMode(Focas1.ODBST status)
|
||||
private PROC_MODE ConverToSTEPMode(Focas1.ODBST status)
|
||||
{
|
||||
switch (status.aut)
|
||||
{
|
||||
case 0: return PROC_Mode.MDI;
|
||||
case 1: return PROC_Mode.AUTO;
|
||||
case 2: return PROC_Mode.ERROR;
|
||||
case 3: return PROC_Mode.EDIT;
|
||||
case 4: return PROC_Mode.HANDLE;
|
||||
case 5: return PROC_Mode.JOG;
|
||||
case 6: return PROC_Mode.TEACH;
|
||||
case 7: return PROC_Mode.TEACH;
|
||||
case 8: return PROC_Mode.JOGINC;
|
||||
case 9: return PROC_Mode.REF;
|
||||
case 10: return PROC_Mode.REMOTE;
|
||||
case 0: return PROC_MODE.MDI;
|
||||
case 1: return PROC_MODE.AUTO;
|
||||
case 2: return PROC_MODE.ERROR;
|
||||
case 3: return PROC_MODE.EDIT;
|
||||
case 4: return PROC_MODE.HANDLE;
|
||||
case 5: return PROC_MODE.JOG;
|
||||
case 6: return PROC_MODE.TEACH;
|
||||
case 7: return PROC_MODE.TEACH;
|
||||
case 8: return PROC_MODE.JOGINC;
|
||||
case 9: return PROC_MODE.REF;
|
||||
case 10: return PROC_MODE.REMOTE;
|
||||
}
|
||||
return PROC_Mode.ERROR;
|
||||
return PROC_MODE.ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -1733,12 +1779,12 @@ namespace CMS_CORE.Fanuc
|
||||
|
||||
//Execute the method
|
||||
nReturn1 = Focas1.cnc_sysinfo(nLibHandle[0], node);
|
||||
nReturn2 = Focas1.cnc_rdcncid(nLibHandle[0], out SerialNumber);
|
||||
nReturn2 = Focas1.cnc_rdcncid(nLibHandle[0], out SerialNumber);
|
||||
|
||||
//Throw Exception if there's an error
|
||||
if (nReturn1 != 0)
|
||||
return GetNcError(nReturn1);
|
||||
else if(nReturn2 != 0 && nReturn2 != 1)
|
||||
else if (nReturn2 != 0 && nReturn2 != 1)
|
||||
return GetNcError(nReturn2);
|
||||
else
|
||||
{
|
||||
|
||||
+54
-22
@@ -292,20 +292,15 @@ namespace CMS_CORE
|
||||
|
||||
/**
|
||||
* <summary>
|
||||
* Read the status of the Power on data ( Pre-Power-On / Post-Power-On )
|
||||
* Check if the NC is in running state
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* </summary>
|
||||
* <param name="powerOnModel"> Reference to the structure where the power on data will be saved</param>
|
||||
**/
|
||||
public abstract CmsError Nc_RPowerOnData(ref PreAndPostPowerOnModel powerOnModel);
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
public abstract CmsError Nc_WPowerOnData(uint id, bool value);
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="running">Reference to boolean where running state will be saved</param>
|
||||
* */
|
||||
public abstract CmsError NC_RIsRunning(ref bool running);
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -389,6 +384,31 @@ namespace CMS_CORE
|
||||
* */
|
||||
public abstract CmsError PLC_RActiveMessages(ref List<AlarmModel> Alarms);
|
||||
|
||||
/**
|
||||
* <summary>
|
||||
* Read the status of the Power on data ( Pre-Power-On / Post-Power-On )
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* </summary>
|
||||
* <param name="powerOnModel"> Reference to the structure where the power on data will be saved</param>
|
||||
**/
|
||||
public abstract CmsError Nc_RPowerOnData(ref PreAndPostPowerOnModel powerOnModel);
|
||||
|
||||
/**
|
||||
* <summary>
|
||||
* Write the status of the Power on data ( Pre-Power-On / Post-Power-On )
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* </summary>
|
||||
* <param name="id"> Id of the edited power on data </param>
|
||||
* <param name="value"> New value of the power on data</param>
|
||||
**/
|
||||
public abstract CmsError Nc_WPowerOnData(uint id, bool value);
|
||||
|
||||
#endregion
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -397,7 +417,7 @@ namespace CMS_CORE
|
||||
/**
|
||||
* <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>See <see cref="Nc.PROC_STATUS"/> for information about the PROC_Status type</para>
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
@@ -406,12 +426,12 @@ namespace CMS_CORE
|
||||
* <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);
|
||||
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>See <see cref="Nc.PROC_MODE"/> for information about the PROC_Status type</para>
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Demo | Siemens
|
||||
* </para>
|
||||
@@ -420,7 +440,7 @@ namespace CMS_CORE
|
||||
* <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);
|
||||
public abstract CmsError PROC_RMode(ushort ProcNumber, ref PROC_MODE Mode);
|
||||
|
||||
|
||||
/**
|
||||
@@ -445,10 +465,10 @@ namespace CMS_CORE
|
||||
* </para>
|
||||
* </summary>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="ProcNumber">Process to execute the action</param>
|
||||
* <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);
|
||||
public abstract CmsError PROC_RPPLines(ushort procNumber, ref List<String> Lines);
|
||||
|
||||
|
||||
/**
|
||||
@@ -459,12 +479,22 @@ namespace CMS_CORE
|
||||
* </para>
|
||||
* </summary>
|
||||
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
|
||||
* <param name="ProcNumber">Process to execute the action</param>
|
||||
* <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);
|
||||
|
||||
public abstract CmsError PROC_RPPName(ushort procNumber, ref String Name);
|
||||
|
||||
/**
|
||||
*<summary>
|
||||
* Read process active part program generic data
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai | Siemens
|
||||
* </para>
|
||||
* <param name="procNumber">Process to execute the action</param>
|
||||
* <param name="processData">Reference to part program data structure</param>
|
||||
* </summary>
|
||||
**/
|
||||
public abstract CmsError PROC_RPartProgramData(ushort procNumber, ref ProcessPartProgramData processData);
|
||||
#endregion
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1000,7 +1030,7 @@ namespace CMS_CORE
|
||||
|
||||
|
||||
/** <summary>Process-Status</summary> */
|
||||
public enum PROC_Status : ushort
|
||||
public enum PROC_STATUS : ushort
|
||||
{
|
||||
/** <summary>Idle-Status</summary> */
|
||||
IDLE = 1,
|
||||
@@ -1018,7 +1048,7 @@ namespace CMS_CORE
|
||||
|
||||
|
||||
/** <summary>CMS-Process-Mode</summary> */
|
||||
public enum PROC_Mode : ushort
|
||||
public enum PROC_MODE : ushort
|
||||
{
|
||||
/** <summary>Automatic-Mode</summary> */
|
||||
AUTO = 1,
|
||||
@@ -1202,7 +1232,8 @@ namespace CMS_CORE
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#region Helper Function
|
||||
internal void AddAlarmToList(uint id, string message, List<AlarmModel> alarms)
|
||||
{
|
||||
alarms.Add(new AlarmModel()
|
||||
@@ -1224,5 +1255,6 @@ namespace CMS_CORE
|
||||
process = process
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ using System.Text;
|
||||
using CMS_CORE_Library.OPENControl;
|
||||
using System.ComponentModel;
|
||||
using static CMS_CORE_Library.DataStructures;
|
||||
|
||||
using CMS_CORE_Library;
|
||||
|
||||
namespace CMS_CORE.Osai
|
||||
{
|
||||
@@ -141,8 +141,6 @@ namespace CMS_CORE.Osai
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Get the NC Serial Number
|
||||
public override CmsError NC_RSerialNumber(ref string SN)
|
||||
{
|
||||
@@ -247,6 +245,35 @@ namespace CMS_CORE.Osai
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
// Check if the NC is in running state
|
||||
public override CmsError NC_RIsRunning(ref bool running)
|
||||
{
|
||||
ushort nProcess = 0;
|
||||
// Get the number of processes
|
||||
CmsError cmsError = NC_RProcessesNum(ref nProcess);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
ushort i = 1;
|
||||
running = false;
|
||||
do
|
||||
{
|
||||
PROC_STATUS procStatus = PROC_STATUS.IDLE;
|
||||
|
||||
// Read process status
|
||||
cmsError = PROC_RStatus(i, ref procStatus);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
// If one process is runninc, nc is running
|
||||
if (procStatus == PROC_STATUS.RUN)
|
||||
running = true;
|
||||
i++;
|
||||
} while (!running || i <= nProcess);
|
||||
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
//Get the PLC Active Alarms
|
||||
public override CmsError PLC_RActiveMessages(ref List<AlarmModel> alarms)
|
||||
{
|
||||
@@ -386,7 +413,7 @@ namespace CMS_CORE.Osai
|
||||
}
|
||||
|
||||
//Get the process status
|
||||
public override CmsError PROC_RStatus(ushort Number, ref PROC_Status Status)
|
||||
public override CmsError PROC_RStatus(ushort Number, ref PROC_STATUS Status)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
@@ -421,7 +448,7 @@ namespace CMS_CORE.Osai
|
||||
|
||||
|
||||
//Get the process mode
|
||||
public override CmsError PROC_RMode(ushort Number, ref PROC_Mode Mode)
|
||||
public override CmsError PROC_RMode(ushort Number, ref PROC_MODE Mode)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
@@ -592,7 +619,24 @@ namespace CMS_CORE.Osai
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
// Get process part program data
|
||||
public override CmsError PROC_RPartProgramData(ushort procNumber, ref ProcessPartProgramData processData)
|
||||
{
|
||||
processData.Id = procNumber;
|
||||
// Read part program name
|
||||
CmsError cmsError = PROC_RPPName(procNumber, ref processData.PartProgramName);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
// Read process status
|
||||
cmsError = PROC_RStatus(procNumber, ref processData.Status);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
// Read part program info visibility
|
||||
processData.Visible = true;
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
//Get a dictionary with the Actual position of the axes in Process
|
||||
public override CmsError AXES_RInterpPosition(ushort Process, ref Dictionary<String, double> Axes)
|
||||
@@ -1670,40 +1714,40 @@ namespace CMS_CORE.Osai
|
||||
|
||||
|
||||
//Manage the Status Process
|
||||
private PROC_Status ConverToSTEPStatus(ushort status)
|
||||
private PROC_STATUS ConverToSTEPStatus(ushort status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case 1: return PROC_Status.IDLE;
|
||||
case 2: return PROC_Status.RUN;
|
||||
case 3: return PROC_Status.HOLD;
|
||||
case 4: return PROC_Status.HOLD;
|
||||
case 5: return PROC_Status.HOLD;
|
||||
case 6: return PROC_Status.ERROR;
|
||||
case 7: return PROC_Status.RUN;
|
||||
case 8: return PROC_Status.RESET;
|
||||
case 9: return PROC_Status.EMERG;
|
||||
case 10: return PROC_Status.RUN;
|
||||
case 1: return PROC_STATUS.IDLE;
|
||||
case 2: return PROC_STATUS.RUN;
|
||||
case 3: return PROC_STATUS.HOLD;
|
||||
case 4: return PROC_STATUS.HOLD;
|
||||
case 5: return PROC_STATUS.HOLD;
|
||||
case 6: return PROC_STATUS.ERROR;
|
||||
case 7: return PROC_STATUS.RUN;
|
||||
case 8: return PROC_STATUS.RESET;
|
||||
case 9: return PROC_STATUS.EMERG;
|
||||
case 10: return PROC_STATUS.RUN;
|
||||
}
|
||||
return PROC_Status.ERROR;
|
||||
return PROC_STATUS.ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Manage the Mode Process
|
||||
private PROC_Mode ConverToSTEPMode(ushort status)
|
||||
private PROC_MODE ConverToSTEPMode(ushort status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case 1: return PROC_Mode.MDI;
|
||||
case 2: return PROC_Mode.AUTO;
|
||||
case 3: return PROC_Mode.AUTO;
|
||||
case 4: return PROC_Mode.JOG;
|
||||
case 5: return PROC_Mode.JOGINC;
|
||||
case 6: return PROC_Mode.RETPROF;
|
||||
case 7: return PROC_Mode.REF;
|
||||
case 1: return PROC_MODE.MDI;
|
||||
case 2: return PROC_MODE.AUTO;
|
||||
case 3: return PROC_MODE.AUTO;
|
||||
case 4: return PROC_MODE.JOG;
|
||||
case 5: return PROC_MODE.JOGINC;
|
||||
case 6: return PROC_MODE.RETPROF;
|
||||
case 7: return PROC_MODE.REF;
|
||||
}
|
||||
return PROC_Mode.ERROR;
|
||||
return PROC_MODE.ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -252,8 +252,38 @@ namespace CMS_CORE.Siemens
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// Check if the NC is in running state
|
||||
public override CmsError NC_RIsRunning(ref bool running)
|
||||
{
|
||||
ushort nProcess = 0;
|
||||
// Get the number of processes
|
||||
CmsError cmsError = NC_RProcessesNum(ref nProcess);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
ushort i = 1;
|
||||
running = false;
|
||||
do
|
||||
{
|
||||
PROC_STATUS procStatus = PROC_STATUS.IDLE;
|
||||
|
||||
// Read process status
|
||||
cmsError = PROC_RStatus(i, ref procStatus);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
if (procStatus == PROC_STATUS.RUN)
|
||||
running = true;
|
||||
i++;
|
||||
} while (!running || i <= nProcess);
|
||||
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
//Get the process Mode
|
||||
public override CmsError PROC_RMode(ushort ProcNumber, ref PROC_Mode Mode)
|
||||
public override CmsError PROC_RMode(ushort ProcNumber, ref PROC_MODE Mode)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
@@ -291,7 +321,7 @@ namespace CMS_CORE.Siemens
|
||||
|
||||
|
||||
//Get the process status
|
||||
public override CmsError PROC_RStatus(ushort ProcNumber, ref PROC_Status Status)
|
||||
public override CmsError PROC_RStatus(ushort ProcNumber, ref PROC_STATUS Status)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
@@ -450,7 +480,24 @@ namespace CMS_CORE.Siemens
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
// Get process part program data
|
||||
public override CmsError PROC_RPartProgramData(ushort procNumber, ref ProcessPartProgramData processData)
|
||||
{
|
||||
processData.Id = procNumber;
|
||||
// Read part program name
|
||||
CmsError cmsError = PROC_RPPName(procNumber, ref processData.PartProgramName);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
// Read process status
|
||||
cmsError = PROC_RStatus(procNumber, ref processData.Status);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
// Read part program info visibility
|
||||
processData.Visible = true;
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
//Get a dictionary with the Actual position of the axes in Process
|
||||
public override CmsError AXES_RInterpPosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
|
||||
@@ -1104,39 +1151,39 @@ namespace CMS_CORE.Siemens
|
||||
|
||||
|
||||
//Manage the Mode
|
||||
private PROC_Mode ConvertToSTEPMode(uint mode, uint JogMode, uint AdvMode)
|
||||
private PROC_MODE ConvertToSTEPMode(uint mode, uint JogMode, uint AdvMode)
|
||||
{
|
||||
if (mode == 0)
|
||||
{
|
||||
if (AdvMode == 0)
|
||||
return (JogMode < 6) ? PROC_Mode.JOGINC : PROC_Mode.JOG;
|
||||
return (JogMode < 6) ? PROC_MODE.JOGINC : PROC_MODE.JOG;
|
||||
else if (AdvMode == 1)
|
||||
return PROC_Mode.RETPROF;
|
||||
return PROC_MODE.RETPROF;
|
||||
else if (AdvMode == 2)
|
||||
return PROC_Mode.TEACH;
|
||||
return PROC_MODE.TEACH;
|
||||
else if (AdvMode == 3)
|
||||
return PROC_Mode.REF;
|
||||
return PROC_MODE.REF;
|
||||
}
|
||||
else if (mode == 1)
|
||||
return PROC_Mode.MDI;
|
||||
return PROC_MODE.MDI;
|
||||
else if (mode == 2)
|
||||
return PROC_Mode.AUTO;
|
||||
return PROC_MODE.AUTO;
|
||||
|
||||
return PROC_Mode.ERROR;
|
||||
return PROC_MODE.ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Manage the Status
|
||||
private PROC_Status ConvertToSTEPStatus(uint status)
|
||||
private PROC_STATUS ConvertToSTEPStatus(uint status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case 0: return PROC_Status.IDLE;
|
||||
case 1: return PROC_Status.RUN;
|
||||
case 2: return PROC_Status.HOLD;
|
||||
case 0: return PROC_STATUS.IDLE;
|
||||
case 1: return PROC_STATUS.RUN;
|
||||
case 2: return PROC_STATUS.HOLD;
|
||||
}
|
||||
return PROC_Status.ERROR;
|
||||
return PROC_STATUS.ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user