Fixed Nc_Demo

Added functionality 
Added Axes Reset
This commit is contained in:
Lucio Maranta
2018-02-07 16:08:31 +00:00
parent 1af30e3e15
commit d08bf19bc5
9 changed files with 1427 additions and 1555 deletions
+13 -31
View File
@@ -71,6 +71,7 @@ namespace CMS_CORE_Application
List<AlarmModel> ncAlarms = new List<AlarmModel>();
List<String> Lines = new List<string>();
PostPowerOnModel postPowerOn = new PostPowerOnModel();
AxisResetDataModel axisResetDataModel = new AxisResetDataModel();
N = SetNcByType();
@@ -118,23 +119,6 @@ namespace CMS_CORE_Application
error = true;
SetError(Lines, cmsError);
}
//cmsError = N.PROC_RPPLines(1, ref Lines);
//if (cmsError.IsError())
//{
// error = true;
// SetError(Lines, cmsError);
//}
//cmsError = N.PROC_RPPName(1, ref PPName);
//if (cmsError.IsError())
//{
// error = true;
// SetError(Lines, cmsError);
//}
ProcessData process = new ProcessData();
sw.Restart();
cmsError = N.PROC_RStatus(1, ref process);
sw.Stop();
cmsError = N.NC_RDateTime(ref NcTime);
if (cmsError.IsError())
@@ -142,16 +126,14 @@ namespace CMS_CORE_Application
error = true;
SetError(Lines, cmsError);
}
List<FunctionalityModel> a = null;
cmsError = N.PLC_RFunctionAccess(ref a);
PreAndPostPowerOnModel preAndPostPowerOnModel = new PreAndPostPowerOnModel();
cmsError = N.Nc_RPowerOnData(ref preAndPostPowerOnModel);
if (cmsError.IsError())
{
error = true;
SetError(Lines, cmsError);
}
PreAndPostPowerOnModel preAndPostPowerOnModel = new PreAndPostPowerOnModel();
cmsError = N.Nc_WPowerOnData(10, true);
N.PLC_RAxesResetData(ref axisResetDataModel);
cmsError = N.PLC_RPowerOnData(ref preAndPostPowerOnModel);
if (cmsError.IsError())
{
error = true;
@@ -169,9 +151,9 @@ namespace CMS_CORE_Application
TXTMachNum.Text = MachNumber;
TXTSft.Text = SFTVersion;
TXTTime.Text = sw.ElapsedMilliseconds.ToString() + " mS";
TXTAlm.Text = String.Join(Environment.NewLine, procAlarms.Select(x => x.message));
TXTAlmNc.Text = String.Join(Environment.NewLine, ncAlarms.Select(x => x.message));
TXTMsg.Text = String.Join(Environment.NewLine, Msg.Select(x => x.message));
TXTAlm.Text = String.Join(Environment.NewLine, procAlarms.Select(x => x.Message));
TXTAlmNc.Text = String.Join(Environment.NewLine, ncAlarms.Select(x => x.Message));
TXTMsg.Text = String.Join(Environment.NewLine, Msg.Select(x => x.Message));
TXTPPName.Text = PPName;
TXTNow.Text = NcTime.ToString();
@@ -207,16 +189,16 @@ namespace CMS_CORE_Application
{
stopwatch.Restart();
// Read next tool area
N.MEM_RWByte(Nc.R, 0, Nc.MEMORY_Type.Fanuc_R, 8000, 1, ref id);
N.MEM_RWByte(Nc.R, 0, Nc.MEMORY_TYPE.Fanuc_R, 8000, 1, ref id);
// if not empty
if (id != 0)
{
ToolModel tool = RicercaPerManina(id);
List<int> list = new List<int>() { id, tool.FamilyId, tool.ShankId};
N.MEM_RWIntegerList(Nc.W, 0, Nc.MEMORY_Type.Fanuc_R, 8001, 0, ref list);
N.MEM_RWIntegerList(Nc.W, 0, Nc.MEMORY_TYPE.Fanuc_R, 8001, 0, ref list);
id = 0;
N.MEM_RWByte(Nc.W, 0, Nc.MEMORY_Type.Fanuc_R, 8000, 1, ref id);
N.MEM_RWByte(Nc.W, 0, Nc.MEMORY_TYPE.Fanuc_R, 8000, 1, ref id);
stopwatch.Stop();
Debug.WriteLine(stopwatch.ElapsedMilliseconds.ToString());
}
+70 -52
View File
@@ -9,6 +9,76 @@ namespace CMS_CORE_Library
{
public static class DataStructures
{
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Data structor models
public struct PreAndPostPowerOnModel
{
public PrePowerOnModel prePowerOn;
public PostPowerOnModel postPowerOn;
}
public struct PowerOnDataModel
{
public uint Id;
public bool Active;
public bool Clickable;
}
public class PrePowerOnModel
{
public PowerOnDataModel PowerOn;
public PowerOnDataModel AirPressure;
public PowerOnDataModel ProtectionStatus;
public PowerOnDataModel EmergencyButtons;
public PowerOnDataModel SettingMode;
public PowerOnDataModel StartingKey;
}
public class PostPowerOnModel
{
public PowerOnDataModel AxisReset;
public PowerOnDataModel WaterjetPump;
}
public class AlarmModel
{
public uint Id;
public string Message;
public bool IsWarning;
public int Process;
}
public class ProcessDataModel
{
public ushort Id;
public string Type;
public bool IsInAlarm;
public string PartProgramName;
public string Status;
public bool Visible;
public byte Reps;
}
public struct FunctionalityModel
{
public uint Id;
public bool IsActive;
}
public struct StrobeModel
{
public uint Id;
public bool IsActive;
}
public struct AxisResetDataModel
{
public bool IsActive;
public int Percentage;
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Cms Errors Codes
@@ -71,57 +141,5 @@ namespace CMS_CORE_Library
internal static CmsError SIEMENS_HMI_NOT_RUNNING_ERROR = new CmsError(CMS_ERROR_CODES.SIEMENS_HMI_NOT_RUNNING, "CMS-Core-Error: Siemens HMI is not Running / Ready");
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Data structor models
public struct PreAndPostPowerOnModel
{
public PrePowerOnModel prePowerOn;
public PostPowerOnModel postPowerOn;
}
public struct PowerOnDataModel
{
public uint Id;
public bool Active;
public bool Clickable;
}
public class PrePowerOnModel
{
public PowerOnDataModel PowerOn;
public PowerOnDataModel AirPressure;
public PowerOnDataModel ProtectionStatus;
public PowerOnDataModel EmergencyButtons;
public PowerOnDataModel SettingMode;
public PowerOnDataModel StartingKey;
}
public class PostPowerOnModel
{
public PowerOnDataModel AxisReset;
public PowerOnDataModel WaterjetPump;
}
public class AlarmModel
{
public uint id;
public string message;
public bool isWarning;
public int process;
}
public class ProcessData
{
public ushort Id;
public string Type;
public bool IsInAlarm;
public string PartProgramName;
public string Status;
public bool Visible;
public byte Reps;
}
#endregion
}
}
+219 -126
View File
@@ -1,28 +1,27 @@
using System;
using CMS_CORE.Demo.Models;
using CMS_CORE.Utils;
using CMS_CORE_Library.Demo.Models;
using Nc_Demo_Application.Server.Service;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Description;
using CMS_CORE.Demo.Models;
using CMS_CORE_Library.Demo.Models;
using Nc_Demo_Application.Server.Service;
using CMS_CORE.Utils;
using static CMS_CORE_Library.DataStructures;
using System.Collections;
using static CMS_CORE.Nc;
namespace CMS_CORE.Demo
{
public class Nc_Demo : Nc
{
private EndpointAddress serverAddress;
private ChannelFactory<ILibraryService> cf;
private ILibraryService serverService;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Contructor & global methods
public Nc_Demo(String IpAddress, ushort RemotePort)
@@ -65,9 +64,10 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
#endregion
#endregion Contructor & global methods
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region High level methods
public override CmsError NC_RDateTime(ref DateTime ActualTime)
@@ -201,7 +201,7 @@ namespace CMS_CORE.Demo
try
{
// Get language from Demo server
// Get language from Demo server
string demoLanguage = "";
serverService.GetLanguage(out demoLanguage);
@@ -222,7 +222,69 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
public override CmsError Nc_RPowerOnData(ref PreAndPostPowerOnModel powerOnModel)
// 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 High level methods
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region PLC High-level data
public override CmsError PLC_RActiveMessages(ref List<AlarmModel> alarms)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
if (cmsError.IsError())
return cmsError;
try
{
alarms.Clear();
List<NcAlarmModel> demoAlarms;
// Get Alarms from server
serverService.GetProcessesAlarms(out demoAlarms);
// Parse response
foreach (NcAlarmModel demoAlarm in demoAlarms)
{
AddAlarmToList((uint)demoAlarm.code, demoAlarm.text, alarms);
}
}
catch (Exception ex)
{
return ManageException(ex);
}
return NO_ERROR;
}
public override CmsError PLC_RPowerOnData(ref PreAndPostPowerOnModel powerOnModel)
{
try
{
@@ -267,7 +329,7 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
public override CmsError Nc_WPowerOnData(uint id, bool value)
public override CmsError PLC_WPowerOnData(uint id, bool value)
{
try
{
@@ -276,72 +338,15 @@ namespace CMS_CORE.Demo
if (id > 16)
return INCORRECT_PARAMETERS_ERROR;
// Choose Pre-Power-On or Post-Power-Om
if (id <= 8)
if (id < 8)
// Pre: memory bit = id
cmsError = MEM_RWBoolean(W, 0, MEMORY_ADDRESS.PRE_POWER_ON_CLICKED.MemType, MEMORY_ADDRESS.PRE_POWER_ON_CLICKED.Address, (int)id, ref value);
else
// Post: memory bit = id - 8
cmsError = MEM_RWBoolean(W, 0, MEMORY_ADDRESS.POST_POWER_ON_CLICKED.MemType, MEMORY_ADDRESS.POST_POWER_ON_CLICKED.Address, (int)id - 8, ref value);
}
catch (Exception ex)
{
return ManageException(ex);
}
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
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region PLC High-level data
public override CmsError PLC_RActiveMessages(ref List<AlarmModel> alarms)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
if (cmsError.IsError())
return cmsError;
try
{
alarms.Clear();
List<NcAlarmModel> demoAlarms;
// Get Alarms from server
serverService.GetProcessesAlarms(out demoAlarms);
// Parse response
foreach (NcAlarmModel demoAlarm in demoAlarms)
{
AddAlarmToList((uint)demoAlarm.code, demoAlarm.text, alarms);
}
}
catch (Exception ex)
{
@@ -351,9 +356,80 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
#endregion
public override CmsError PLC_RFunctionAccess(ref List<FunctionalityModel> functions)
{
List<int> readValue = new List<int>();
// Read functions access data from memory
CmsError cmsError = MEM_RWIntegerList(R, 0, MEMORY_ADDRESS.FUNCTION_ACCESS.MemType, MEMORY_ADDRESS.FUNCTION_ACCESS.Address, 4, ref readValue);
if (cmsError.IsError())
return cmsError;
functions = new List<FunctionalityModel>();
// Convert int into to true/false array
bool[] bits = new BitArray(readValue.ToArray()).Cast<bool>().ToArray();
// Convert array into structured data
for (int i = 0; i < bits.Count(); i++)
{
functions.Add(new FunctionalityModel()
{
Id = (uint)i,
IsActive = bits[i]
});
}
return NO_ERROR;
}
public override CmsError PLC_RAxesResetData(ref AxisResetDataModel axisResetData)
{
byte value = 0;
// Read byte from memory
CmsError cmsError = MEM_RWByte(R, 0, MEMORY_ADDRESS.AXIS_RESET_PROCEDURE.MemType, MEMORY_ADDRESS.AXIS_RESET_PROCEDURE.Address, 1, ref value);
if (cmsError.IsError())
return cmsError;
// Check last bit
if ((value & 128) == 128)
{
// Set to 0 last bit and 7 bit percentage and check if is higher than 100
byte percentage = value - 128 > 100 ? (byte)100 : (byte)(value - 128);
axisResetData = new AxisResetDataModel()
{
IsActive = true,
Percentage = percentage
};
}
return NO_ERROR;
}
//public override CmsError PLC_RStrobe(ref List<StrobeModel> functions)
//{
// List<int> readValue = new List<int>();
// // Read functions access data from memory
// CmsError cmsError = MEM_RWIntegerList(R, 0, MEMORY_ADDRESS.FUNCTION_ACCESS.MemType, MEMORY_ADDRESS.FUNCTION_ACCESS.Address, 4, ref readValue);
// if (cmsError.IsError())
// return cmsError;
// functions = new List<StrobeModel>();
// // Convert int into to true/false array
// bool[] bits = new BitArray(readValue.ToArray()).Cast<bool>().ToArray();
// // Convert array into structured data
// for (int i = 0; i < bits.Count(); i++)
// {
// functions.Add(new StrobeModel()
// {
// id = (uint)i,
// isActive = bits[i]
// });
// }
// return NO_ERROR;
//}
#endregion PLC High-level data
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region PROCESS (PATH) High-level data
public override CmsError PROC_RStatus(ushort ProcNumber, ref PROC_STATUS Status)
@@ -432,7 +508,7 @@ namespace CMS_CORE.Demo
}
// Get process part program data
public override CmsError PROC_RStatus(ushort procNumber, ref ProcessData processData)
public override CmsError PROC_RStatusAndData(ushort procNumber, ref ProcessDataModel processData)
{
processData.Id = procNumber;
// Read part program name
@@ -449,7 +525,7 @@ namespace CMS_CORE.Demo
byte[] bytes = BitConverter.GetBytes(readValue);
// Convert Byte into true/false array
BitArray bits = new BitArray(new byte[] { bytes[0] }); //1st byte -> 0 : Proccess type (AUX-WORK), 1: Process in alarm status, 2: Run, 3: Hold, 4: Read, 5: PartProgramVisible
BitArray bits = new BitArray(new byte[] { bytes[0] }); //1st byte -> 0 : Proccess type (AUX-WORK), 1: Process in alarm status, 2: Run, 3: Hold, 4: Read, 5: PartProgramVisible
// Populate response structure
processData.Type = bits[0] ? "WORK" : "AUX";
processData.IsInAlarm = bits[1];
@@ -463,20 +539,21 @@ namespace CMS_CORE.Demo
processData.Status = "HOLD";
else
processData.Status = "READY";
}
}
// Get Reps from 2nd byte
processData.Reps = bytes[1];
// Get part program info visibility
processData.Visible = bits[5];
processData.Visible = bits[4];
return NO_ERROR;
}
#endregion
#endregion PROCESS (PATH) High-level data
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region PROCESS-AXES (PATH) High-level data
public override CmsError AXES_RInterpPosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
@@ -604,12 +681,13 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
#endregion
#endregion PROCESS-AXES (PATH) High-level data
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region NC Low-level function: single valiable in memory
public override CmsError MEM_RWBoolean(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemBit, ref bool Value)
public override CmsError MEM_RWBoolean(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, int MemBit, ref bool Value)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
@@ -643,7 +721,7 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
public override CmsError MEM_RWByte(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemByte, ref byte Value)
public override CmsError MEM_RWByte(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, int MemByte, ref byte Value)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
@@ -672,7 +750,7 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
public override CmsError MEM_RWWord(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref ushort Value)
public override CmsError MEM_RWWord(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, ref ushort Value)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
@@ -701,7 +779,7 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
public override CmsError MEM_RWShort(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref short Value)
public override CmsError MEM_RWShort(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, ref short Value)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
@@ -730,7 +808,7 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
public override CmsError MEM_RWDWord(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref uint Value)
public override CmsError MEM_RWDWord(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, ref uint Value)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
@@ -759,7 +837,7 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
public override CmsError MEM_RWInteger(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref int Value)
public override CmsError MEM_RWInteger(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, ref int Value)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
@@ -788,71 +866,71 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
//--------------------------------------------------------------------------------------------------------------------------
// Siemens Version of Memory-Access Methods
public override CmsError MEM_RWBoolean(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemBit, ref bool Value)
public override CmsError MEM_RWBoolean(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int MemBit, ref bool Value)
{
return MEM_RWBoolean(bWrite, Process, MemType, MemIndex, MemBit, ref Value);
}
public override CmsError MEM_RWByte(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemByte, ref byte Value)
public override CmsError MEM_RWByte(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int MemByte, ref byte Value)
{
return MEM_RWByte(bWrite, Process, MemType, MemIndex, MemByte, ref Value);
}
public override CmsError MEM_RWWord(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref ushort Value)
public override CmsError MEM_RWWord(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, ref ushort Value)
{
return MEM_RWWord(bWrite, Process, MemType, MemIndex, MemIndex, ref Value);
}
public override CmsError MEM_RWShort(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref short Value)
public override CmsError MEM_RWShort(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, ref short Value)
{
return MEM_RWShort(bWrite, Process, MemType, MemIndex, MemIndex, ref Value);
}
public override CmsError MEM_RWDWord(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref uint Value)
public override CmsError MEM_RWDWord(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, ref uint Value)
{
return MEM_RWDWord(bWrite, Process, MemType, MemIndex, MemIndex, ref Value);
}
public override CmsError MEM_RWInteger(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref int Value)
public override CmsError MEM_RWInteger(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, ref int Value)
{
return MEM_RWInteger(bWrite, Process, MemType, MemIndex, MemIndex, ref Value);
}
public override CmsError MEM_RWByteList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemByteStart, int Number, ref List<byte> Value)
public override CmsError MEM_RWByteList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int MemByteStart, int Number, ref List<byte> Value)
{
return MEM_RWByteList(bWrite, Process, MemType, MemIndex, MemByteStart, Number, ref Value);
}
public override CmsError MEM_RWWordList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<ushort> Value)
public override CmsError MEM_RWWordList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<ushort> Value)
{
return MEM_RWWordList(bWrite, Process, MemType, MemIndex, Number, ref Value);
}
public override CmsError MEM_RWShortList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<short> Value)
public override CmsError MEM_RWShortList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<short> Value)
{
return MEM_RWShortList(bWrite, Process, MemType, MemIndex, Number, ref Value);
}
public override CmsError MEM_RWDWordList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<uint> Value)
public override CmsError MEM_RWDWordList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<uint> Value)
{
return MEM_RWDWordList(bWrite, Process, MemType, MemIndex, Number, ref Value);
}
public override CmsError MEM_RWIntegerList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<int> Value)
public override CmsError MEM_RWIntegerList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<int> Value)
{
return MEM_RWIntegerList(bWrite, Process, MemType, MemIndex, Number, ref Value);
}
#endregion
#endregion NC Low-level function: single valiable in memory
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region NC Low-level function: variables List in memory
public override CmsError MEM_RWByteList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemByteStart, int Number, ref List<byte> Value)
public override CmsError MEM_RWByteList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, int MemByteStart, int Number, ref List<byte> Value)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
@@ -881,7 +959,7 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
public override CmsError MEM_RWWordList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<ushort> Value)
public override CmsError MEM_RWWordList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, int Number, ref List<ushort> Value)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
@@ -910,7 +988,7 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
public override CmsError MEM_RWShortList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<short> Value)
public override CmsError MEM_RWShortList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, int Number, ref List<short> Value)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
@@ -939,7 +1017,7 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
public override CmsError MEM_RWIntegerList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<int> Value)
public override CmsError MEM_RWIntegerList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, int Number, ref List<int> Value)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
@@ -968,7 +1046,7 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
public override CmsError MEM_RWDWordList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<uint> Value)
public override CmsError MEM_RWDWordList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, int Number, ref List<uint> Value)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
@@ -996,11 +1074,12 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
#endregion
#endregion NC Low-level function: variables List in memory
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region NC Low-level function: Parameters
#region NC Low-level function: Parameters
public override CmsError NC_RParam(short Index, short Bit, ref bool Value)
{
@@ -1026,9 +1105,11 @@ namespace CMS_CORE.Demo
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
#endregion
#endregion NC Low-level function: Parameters
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region File Management
public override CmsError FILES_RProgramToFile(string partProgramPath, FileStream localFile)
@@ -1118,9 +1199,11 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
#endregion
#endregion File Management
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Subordinate Private Functions
//Check if NC is connected
@@ -1190,23 +1273,33 @@ namespace CMS_CORE.Demo
return CmsError.NcError(message);
}
#endregion
#endregion Subordinate Private Functions
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Memory addresses
internal static class MEMORY_ADDRESS
{
internal const int STARTING_ADDRESS = 0;
internal static MEMORY_CELL FUNCTION_ACCESS = new MEMORY_CELL(MEMORY_TYPE.Demo, 13, 16);
internal static MEMORY_CELL STROBE = new MEMORY_CELL(MEMORY_TYPE.Demo, 29, 16);
internal static MEMORY_CELL PRE_POWER_ON = new MEMORY_CELL(MEMORY_TYPE.Demo, 45, 1);
internal static MEMORY_CELL PRE_POWER_ON_CLICKABLE = new MEMORY_CELL(MEMORY_TYPE.Demo, 46, 1);
internal static MEMORY_CELL POST_POWER_ON = new MEMORY_CELL(MEMORY_TYPE.Demo, 47, 1);
internal static MEMORY_CELL POST_POWER_ON_CLICKABLE = new MEMORY_CELL(MEMORY_TYPE.Demo, 48, 1);
internal static MEMORY_CELL PRE_POWER_ON_CLICKED = new MEMORY_CELL(MEMORY_TYPE.Demo, 49, 1);
internal static MEMORY_CELL POST_POWER_ON_CLICKED = new MEMORY_CELL(MEMORY_TYPE.Demo, 50, 1);
internal static MEMORY_CELL AXIS_RESET_PROCEDURE = new MEMORY_CELL(MEMORY_TYPE.Demo, 51, 7, 2);
internal static MEMORY_CELL PROCESS_STATUS = new MEMORY_CELL(MEMORY_TYPE.Demo, 55, 0, 16);
}
#endregion Memory addresses
}
internal static class MEMORY_ADDRESS
{
internal const int STARTING_ADDRESS = 0;
internal static MEMORY_CELL PRE_POWER_ON = new MEMORY_CELL(MEMORY_Type.Demo, 29, 0, 1);
internal static MEMORY_CELL PRE_POWER_ON_CLICKABLE = new MEMORY_CELL(MEMORY_Type.Demo, 30, 0, 1);
internal static MEMORY_CELL POST_POWER_ON = new MEMORY_CELL(MEMORY_Type.Demo, 31, 0, 1);
internal static MEMORY_CELL POST_POWER_ON_CLICKABLE = new MEMORY_CELL(MEMORY_Type.Demo, 32, 0, 1);
internal static MEMORY_CELL PRE_POWER_ON_CLICKED = new MEMORY_CELL(MEMORY_Type.Demo, 33, 0, 1);
internal static MEMORY_CELL POST_POWER_ON_CLICKED = new MEMORY_CELL(MEMORY_Type.Demo, 34, 0, 1);
internal static MEMORY_CELL PROCESS_STATUS = new MEMORY_CELL(MEMORY_Type.Demo, 37, 0, 1);
}
}
}
File diff suppressed because it is too large Load Diff
+94 -63
View File
@@ -394,7 +394,7 @@ namespace CMS_CORE
* </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 PLC_RPowerOnData(ref PreAndPostPowerOnModel powerOnModel);
/**
* <summary>
@@ -407,7 +407,30 @@ namespace CMS_CORE
* <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);
public abstract CmsError PLC_WPowerOnData(uint id, bool value);
/**
* <summary>
* Read the status of the functions of the UI
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* </summary>
**/
public abstract CmsError PLC_RFunctionAccess(ref List<FunctionalityModel> functions);
/**
* <summary>
* Read axes reset procedure data
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <param name="functions">Reference of the data of axes reset procedure</param>
* </summary>
**/
public abstract CmsError PLC_RAxesResetData(ref AxisResetDataModel axisResetData);
#endregion
@@ -494,7 +517,7 @@ namespace CMS_CORE
* <param name="processData">Reference to part program data structure</param>
* </summary>
**/
public abstract CmsError PROC_RStatus(ushort procNumber, ref ProcessData processData);
public abstract CmsError PROC_RStatusAndData(ushort procNumber, ref ProcessDataModel processData);
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -581,12 +604,12 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
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)
@@ -597,13 +620,13 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
public abstract CmsError MEM_RWBoolean(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int MemBit, ref Boolean Value);
@@ -616,12 +639,12 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
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)
@@ -632,13 +655,13 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
public abstract CmsError MEM_RWByte(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int MemByte, ref Byte Value);
@@ -651,12 +674,12 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
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)
@@ -667,13 +690,13 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
public abstract CmsError MEM_RWWord(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, ref ushort Value);
@@ -686,12 +709,12 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
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)
@@ -702,13 +725,13 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
public abstract CmsError MEM_RWShort(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, ref short Value);
@@ -721,12 +744,12 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
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)
@@ -737,13 +760,13 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
public abstract CmsError MEM_RWDWord(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, ref uint Value);
@@ -756,12 +779,12 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
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)
@@ -772,13 +795,13 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
public abstract CmsError MEM_RWInteger(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, ref int Value);
#endregion
@@ -794,13 +817,13 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
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)
@@ -811,14 +834,14 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
public abstract CmsError MEM_RWByteList(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int MemByteStart, int Number, ref List<Byte> Value);
@@ -831,12 +854,12 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
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)
@@ -847,13 +870,13 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
public abstract CmsError MEM_RWWordList(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<ushort> Value);
@@ -866,13 +889,13 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
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>
@@ -882,13 +905,13 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
public abstract CmsError MEM_RWShortList(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<short> Value);
@@ -901,12 +924,12 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
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)
@@ -917,13 +940,13 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
public abstract CmsError MEM_RWDWordList(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<uint> Value);
@@ -936,12 +959,12 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
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)
@@ -952,13 +975,13 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <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="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);
public abstract CmsError MEM_RWIntegerList(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<int> Value);
#endregion
@@ -1079,7 +1102,7 @@ namespace CMS_CORE
// R-W MEMORY Type
/** <summary>Nc Memory Type (Table)</summary> */
public enum MEMORY_Type
public enum MEMORY_TYPE
{
/** <summary>Null Type</summary> */
Null = -1,
@@ -1204,30 +1227,38 @@ namespace CMS_CORE
// R-W MEMORY Cell
internal struct MEMORY_CELL
{
public readonly MEMORY_Type MemType;
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)
public MEMORY_CELL(MEMORY_TYPE MType, int Addr, int SubAddr, int Sz)
{
MemType = MType;
Address = Addr;
SubAddress = SubAddr;
Size = Sz;
}
public MEMORY_CELL(MEMORY_TYPE MType, int Addr, int Sz)
{
MemType = MType;
Address = Addr;
SubAddress = 0;
Size = Sz;
}
}
//Lingua CN
internal MEMORY_CELL PARAM_LING_FANUC = new MEMORY_CELL(MEMORY_Type.Null, 3281, 0, 1);
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);
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);
internal MEMORY_CELL PLC_MESS_OSAI = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 12000, 0, 64);
#endregion
@@ -1238,10 +1269,10 @@ namespace CMS_CORE
{
alarms.Add(new AlarmModel()
{
id = id,
message = message,
isWarning = false,
process = 0
Id = id,
Message = message,
IsWarning = false,
Process = 0
});
}
@@ -1249,10 +1280,10 @@ namespace CMS_CORE
{
alarms.Add(new AlarmModel()
{
id = id,
message = message,
isWarning = false,
process = process
Id = id,
Message = message,
IsWarning = false,
Process = process
});
}
#endregion
File diff suppressed because it is too large Load Diff
+256 -321
View File
@@ -1,47 +1,49 @@
using System;
using CMS_CORE.Utils;
using Siemens.Sinumerik.Operate.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Globalization;
using System.IO;
using Siemens.Sinumerik.Operate.Services;
using System.Linq;
using System.Text.RegularExpressions;
using CMS_CORE.Utils;
using static CMS_CORE_Library.DataStructures;
using CMS_CORE_Library;
namespace CMS_CORE.Siemens
{
public class Nc_Siemens : Nc
{
// Global Constants
const string OptionHMINotRunning = "P66";
const string NcNotFound = "Missing response";
const string NcNotFound2 = "networking error";
const string NcNotFound3 = "Nc not Connected";
const string SinumerikEnvVar = "HMI_INSTALL_DIR";
const int IDMinPLCMessage = 700000;
const int IDMaxPLCMessage = 799999;
const int IDMinChannel = 10000;
const int IDMaxChannel = 19999;
private const string OptionHMINotRunning = "P66";
private const string NcNotFound = "Missing response";
private const string NcNotFound2 = "networking error";
private const string NcNotFound3 = "Nc not Connected";
private const string SinumerikEnvVar = "HMI_INSTALL_DIR";
private const int IDMinPLCMessage = 700000;
private const int IDMaxPLCMessage = 799999;
private const int IDMinChannel = 10000;
private const int IDMaxChannel = 19999;
// Siemens Path Constants
const string PathMaxChannelNo = "/Nck/Configuration/maxnumChannels";
const string PathConfChannelNo = "/Nck/Configuration/numChannels";
const string PathNcType = "/Nck/Configuration/nckType";
const string PathNcVersion = "/Nck/Configuration/nckVersion";
const string PathLanguage = "/Nck/Configuration/anLanguageOnHmi";
const string PathSerialNumber = "/Nck/State/hwProductSerialNrL";
const string PathNcTime = "/Nck/State/sysTimeBCD";
const string PathGenericNcMode = "/Bag/State/opMode";
const string PathGenericNcState = "/Channel/State/chanStatus";
const string PathIncrJog = "/Channel/GeometricAxis/actIncrVal";
const string PathAdvancedJog = "/Channel/State/machFunc";
const string PathRelatPosition = "/Channel/GeometricAxis/actToolBasPosEN";
const string PathActProgLines = "/Channel/ProgramInfo/actPartProgram";
const string PathActProgName = "/Channel/ProgramPointer/progName";
private const string PathMaxChannelNo = "/Nck/Configuration/maxnumChannels";
// Global Variables
private const string PathConfChannelNo = "/Nck/Configuration/numChannels";
private const string PathNcType = "/Nck/Configuration/nckType";
private const string PathNcVersion = "/Nck/Configuration/nckVersion";
private const string PathLanguage = "/Nck/Configuration/anLanguageOnHmi";
private const string PathSerialNumber = "/Nck/State/hwProductSerialNrL";
private const string PathNcTime = "/Nck/State/sysTimeBCD";
private const string PathGenericNcMode = "/Bag/State/opMode";
private const string PathGenericNcState = "/Channel/State/chanStatus";
private const string PathIncrJog = "/Channel/GeometricAxis/actIncrVal";
private const string PathAdvancedJog = "/Channel/State/machFunc";
private const string PathRelatPosition = "/Channel/GeometricAxis/actToolBasPosEN";
private const string PathActProgLines = "/Channel/ProgramInfo/actPartProgram";
private const string PathActProgName = "/Channel/ProgramPointer/progName";
// Global Variables
private DateTime Last_Static_Read;
private ushort TimeoutConn;
private String Cnc_name;
private String Cnc_SftVersion;
@@ -53,11 +55,12 @@ namespace CMS_CORE.Siemens
// STatic variables
private AlarmSvc SiemensAlmSvc;
private Alarm[] SiemensAlarms;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Contructor & global methods
#region Contructor & global methods
/**
* <summary>
@@ -65,6 +68,7 @@ namespace CMS_CORE.Siemens
* </summary>
* <param name="ConnectionTimeOut">Send/Recieve timeout connection [mS]</param>
* */
public Nc_Siemens(ushort ConnectionTimeOut)
{
//Set Connected to FALSE and close the session
@@ -75,14 +79,12 @@ namespace CMS_CORE.Siemens
SiemensAlarms = new Alarm[] { };
}
//Connect Method
public override CmsError NC_Connect()
{
//Try to get information
try
{
{
//Check if Siemens Environment is started
CmsError cmsError = CheckSiemensEnv();
if (cmsError.IsError())
@@ -100,7 +102,6 @@ namespace CMS_CORE.Siemens
SiemensAlarms = new Alarm[] { };
SiemensAlmSvc = new AlarmSvc(ConvertToSTEPLanguage(SiemensLanguage).ThreeLetterISOLanguageName);
SiemensAlmSvc.Subscribe(AlarmsChanged);
}
catch (Exception ex)
{
@@ -110,8 +111,6 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
//Disconnect Method
public override CmsError NC_Disconnect()
{
@@ -121,9 +120,10 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
#endregion
#endregion Contructor & global methods
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region High level methods
//Get the processes-count configurated
@@ -138,8 +138,6 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
//Get the NC model Name
public override CmsError NC_RModelName(ref string ModelName)
{
@@ -150,11 +148,8 @@ namespace CMS_CORE.Siemens
ModelName = Cnc_name;
return NO_ERROR;
}
//Get the NC Software Version
public override CmsError NC_RSoftwareVersion(ref string SWV)
{
@@ -167,8 +162,6 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
//Get the NC Language
public override CmsError NC_RLanguage(ref CultureInfo Language)
{
@@ -181,8 +174,6 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
//Get the NC Serial number
public override CmsError NC_RSerialNumber(ref string SN)
{
@@ -195,8 +186,6 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
//Get CMS Machine number
public override CmsError NC_RMachineNumber(ref string MachNumber)
{
@@ -209,8 +198,6 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
//Get the Date-Time of the NC
public override CmsError NC_RDateTime(ref DateTime ActualTime)
{
@@ -242,17 +229,6 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
public override CmsError Nc_RPowerOnData(ref PreAndPostPowerOnModel powerOnModel)
{
return NO_ERROR;
}
public override CmsError Nc_WPowerOnData(uint id, bool value)
{
return NO_ERROR;
}
// Check if the NC is in running state
public override CmsError NC_RIsRunning(ref bool running)
{
@@ -278,10 +254,67 @@ namespace CMS_CORE.Siemens
i++;
} while (!running || i <= nProcess);
return NO_ERROR;
}
//Get the Nc Active Alarms
public override CmsError NC_RActiveAlarms(ref List<AlarmModel> alarms)
{
if (SiemensAlarms == null)
return null;
alarms = SiemensAlarms.
Where(x => (x.Id < IDMinPLCMessage || x.Id > IDMaxPLCMessage) && (x.Id < IDMinChannel || x.Id > IDMaxChannel))
.Select(x => new AlarmModel() { Id = (uint)x.Id, Message = x.Message, IsWarning = false, Process = 0 })
.ToList();
return NO_ERROR;
}
#endregion High level methods
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region PLC High-level data
//Get the PLC Active Messages
public override CmsError PLC_RActiveMessages(ref List<AlarmModel> alarms)
{
alarms = SiemensAlarms
.Where(x => x.Id >= IDMinPLCMessage && x.Id <= IDMaxPLCMessage)
.Select(x => new AlarmModel() { Id = (uint)x.Id, Message = x.Message, IsWarning = false, Process = 0 })
.ToList();
return NO_ERROR;
}
public override CmsError PLC_RFunctionAccess(ref List<FunctionalityModel> functions)
{
functions = new List<FunctionalityModel>();
return NO_ERROR;
}
public override CmsError PLC_RPowerOnData(ref PreAndPostPowerOnModel powerOnModel)
{
return NO_ERROR;
}
public override CmsError PLC_WPowerOnData(uint id, bool value)
{
return NO_ERROR;
}
public override CmsError PLC_RAxesResetData(ref AxisResetDataModel axisResetData)
{
return NO_ERROR;
}
#endregion PLC High-level data
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region PROCESS (PATH) High-level data
//Get the process Mode
public override CmsError PROC_RMode(ushort ProcNumber, ref PROC_MODE Mode)
{
@@ -308,7 +341,6 @@ namespace CMS_CORE.Siemens
//Save Data
Mode = ConvertToSTEPMode((uint)ReadItem.Value, (uint)ReadItemIncr.Value, (uint)ReadItemAdv.Value);
}
catch (Exception ex)
{
@@ -318,8 +350,6 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
//Get the process status
public override CmsError PROC_RStatus(ushort ProcNumber, ref PROC_STATUS Status)
{
@@ -342,7 +372,6 @@ namespace CMS_CORE.Siemens
//Save Data
Status = ConvertToSTEPStatus((uint)ReadItem.Value);
}
catch (Exception ex)
{
@@ -352,8 +381,6 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
//Get PP Lines
public override CmsError PROC_RPPLines(ushort ProcNumber, ref List<string> Lines)
{
@@ -395,8 +422,6 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
//Get PP Name
public override CmsError PROC_RPPName(ushort ProcNumber, ref string Name)
{
@@ -429,7 +454,6 @@ namespace CMS_CORE.Siemens
//Save Data
Name = RetString;
}
catch (Exception ex)
{
@@ -439,49 +463,19 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
//Get the Nc Active Alarms
public override CmsError NC_RActiveAlarms(ref List<AlarmModel> alarms)
{
if (SiemensAlarms == null)
return null;
alarms = SiemensAlarms.
Where(x => (x.Id < IDMinPLCMessage || x.Id > IDMaxPLCMessage) && (x.Id < IDMinChannel || x.Id > IDMaxChannel))
.Select(x => new AlarmModel() { id = (uint)x.Id, message = x.Message, isWarning = false, process = 0 })
.ToList();
return NO_ERROR;
}
//Get the PLC Active Messages
public override CmsError PLC_RActiveMessages(ref List<AlarmModel> alarms)
{
alarms = SiemensAlarms
.Where(x => x.Id >= IDMinPLCMessage && x.Id <= IDMaxPLCMessage)
.Select(x => new AlarmModel() { id = (uint)x.Id, message = x.Message, isWarning = false, process = 0})
.ToList();
return NO_ERROR;
}
//Get the process Active Alarms
public override CmsError PROC_RActiveAlarms(ushort procNumber, ref List<AlarmModel> alarms)
{
alarms = SiemensAlarms
.Where(x => x.Id >= IDMinChannel && x.Id <= IDMaxChannel && x.Parameters[0].Equals(procNumber.ToString()))
.Select(x => new AlarmModel() { id = (uint)x.Id, message = x.Message, isWarning = false, process = procNumber })
.Select(x => new AlarmModel() { Id = (uint)x.Id, Message = x.Message, IsWarning = false, Process = procNumber })
.ToList();
return NO_ERROR;
}
// Get process part program data
public override CmsError PROC_RStatus(ushort procNumber, ref ProcessData processData)
public override CmsError PROC_RStatusAndData(ushort procNumber, ref ProcessDataModel processData)
{
//processData.Id = procNumber;
//// Read part program name
@@ -498,7 +492,7 @@ namespace CMS_CORE.Siemens
//byte[] bytes = BitConverter.GetBytes(readValue);
//// Convert Byte into true/false array
//BitArray bits = new BitArray(new byte[] { bytes[0] }); //1st byte -> 0 : Proccess type (AUX-WORK), 1: Process in alarm status, 2: Run, 3: Hold, 4: Read, 5: PartProgramVisible
//BitArray bits = new BitArray(new byte[] { bytes[0] }); //1st byte -> 0 : Proccess type (AUX-WORK), 1: Process in alarm status, 2: Run, 3: Hold, 4: Read, 5: PartProgramVisible
//// Populate response structure
//processData.Type = bits[0] ? "WORK" : "AUX";
//processData.IsInAlarm = bits[1];
@@ -522,54 +516,50 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
#endregion PROCESS (PATH) High-level data
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region PROCESS-AXES (PATH) High-level data
//Get a dictionary with the Actual position of the axes in Process
public override CmsError AXES_RInterpPosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
//Get a dictionary with the Machine position of the axes in Process
public override CmsError AXES_RMachinePosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
//Get a dictionary with the Programmed position of the axes in Process
public override CmsError AXES_RProgrPosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
//Get a dictionary with the Following Error of the axes in Process
public override CmsError AXES_RFollowingError(ushort ProcNumber, ref Dictionary<string, double> Axes)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
//Get a dictionary with the Distance To Go of the axes in Process
public override CmsError AXES_RDistanceToGo(ushort ProcNumber, ref Dictionary<string, double> Axes)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
#endregion
#endregion PROCESS-AXES (PATH) High-level data
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Low level methods
//--------------------------------------------------------------------------------------------------------------------------
// BOOLEAN (NC) <-> BOOLEAN (.NET)
#region NC Low-level function: single valiable in memory
//Read-Write a Boolean-Value inside the NC.
public override CmsError MEM_RWBoolean(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemBit, ref bool Value)
public override CmsError MEM_RWBoolean(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int MemBit, ref bool Value)
{
//Check if the NC is Connected
CmsError cmsError = CheckConnection();
@@ -604,7 +594,6 @@ namespace CMS_CORE.Siemens
{
Data.Read(item);
Value = (bool)item.Value;
}
}
catch (Exception ex)
@@ -615,14 +604,145 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
//Read-Write a Byte-Value-List inside the NC. In writing-mode the field "Number" is not required
public override CmsError MEM_RWByte(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int MemByte, ref byte Value)
{
List<byte> ListValue = new List<byte>() { Value };
//uses the List method with one-element list
CmsError cmsError = MEM_RWByteList(bWrite, Process, MemType, MemTable, MemIndex, MemByte, 1, ref ListValue);
if (cmsError.IsError())
return cmsError;
Value = ListValue.First();
return NO_ERROR;
}
//Write a Word-Value inside the NC. In writing-mode the field "Number" is not required
public override CmsError MEM_RWWord(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, ref ushort Value)
{
List<ushort> ListValue = new List<ushort>() { Value };
//uses the List method with one-element list
CmsError cmsError = MEM_RWWordList(bWrite, Process, MemType, MemTable, MemIndex, 1, ref ListValue);
if (cmsError.IsError())
return cmsError;
Value = ListValue.First();
return NO_ERROR;
}
public override CmsError MEM_RWShort(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, ref short Value)
{
List<short> ListValue = new List<short>() { Value };
//uses the List method with one-element list
CmsError cmsError = MEM_RWShortList(bWrite, Process, MemType, MemTable, MemIndex, 1, ref ListValue);
if (cmsError.IsError())
return cmsError;
Value = ListValue.First();
return NO_ERROR;
}
//Write a Word-Value inside the NC. In writing-mode the field "Number" is not required
public override CmsError MEM_RWDWord(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, ref uint Value)
{
List<uint> ListValue = new List<uint>() { Value };
//uses the List method with one-element list
CmsError cmsError = MEM_RWDWordList(bWrite, Process, MemType, MemTable, MemIndex, 1, ref ListValue);
if (cmsError.IsError())
return cmsError;
Value = ListValue.First();
return NO_ERROR;
}
//Write a Int-Value inside the NC. In writing-mode the field "Number" is not required
public override CmsError MEM_RWInteger(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, ref int Value)
{
List<int> ListValue = new List<int>() { Value };
//uses the List method with one-element list
CmsError cmsError = MEM_RWIntegerList(bWrite, Process, MemType, MemTable, MemIndex, 1, ref ListValue);
if (cmsError.IsError())
return cmsError;
Value = ListValue.First();
return NO_ERROR;
}
//--------------------------------------------------------------------------------------------------------------------------
// BYTE (NC) <-> BYTE (.NET)
// Other-NC Version of Memory-Access Methods
//Read-Write a Byte-Value inside the NC. In writing-mode the field "Number" is not required
public override CmsError MEM_RWByteList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemByteStart, int Number, ref List<byte> Value)
public override CmsError MEM_RWBoolean(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, int MemBit, ref bool Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWByte(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, int MemByte, ref byte Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWDWord(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, ref uint Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWInteger(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, ref int Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWShort(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, ref short Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWWord(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, ref ushort Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWDWordList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, int Number, ref List<uint> Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWIntegerList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, int Number, ref List<int> Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWShortList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, int Number, ref List<short> Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWWordList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, int Number, ref List<ushort> Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWByteList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemIndex, int MemByteStart, int Number, ref List<byte> Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
#endregion NC Low-level function: single valiable in memory
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Low level methods
public override CmsError MEM_RWByteList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int MemByteStart, int Number, ref List<byte> Value)
{
//Check if the NC is Connected
CmsError cmsError = CheckConnection();
@@ -658,7 +778,6 @@ namespace CMS_CORE.Siemens
Value.Clear();
Value.Add((byte)(uint)item.Value);
}
}
}
catch (Exception ex)
@@ -669,31 +788,7 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
//Read-Write a Byte-Value-List inside the NC. In writing-mode the field "Number" is not required
public override CmsError MEM_RWByte(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int MemByte, ref byte Value)
{
List<byte> ListValue = new List<byte>() { Value };
//uses the List method with one-element list
CmsError cmsError = MEM_RWByteList(bWrite, Process, MemType, MemTable, MemIndex, MemByte, 1, ref ListValue);
if (cmsError.IsError())
return cmsError;
Value = ListValue.First();
return NO_ERROR;
}
//--------------------------------------------------------------------------------------------------------------------------
// WORD (NC) <-> USHORT (.NET)
//Write a Word-Value-List inside the NC. In writing-mode the field "Number" is not required
public override CmsError MEM_RWWordList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<ushort> Value)
public override CmsError MEM_RWWordList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<ushort> Value)
{
//Check if the NC is Connected
CmsError cmsError = CheckConnection();
@@ -729,7 +824,6 @@ namespace CMS_CORE.Siemens
Value.Clear();
Value.Add(Convert.ToUInt16((uint)item.Value));
}
}
}
catch (Exception ex)
@@ -740,28 +834,7 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
//Write a Word-Value inside the NC. In writing-mode the field "Number" is not required
public override CmsError MEM_RWWord(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref ushort Value)
{
List<ushort> ListValue = new List<ushort>() { Value };
//uses the List method with one-element list
CmsError cmsError = MEM_RWWordList(bWrite, Process, MemType, MemTable, MemIndex, 1, ref ListValue);
if (cmsError.IsError())
return cmsError;
Value = ListValue.First();
return NO_ERROR;
}
//--------------------------------------------------------------------------------------------------------------------------
// WORD (NC) <-> SHORT (.NET)
public override CmsError MEM_RWShortList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<short> Value)
public override CmsError MEM_RWShortList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<short> Value)
{
//Check if the NC is Connected
CmsError cmsError = CheckConnection();
@@ -797,7 +870,6 @@ namespace CMS_CORE.Siemens
Value.Clear();
Value.Add(unchecked((short)(uint)item.Value));
}
}
}
catch (Exception ex)
@@ -808,28 +880,7 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
public override CmsError MEM_RWShort(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref short Value)
{
List<short> ListValue = new List<short>() { Value };
//uses the List method with one-element list
CmsError cmsError = MEM_RWShortList(bWrite, Process, MemType, MemTable, MemIndex, 1, ref ListValue);
if (cmsError.IsError())
return cmsError;
Value = ListValue.First();
return NO_ERROR;
}
//--------------------------------------------------------------------------------------------------------------------------
// DWORD (NC) <-> UINT (.NET)
//Write a Word-Value-List inside the NC. In writing-mode the field "Number" is not required
public override CmsError MEM_RWDWordList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<uint> Value)
public override CmsError MEM_RWDWordList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<uint> Value)
{
//Check if the NC is Connected
CmsError cmsError = CheckConnection();
@@ -864,7 +915,6 @@ namespace CMS_CORE.Siemens
Value.Clear();
Value.Add((uint)item.Value);
}
}
}
catch (Exception ex)
@@ -875,29 +925,7 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
//Write a Word-Value inside the NC. In writing-mode the field "Number" is not required
public override CmsError MEM_RWDWord(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref uint Value)
{
List<uint> ListValue = new List<uint>() { Value };
//uses the List method with one-element list
CmsError cmsError = MEM_RWDWordList(bWrite, Process, MemType, MemTable, MemIndex, 1, ref ListValue);
if (cmsError.IsError())
return cmsError;
Value = ListValue.First();
return NO_ERROR;
}
//--------------------------------------------------------------------------------------------------------------------------
// DWORD (NC) <-> INT (.NET)
//Write a Int-Value-List inside the NC. In writing-mode the field "Number" is not required
public override CmsError MEM_RWIntegerList(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, int Number, ref List<int> Value)
public override CmsError MEM_RWIntegerList(bool bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<int> Value)
{
//Check if the NC is Connected
CmsError cmsError = CheckConnection();
@@ -933,7 +961,6 @@ namespace CMS_CORE.Siemens
Value.Clear();
Value.Add(unchecked((int)(uint)item.Value));
}
}
}
catch (Exception ex)
@@ -944,78 +971,11 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
//Write a Int-Value inside the NC. In writing-mode the field "Number" is not required
public override CmsError MEM_RWInteger(bool bWrite, int Process, MEMORY_Type MemType, int MemTable, int MemIndex, ref int Value)
{
List<int> ListValue = new List<int>() { Value };
#endregion Low level methods
//uses the List method with one-element list
CmsError cmsError = MEM_RWIntegerList(bWrite, Process, MemType, MemTable, MemIndex, 1, ref ListValue);
if (cmsError.IsError())
return cmsError;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Value = ListValue.First();
return NO_ERROR;
}
//--------------------------------------------------------------------------------------------------------------------------
// Other-NC Version of Memory-Access Methods
public override CmsError MEM_RWBoolean(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemBit, ref bool Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWByte(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemByte, ref byte Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWDWord(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref uint Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWInteger(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref int Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWShort(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref short Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWWord(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref ushort Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWDWordList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<uint> Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWIntegerList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<int> Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWShortList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<short> Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWWordList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<ushort> Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError MEM_RWByteList(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemByteStart, int Number, ref List<byte> Value)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
//--------------------------------------------------------------------------------------------------------------------------
// PARAMS
#region NC Low-level function: Parameters
public override CmsError NC_RParam(short Index, short Bit, ref bool Value)
{
@@ -1042,10 +1002,11 @@ namespace CMS_CORE.Siemens
return FUNCTION_NOT_ALLOWED_ERROR;
}
#endregion
#endregion NC Low-level function: Parameters
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region File Management
#region File Management
public override CmsError FILES_CopyProgram(string partProgramPath, string newPartProgramPath, bool failIfExist)
{
@@ -1071,8 +1032,6 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
public override CmsError FILES_DeleteProgram(string partProgramPath, string partProgramName)
{
//Check if the NC is Connected
@@ -1097,8 +1056,6 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
public override CmsError FILES_RProgramToFile(string partProgramPath, FileStream localFile)
{
//Check if the NC is Connected
@@ -1122,7 +1079,6 @@ namespace CMS_CORE.Siemens
//Delete temporary file
File.Delete(TempFile);
}
catch (Exception ex)
{
@@ -1132,8 +1088,6 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
public override CmsError FILES_WProgramFromFile(string partProgramPath, FileStream localFile)
{
//Check if the NC is Connected
@@ -1150,7 +1104,6 @@ namespace CMS_CORE.Siemens
//Execute Function
FileData.Copy(sourceNode, destNode, true);
}
catch (Exception ex)
{
@@ -1160,9 +1113,10 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
#endregion
#endregion File Management
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Subordinate Private Functions
//Manage the Alarms - Called automatically on changes
@@ -1171,8 +1125,6 @@ namespace CMS_CORE.Siemens
SiemensAlarms = alarms;
}
//Manage the Mode
private PROC_MODE ConvertToSTEPMode(uint mode, uint JogMode, uint AdvMode)
{
@@ -1195,8 +1147,6 @@ namespace CMS_CORE.Siemens
return PROC_MODE.ERROR;
}
//Manage the Status
private PROC_STATUS ConvertToSTEPStatus(uint status)
{
@@ -1209,8 +1159,6 @@ namespace CMS_CORE.Siemens
return PROC_STATUS.ERROR;
}
//Check Bit In Range
private CmsError CheckBitRange(int bitnum)
{
@@ -1220,10 +1168,8 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
//Check if Memory Area is corrected
private CmsError ConvertMemToPath(MEMORY_Type MemoryType, int Address, int SubAddress, int SubBit, int Qty, char MemAccess, out string item)
private CmsError ConvertMemToPath(MEMORY_TYPE MemoryType, int Address, int SubAddress, int SubBit, int Qty, char MemAccess, out string item)
{
char[] allowedAccess = { 'X', 'B', 'W', 'D' };
@@ -1245,8 +1191,6 @@ namespace CMS_CORE.Siemens
}
}
//Check if NC is connected
private CmsError CheckConnection()
{
@@ -1256,8 +1200,6 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
//Check if Siemens Environment is started
private CmsError CheckSiemensEnv()
{
@@ -1266,12 +1208,10 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
//Manage the Exception Launch
private CmsError ManageException(Exception ex)
{
//Catch the Siemens exceptions
//Catch the Siemens exceptions
if (ex is OperateMissingOptionException && ex.Message.Contains(OptionHMINotRunning))
{
Connected = false;
@@ -1342,7 +1282,6 @@ namespace CMS_CORE.Siemens
//Save NOW
Last_Static_Read = DateTime.Now;
}
catch (Exception ex)
{
@@ -1353,8 +1292,6 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
// Convert the internal Name var in Readable STEP Name
private String getName(uint value)
{
@@ -1375,8 +1312,6 @@ namespace CMS_CORE.Siemens
return name;
}
//Convert to Step Language
private CultureInfo ConvertToSTEPLanguage(uint language)
{
@@ -1414,7 +1349,7 @@ namespace CMS_CORE.Siemens
default: return new CultureInfo("en");
}
}
#endregion
#endregion Subordinate Private Functions
}
}
}
@@ -391,13 +391,14 @@ namespace Nc_Demo_Application.Database
foreach (DataRow row in BinaryMemory.Rows)
{
// Populate binary column for each row int -> binary
row["binary"] = Convert.ToString(Convert.ToInt32(row["value"].ToString(), 10), 2).PadLeft(8, '0');
row["binary"] = Convert.ToString(Convert.ToInt32(row["value"].ToString(), 10), 2).PadLeft(8, '0').Substring(0,8);
// Add binary value to word and integer
word = row["binary"] + word;
integer = row["binary"] + integer;
// Every 2 row set word value
if (i % 2 == 0)
{
Convert.ToUInt16(word, 2);
row["word"] = Convert.ToInt16(word, 2);
word = "";
}
@@ -440,7 +441,7 @@ namespace Nc_Demo_Application.Database
{
ValidateIndex(index);
return Convert.ToByte(BinaryMemory.Rows[index]["value"]);
return Convert.ToByte(BinaryMemory.Rows[index]["binary"].ToString(), 2);
}
public string GetBinaryByteValue(int index)
@@ -154,6 +154,8 @@ namespace Nc_Demo_Application
private void SaveNcProcessData_Click(object sender, EventArgs e)
{
DatabaseController.getInstance().UpdateNcProcess((DataTable)ncProcessGridView.DataSource);
FillNcProcessInput();
}
private void SaveNcAlarmsButton_Click(object sender, EventArgs e)