Added nc softkeys

Added axis names
Fix demo
This commit is contained in:
Lucio Maranta
2018-03-21 11:47:12 +00:00
parent 9c607bd45d
commit 309c40e9cb
8 changed files with 620 additions and 184 deletions
+16 -9
View File
@@ -73,6 +73,7 @@ namespace CMS_CORE_Application
List<String> Lines = new List<string>();
List<SoftKeysModel> keys = new List<SoftKeysModel>();
List<HeadDataModel> test = new List<HeadDataModel>();
List<AxisModel> axesNames = new List<AxisModel>();
N = SetNcByType();
@@ -107,7 +108,7 @@ namespace CMS_CORE_Application
error = true;
SetError(Lines, cmsError);
}
sw.Restart();
cmsError = N.PLC_RActiveMessages(ref Msg);
if (cmsError.IsError())
{
@@ -115,8 +116,6 @@ namespace CMS_CORE_Application
SetError(Lines, cmsError);
}
sw.Stop();
cmsError = N.NC_RDateTime(ref NcTime);
if (cmsError.IsError())
{
@@ -131,14 +130,22 @@ namespace CMS_CORE_Application
SetError(Lines, cmsError);
}
cmsError = N.PLC_RHeadsData(test, 1);
cmsError = N.PLC_WHeadOverride(19, HEAD_OVERRIDE_SIGN.MINUS);
cmsError = N.PLC_RNcSoftKeys(ref keys);
cmsError = N.PLC_WNcSoftKey(1);
cmsError = N.AXES_RAxesNames(2, ref axesNames);
cmsError = N.AXES_WSelectAxis(2);
byte axisId = 0;
cmsError = N.AXES_RSelectedAxis(ref axisId);
Dictionary<int, string> messages = new Dictionary<int, string>();
cmsError = N.NC_GetTranslatedPlcMessages("en", ref messages);
//cmsError = N.PLC_RHeadsData(test, 1);
//cmsError = N.PLC_WHeadOverride(19, HEAD_OVERRIDE_SIGN.MINUS);
//Dictionary<int, string> messages = new Dictionary<int, string>();
//cmsError = N.NC_GetTranslatedPlcMessages("en", ref messages);
//cmsError = N.PROC_RSelectedProcess(ref procnum);
cmsError = N.PROC_RSelectedProcess(ref procnum);
if (!this.IsDisposed && this.InvokeRequired)
{
this.Invoke((ThreadStart)delegate ()
+9 -2
View File
@@ -7,7 +7,7 @@ namespace CMS_CORE_Library
{
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Data structor models
#region Data structure models
#region Pre and Post Power on Models
@@ -293,6 +293,12 @@ namespace CMS_CORE_Library
public bool OverrideEditable;
}
public class AxisModel
{
public int Id;
public string Name;
}
#endregion Data structor models
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -360,7 +366,8 @@ namespace CMS_CORE_Library
#region Constants
public const int SOFTKEYS_NUMBER = 128;
public const int USER_SOFTKEYS_NUMBER = 128;
public const int NC_SOFTKEYS_NUMBER = 32;
public const int PROCESS_NUMBER = 6;
public const int ALARMS_NUMBER = 1024;
public const int HEADS_NUMBER = 20;
+189 -67
View File
@@ -301,16 +301,16 @@ namespace CMS_CORE.Demo
// try
// {
// alarms.Clear();
// List<int> readedValues = new List<int>();
// List<int> readValues = new List<int>();
// // Read status alarm data data from memory
// CmsError cmsError = MEM_RWIntegerList(R, 0,
// MEMORY_ADDRESS.ALARMS_STATUS.MemType,
// MEMORY_ADDRESS.ALARMS_STATUS.Address,
// MEMORY_ADDRESS.ALARMS_STATUS.Size / 4,
// ref readedValues);
// ref readValues);
// bool[] statusBits = new BitArray(readedValues.ToArray()).Cast<bool>().ToArray();
// bool[] statusBits = new BitArray(readValues.ToArray()).Cast<bool>().ToArray();
// // Convert array into structured data
// byte alarmData = 0;
@@ -364,19 +364,19 @@ namespace CMS_CORE.Demo
public override CmsError PLC_RActiveMessages(ref List<PlcAlarmModel> alarms)
{
alarms.Clear();
List<int> readedValues = new List<int>();
List<int> readValues = new List<int>();
// Read on data from memory
CmsError cmsError = MEM_RWIntegerList(R, 0,
MEMORY_ADDRESS.ALARMS_STATUS.MemType,
MEMORY_ADDRESS.ALARMS_STATUS.Address,
(MEMORY_ADDRESS.ALARMS_STATUS.Size + MEMORY_ADDRESS.ALARMS_DATA.Size) / 4,
ref readedValues);
ref readValues);
if (cmsError.IsError())
return cmsError;
// Convert integer array into bit array
bool[] statusBits = new BitArray(readedValues.ToArray()).Cast<bool>().ToArray();
bool[] statusBits = new BitArray(readValues.ToArray()).Cast<bool>().ToArray();
for (int i = 0; i < MEMORY_ADDRESS.ALARMS_STATUS.Size * 8; i++)
{
@@ -415,20 +415,20 @@ namespace CMS_CORE.Demo
return INCORRECT_PARAMETERS_ERROR;
CmsError cmsError;
bool readedValue = false;
bool readValue = false;
bool writeValue = true;
int ackByte = MEMORY_ADDRESS.ALARM_ACK.Address + ((int)id / 8);
int strobeByte = MEMORY_ADDRESS.ALARM_REFRESH_STROBE.Address + ((int)id / 8);
int alarmBitId = ((int)id % 8) - 1;
int ackByte = MEMORY_ADDRESS.ALARM_ACK.Address + (((int)id - 1) / 8);
int strobeByte = MEMORY_ADDRESS.ALARM_REFRESH_STROBE.Address + (((int)id - 1) / 8);
int alarmBitId = (((int)id - 1) % 8);
// Check ACK
cmsError = MEM_RWBoolean(R, 0, MEMORY_ADDRESS.ALARM_ACK.MemType, ackByte, alarmBitId, ref readedValue);
cmsError = MEM_RWBoolean(R, 0, MEMORY_ADDRESS.ALARM_ACK.MemType, ackByte, alarmBitId, ref readValue);
if (cmsError.IsError())
return cmsError;
// If PLC it's performing another request then return
if (readedValue)
if (readValue)
return NO_ERROR;
// Write data
@@ -444,6 +444,16 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
public override CmsError PLC_WRestoreMessage(uint id)
{
// Call restore message
CmsError cmsError = PLC_WRefreshMessage(id);
if (cmsError.IsError())
return cmsError;
return NO_ERROR;
}
public override CmsError PLC_RPowerOnData(ref PreAndPostPowerOnModel powerOnModel)
{
int readValue = 0;
@@ -504,15 +514,15 @@ namespace CMS_CORE.Demo
public override CmsError PLC_RFunctionAccess(ref List<FunctionalityModel> functions)
{
List<int> readedValues = new List<int>();
List<int> readValues = 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 readedValues);
CmsError cmsError = MEM_RWIntegerList(R, 0, MEMORY_ADDRESS.FUNCTION_ACCESS.MemType, MEMORY_ADDRESS.FUNCTION_ACCESS.Address, 4, ref readValues);
if (cmsError.IsError())
return cmsError;
functions = new List<FunctionalityModel>();
// Convert int into to true/false array
bool[] bits = new BitArray(readedValues.ToArray()).Cast<bool>().ToArray();
bool[] bits = new BitArray(readValues.ToArray()).Cast<bool>().ToArray();
// Convert array into structured data
for (int i = 0; i < bits.Count(); i++)
{
@@ -552,44 +562,64 @@ namespace CMS_CORE.Demo
public override CmsError PLC_RMachineCounters(ref List<CounterModel> counters)
{
counters = new List<CounterModel>();
List<int> readedValues = new List<int>();
List<int> readValues = new List<int>();
// Read on data from memory
CmsError cmsError = MEM_RWIntegerList(R, 0, MEMORY_ADDRESS.COUNTERS.MemType, MEMORY_ADDRESS.COUNTERS.Address, MEMORY_ADDRESS.COUNTERS.Size / 4, ref readedValues);
CmsError cmsError = MEM_RWIntegerList(R, 0, MEMORY_ADDRESS.COUNTERS.MemType, MEMORY_ADDRESS.COUNTERS.Address, MEMORY_ADDRESS.COUNTERS.Size / 4, ref readValues);
if (cmsError.IsError())
return cmsError;
// Foreach counters
for (int i = 0; i < readedValues.Count; i++)
for (int i = 0; i < readValues.Count; i++)
{
// Add counters value into returned value
counters.Add(new CounterModel()
{
Id = (uint)i,
Value = (uint)readedValues[i]
Value = (uint)readValues[i]
});
}
return NO_ERROR;
}
public override CmsError PLC_RNcSoftKeys(ref List<SoftKeysModel> ncSoftKeys)
{
CmsError cmsError = PLC_RSoftKeys(MEMORY_ADDRESS.NC_SOFTKEYS_VALUE, MEMORY_ADDRESS.NC_SOFTKEYS_CLICKABLE, ref ncSoftKeys);
if (cmsError.IsError())
return cmsError;
public override CmsError PLC_RSoftKeys(ref List<SoftKeysModel> softKeys)
return NO_ERROR;
}
public override CmsError PLC_RUserSoftKeys(ref List<SoftKeysModel> softKeys)
{
CmsError cmsError = PLC_RSoftKeys(MEMORY_ADDRESS.USER_SOFTKEYS_VALUE, MEMORY_ADDRESS.USER_SOFTKEYS_CLICKABLE, ref softKeys);
if (cmsError.IsError())
return cmsError;
return NO_ERROR;
}
private CmsError PLC_RSoftKeys(MEMORY_CELL softKeyStatusMemory, MEMORY_CELL softKeysClickableMemory, ref List<SoftKeysModel> softKeys)
{
softKeys = new List<SoftKeysModel>();
List<int> readedValues = new List<int>();
List<int> readValue = new List<int>();
int memorySize = (MEMORY_ADDRESS.USER_SOFTKEYS_VALUE.Size + MEMORY_ADDRESS.USER_SOFTKEYS_CLICKABLE.Size);
int memorySizeToRead = (softKeyStatusMemory.Size + softKeysClickableMemory.Size);
// Offset between status and clicable data
int offset = softKeyStatusMemory.Size * 8;
// Read on data from memory
CmsError cmsError = MEM_RWIntegerList(R, 0,
MEMORY_ADDRESS.USER_SOFTKEYS_VALUE.MemType,
MEMORY_ADDRESS.USER_SOFTKEYS_VALUE.Address,
memorySize / 4,
ref readedValues);
softKeyStatusMemory.MemType,
softKeyStatusMemory.Address,
memorySizeToRead / 4,
ref readValue);
if (cmsError.IsError())
return cmsError;
bool[] bits = new BitArray(readedValues.ToArray()).Cast<bool>().ToArray();
bool[] bits = new BitArray(readValue.ToArray()).Cast<bool>().ToArray();
// Convert array into structured data
for (ushort i = 0; i < bits.Count() / 2; i++)
@@ -598,34 +628,70 @@ namespace CMS_CORE.Demo
{
Id = i,
Value = bits[i],
Active = bits[i + 128]
Active = bits[i + offset]
});
}
return NO_ERROR;
}
public override CmsError PLC_WSoftKey(uint id)
public override CmsError PLC_WNcSoftKey(uint id)
{
// Check id range
if (id > SOFTKEYS_NUMBER)
if (id > NC_SOFTKEYS_NUMBER)
return INCORRECT_PARAMETERS_ERROR;
CmsError cmsError;
bool readedValue = false;
bool readValue = false;
bool writeValue = true;
int ackByte = MEMORY_ADDRESS.USER_SOFT_KEYS_ACK.Address + ((int)id / 8);
int strobeByte = MEMORY_ADDRESS.USER_SOFT_KEYS_CLICKED.Address + ((int)id / 8);
int softkeyBitId = ((int)id % 8) - 1;
int ackByte = MEMORY_ADDRESS.NC_SOFT_KEYS_ACK.Address + (((int)id - 1) / 8);
int strobeByte = MEMORY_ADDRESS.NC_SOFT_KEYS_CLICKED.Address + (((int)id - 1) / 8);
int softkeyBitId = (((int)id - 1) % 8);
// Check ACK
cmsError = MEM_RWBoolean(R, 0, MEMORY_ADDRESS.USER_SOFT_KEYS_ACK.MemType, ackByte, softkeyBitId, ref readedValue);
cmsError = MEM_RWBoolean(R, 0, MEMORY_ADDRESS.NC_SOFT_KEYS_ACK.MemType, ackByte, softkeyBitId, ref readValue);
if (cmsError.IsError())
return cmsError;
// If PLC it's performing another request then return
if (readedValue)
if (readValue)
return NO_ERROR;
// Write data
cmsError = MEM_RWBoolean(W, 0, MEMORY_ADDRESS.NC_SOFT_KEYS_CLICKED.MemType, strobeByte, softkeyBitId, ref writeValue);
if (cmsError.IsError())
return cmsError;
// Reset wait ack = 1 and reset the strobe
cmsError = ResetStrobe(softkeyBitId, strobeByte, ackByte, MEMORY_ADDRESS.NC_SOFT_KEYS_CLICKED.MemType);
if (cmsError.IsError())
return cmsError;
return NO_ERROR;
}
public override CmsError PLC_WUserSoftKey(uint id)
{
// Check id range
if (id > USER_SOFTKEYS_NUMBER)
return INCORRECT_PARAMETERS_ERROR;
CmsError cmsError;
bool readValue = false;
bool writeValue = true;
int ackByte = MEMORY_ADDRESS.USER_SOFT_KEYS_ACK.Address + (((int)id - 1) / 8);
int strobeByte = MEMORY_ADDRESS.USER_SOFT_KEYS_CLICKED.Address + (((int)id - 1) / 8);
int softkeyBitId = (((int)id - 1) % 8);
// Check ACK
cmsError = MEM_RWBoolean(R, 0, MEMORY_ADDRESS.USER_SOFT_KEYS_ACK.MemType, ackByte, softkeyBitId, ref readValue);
if (cmsError.IsError())
return cmsError;
// If PLC it's performing another request then return
if (readValue)
return NO_ERROR;
// Write data
@@ -648,12 +714,12 @@ namespace CMS_CORE.Demo
return INCORRECT_PARAMETERS_ERROR;
heads.Clear();
List<byte> readedValues = new List<byte>();
List<byte> readValues = new List<byte>();
// Find the size of a single head
int headsByte = (MEMORY_ADDRESS.HEADS_DATA.Size / HEADS_NUMBER);
// Read data for N heads
CmsError cmsError = MEM_RWByteList(R, 0, MEMORY_ADDRESS.HEADS_DATA.MemType, MEMORY_ADDRESS.HEADS_DATA.Address, 0, headsByte * number, ref readedValues);
CmsError cmsError = MEM_RWByteList(R, 0, MEMORY_ADDRESS.HEADS_DATA.MemType, MEMORY_ADDRESS.HEADS_DATA.Address, 0, headsByte * number, ref readValues);
if (cmsError.IsError())
return cmsError;
@@ -665,14 +731,14 @@ namespace CMS_CORE.Demo
heads.Add(new HeadDataModel()
{
Id = (uint)i,
Process = readedValues[headOffset],
Override = readedValues[headOffset + 1],
Load_Abrasive = BitConverter.ToUInt16(readedValues.ToArray(), headOffset + 2), // Uint 16 = 2byte
ActualSpeed_Pressure = BitConverter.ToInt32(readedValues.ToArray(), headOffset + 4), // Int32 = 4byte
MountedTool_Vacum = BitConverter.ToUInt16(readedValues.ToArray(), headOffset + 8), // Uint 16 = 2byte
isActive = (readedValues[headOffset + 10] & 1) != 0, // bit 0
isSelected = (readedValues[headOffset + 10] & 2) != 0, // bit 1
OverrideEditable = (readedValues[headOffset + 10] & 4) != 0 // bit 2
Process = readValues[headOffset],
Override = readValues[headOffset + 1],
Load_Abrasive = BitConverter.ToUInt16(readValues.ToArray(), headOffset + 2), // Uint 16 = 2byte
ActualSpeed_Pressure = BitConverter.ToInt32(readValues.ToArray(), headOffset + 4), // Int32 = 4byte
MountedTool_Vacum = BitConverter.ToUInt16(readValues.ToArray(), headOffset + 8), // Uint 16 = 2byte
isActive = (readValues[headOffset + 10] & 1) != 0, // bit 0
isSelected = (readValues[headOffset + 10] & 2) != 0, // bit 1
OverrideEditable = (readValues[headOffset + 10] & 4) != 0 // bit 2
});
}
@@ -685,22 +751,22 @@ namespace CMS_CORE.Demo
return INCORRECT_PARAMETERS_ERROR;
CmsError cmsError;
bool readedValue = false;
bool readValue = false;
bool writeValue = true;
MEMORY_CELL currentMemoryCell = sign == HEAD_OVERRIDE_SIGN.PLUS ? MEMORY_ADDRESS.HEADS_STROBE_INCREMENT : MEMORY_ADDRESS.HEADS_STROBE_DECREMENT;
int ackByte = MEMORY_ADDRESS.HEADS_ACK.Address + ((int)id / 8);
int strobeByte = currentMemoryCell.Address + ((int)id / 8);
int headBit = ((int)id % 8) - 1;
int ackByte = MEMORY_ADDRESS.HEADS_ACK.Address + (((int)id - 1) / 8);
int strobeByte = currentMemoryCell.Address + (((int)id - 1) / 8);
int headBit = (((int)id - 1) % 8);
// Check ACK
cmsError = MEM_RWBoolean(R, 0, MEMORY_ADDRESS.HEADS_ACK.MemType, ackByte, headBit, ref readedValue);
cmsError = MEM_RWBoolean(R, 0, MEMORY_ADDRESS.HEADS_ACK.MemType, ackByte, headBit, ref readValue);
if (cmsError.IsError())
return cmsError;
// If PLC it's performing another request then return
if (readedValue)
if (readValue)
return NO_ERROR;
// Write strobe data
@@ -719,18 +785,18 @@ namespace CMS_CORE.Demo
private CmsError ResetStrobe(int bitId, int strobeByte, int ackByte, MEMORY_TYPE memType)
{
int n = 5;
bool readedValue = false;
bool readValue = false;
bool writeValue = false;
CmsError cmsError;
do
{
// Check ACK
cmsError = MEM_RWBoolean(R, 0, memType, ackByte, bitId, ref readedValue);
cmsError = MEM_RWBoolean(R, 0, memType, ackByte, bitId, ref readValue);
if (cmsError.IsError())
return cmsError;
// If true reset strobe
if (readedValue == true)
if (readValue == true)
{
// Reset strobe
cmsError = MEM_RWBoolean(W, 0, memType, strobeByte, bitId, ref writeValue);
@@ -887,7 +953,7 @@ namespace CMS_CORE.Demo
return cmsError;
// Return value
procNumber = processNum;
procNumber = processNum == 0 ? (ushort)1 : processNum;
return NO_ERROR;
}
@@ -952,7 +1018,7 @@ namespace CMS_CORE.Demo
{
// Get Axes Position from server
serverService.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
// Parse server response and get programmed position
// Parse server response and retrieve programmed position
foreach (NcAxisModel demoAxis in demoAxes)
{
Axes.Add(demoAxis.name, demoAxis.programmed);
@@ -966,7 +1032,7 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
public override CmsError AXES_RMachinePosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
public override CmsError AXES_RMachinePosition(ushort procNumber, ref Dictionary<string, double> Axes)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
@@ -975,9 +1041,9 @@ namespace CMS_CORE.Demo
try
{
// Get Axes Position from server
serverService.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
serverService.GetAxesPosition(procNumber.ToString(), out List<NcAxisModel> demoAxes);
// Parse Server response and get machine position
// Parse Server response and retrieve machine position
foreach (NcAxisModel demoAxis in demoAxes)
{
Axes.Add(demoAxis.name, demoAxis.machinePosition);
@@ -991,7 +1057,7 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
public override CmsError AXES_RFollowingError(ushort ProcNumber, ref Dictionary<string, double> Axes)
public override CmsError AXES_RFollowingError(ushort procNumber, ref Dictionary<string, double> Axes)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
@@ -1001,8 +1067,8 @@ namespace CMS_CORE.Demo
try
{
// Get Axes position from Demo server
serverService.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
// Parse response get distance to go
serverService.GetAxesPosition(procNumber.ToString(), out List<NcAxisModel> demoAxes);
// Parse response retrieve following error
foreach (NcAxisModel demoAxis in demoAxes)
{
Axes.Add(demoAxis.name, demoAxis.distanceToGo);
@@ -1016,7 +1082,7 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
public override CmsError AXES_RDistanceToGo(ushort ProcNumber, ref Dictionary<string, double> Axes)
public override CmsError AXES_RDistanceToGo(ushort procNumber, ref Dictionary<string, double> Axes)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
@@ -1025,8 +1091,8 @@ namespace CMS_CORE.Demo
try
{
serverService.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
// Parse response get distance to go
serverService.GetAxesPosition(procNumber.ToString(), out List<NcAxisModel> demoAxes);
// Parse response and retrieve distance to go
foreach (NcAxisModel demoAxis in demoAxes)
{
Axes.Add(demoAxis.name, demoAxis.distanceToGo);
@@ -1040,6 +1106,55 @@ namespace CMS_CORE.Demo
return NO_ERROR;
}
public override CmsError AXES_RAxesNames(ushort process, ref List<AxisModel> axesData)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
if (cmsError.IsError())
return cmsError;
try
{
serverService.GetAxesPosition(process.ToString(), out List<NcAxisModel> demoAxes);
int i = 1;
// Parse response get distance to go
foreach (NcAxisModel demoAxis in demoAxes)
{
axesData.Add(new AxisModel()
{
Id = i++,
Name = demoAxis.name
});
}
}
catch (Exception ex)
{
return ManageException(ex);
}
return NO_ERROR;
}
public override CmsError AXES_RSelectedAxis(ref byte axisId)
{
// Read byte from memory
CmsError cmsError = MEM_RWByte(R, 0, MEMORY_ADDRESS.SELECTED_AXIS.MemType, MEMORY_ADDRESS.SELECTED_AXIS.Address, 1, ref axisId);
if (cmsError.IsError())
return cmsError;
return NO_ERROR;
}
public override CmsError AXES_WSelectAxis(byte axisId)
{
// Write byte from memory
CmsError cmsError = MEM_RWByte(W, 0, MEMORY_ADDRESS.SELECT_AXIS.MemType, MEMORY_ADDRESS.SELECT_AXIS.Address, 1, ref axisId);
if (cmsError.IsError())
return cmsError;
return NO_ERROR;
}
#endregion PROCESS-AXES (PATH) High-level data
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1662,6 +1777,14 @@ namespace CMS_CORE.Demo
internal static MEMORY_CELL COUNTERS = new MEMORY_CELL(MEMORY_TYPE.Demo, 43, 0, 40);
internal static MEMORY_CELL SELECTED_AXIS = new MEMORY_CELL(MEMORY_TYPE.Demo, 83, 0, 1);
internal static MEMORY_CELL SELECT_AXIS = new MEMORY_CELL(MEMORY_TYPE.Demo, 84, 0, 1);
internal static MEMORY_CELL NC_SOFTKEYS_VALUE = new MEMORY_CELL(MEMORY_TYPE.Demo, 85, 0, 4);
internal static MEMORY_CELL NC_SOFTKEYS_CLICKABLE = new MEMORY_CELL(MEMORY_TYPE.Demo, 89, 0, 4);
internal static MEMORY_CELL NC_SOFT_KEYS_CLICKED = new MEMORY_CELL(MEMORY_TYPE.Demo, 93, 4);
internal static MEMORY_CELL NC_SOFT_KEYS_ACK = new MEMORY_CELL(MEMORY_TYPE.Demo, 97, 4);
internal static MEMORY_CELL USER_SOFTKEYS_VALUE = new MEMORY_CELL(MEMORY_TYPE.Demo, 101, 0, 16);
internal static MEMORY_CELL USER_SOFTKEYS_CLICKABLE = new MEMORY_CELL(MEMORY_TYPE.Demo, 117, 0, 16);
internal static MEMORY_CELL USER_SOFT_KEYS_CLICKED = new MEMORY_CELL(MEMORY_TYPE.Demo, 133, 16);
@@ -1673,7 +1796,6 @@ namespace CMS_CORE.Demo
internal static MEMORY_CELL ALARM_ACK = new MEMORY_CELL(MEMORY_TYPE.Demo, 201, 4);
internal static MEMORY_CELL ALARM_REFRESH_STROBE = new MEMORY_CELL(MEMORY_TYPE.Demo, 205, 4);
internal static MEMORY_CELL HEADS_DATA = new MEMORY_CELL(MEMORY_TYPE.Demo, 209, 240);
internal static MEMORY_CELL HEADS_ACK = new MEMORY_CELL(MEMORY_TYPE.Demo, 449, 4);
+32 -2
View File
@@ -371,6 +371,11 @@ namespace CMS_CORE.Fanuc
return NO_ERROR;
}
public override CmsError PLC_WRestoreMessage(uint id)
{
return NO_ERROR;
}
// Get pre and post power on data
public override CmsError PLC_RPowerOnData(ref PreAndPostPowerOnModel powerOnModel)
{
@@ -402,12 +407,22 @@ namespace CMS_CORE.Fanuc
return NO_ERROR;
}
public override CmsError PLC_RSoftKeys(ref List<SoftKeysModel> softKeys)
public override CmsError PLC_RNcSoftKeys(ref List<SoftKeysModel> ncSoftKeys)
{
return NO_ERROR;
}
public override CmsError PLC_WSoftKey(uint id)
public override CmsError PLC_RUserSoftKeys(ref List<SoftKeysModel> softKeys)
{
return NO_ERROR;
}
public override CmsError PLC_WNcSoftKey(uint id)
{
return NO_ERROR;
}
public override CmsError PLC_WUserSoftKey(uint id)
{
return NO_ERROR;
}
@@ -893,6 +908,21 @@ namespace CMS_CORE.Fanuc
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError AXES_RAxesNames(ushort process, ref List<AxisModel> axesData)
{
return NO_ERROR;
}
public override CmsError AXES_RSelectedAxis(ref byte axisId)
{
return NO_ERROR;
}
public override CmsError AXES_WSelectAxis(byte axisId)
{
return NO_ERROR;
}
#endregion PROCESS-AXES (PATH) High-level data
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+240 -76
View File
@@ -1,5 +1,4 @@
using CMS_CORE_Library;
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
@@ -7,13 +6,13 @@ using System.IO;
using System.Reflection;
using static CMS_CORE_Library.DataStructures;
namespace CMS_CORE
{
public abstract partial class Nc
{
//Private Global Variables
internal Boolean Connected;
internal String Ip;
internal ushort Port;
internal Boolean UseProxy;
@@ -21,21 +20,26 @@ namespace CMS_CORE
//Osai Variable
internal string OSAI_PlcMessagesPath = @"C:\CMS\OSAI\";
internal string OSAI_WinNbiPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\OSAI\WinNBI\";
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region LIB Methods
/**
* <summary>
* Get the NC IP-Address
* <para>
* Compatibility: Fanuc | Osai | Demo
* Compatibility: Fanuc | Osai | Demo
* </para>
* </summary>
* */
public String LIB_GetIpAddress() { return Ip; }
public String LIB_GetIpAddress()
{
return Ip;
}
/**
* <summary>
@@ -45,8 +49,11 @@ namespace CMS_CORE
* </para>
* </summary>
* */
public void LIB_SetIpAddress(String ip) { Ip = ip; }
public void LIB_SetIpAddress(String ip)
{
Ip = ip;
}
/**
* <summary>
@@ -56,8 +63,11 @@ namespace CMS_CORE
* </para>
* </summary>
* */
public ushort LIB_GetPort() { return Port; }
public ushort LIB_GetPort()
{
return Port;
}
/**
* <summary>
@@ -67,8 +77,11 @@ namespace CMS_CORE
* </para>
* </summary>
* */
public void LIB_SetPort(ushort port) { Port = port; }
public void LIB_SetPort(ushort port)
{
Port = port;
}
/**
* <summary>
@@ -78,9 +91,13 @@ namespace CMS_CORE
* </para>
* </summary>
* */
public String LIB_GetLibraryVersion() { return FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion.ToString(); }
#endregion
public String LIB_GetLibraryVersion()
{
return FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion.ToString();
}
#endregion LIB Methods
#region LIB Methods (OSAI)
@@ -92,8 +109,11 @@ namespace CMS_CORE
* </para>
* </summary>
* */
public Boolean LIB_GetWindowsProxy() { return UseProxy; }
public Boolean LIB_GetWindowsProxy()
{
return UseProxy;
}
/**
* <summary>
@@ -103,8 +123,11 @@ namespace CMS_CORE
* </para>
* </summary>
* */
public void LIB_SetWindowsProxy(Boolean proxy) { UseProxy = proxy; }
public void LIB_SetWindowsProxy(Boolean proxy)
{
UseProxy = proxy;
}
/**
* <summary>
@@ -114,8 +137,11 @@ namespace CMS_CORE
* </para>
* </summary>
* */
public string LIB_GetPlcMsgsPath() { return OSAI_PlcMessagesPath; }
public string LIB_GetPlcMsgsPath()
{
return OSAI_PlcMessagesPath;
}
/**
* <summary>
@@ -125,8 +151,11 @@ namespace CMS_CORE
* </para>
* </summary>
* */
public void LIB_SetPlcMsgsPath(string folder) { OSAI_PlcMessagesPath = folder; }
public void LIB_SetPlcMsgsPath(string folder)
{
OSAI_PlcMessagesPath = folder;
}
/**
* <summary>
@@ -136,8 +165,11 @@ namespace CMS_CORE
* </para>
* </summary>
* */
public string LIB_GetWinNbiPath() { return OSAI_WinNbiPath; }
public string LIB_GetWinNbiPath()
{
return OSAI_WinNbiPath;
}
/**
* <summary>
@@ -147,12 +179,16 @@ namespace CMS_CORE
* </para>
* </summary>
* */
public void LIB_SetWinNbiPath(string folder) { OSAI_WinNbiPath = folder; }
public void LIB_SetWinNbiPath(string folder)
{
OSAI_WinNbiPath = folder;
}
#endregion
#endregion LIB Methods (OSAI)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region NC High-level data (to override)
/**
@@ -164,8 +200,8 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* </summary>
* */
public abstract CmsError NC_Connect();
public abstract CmsError NC_Connect();
/**
* <summary>
@@ -176,8 +212,8 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* </summary>
* */
public abstract CmsError NC_Disconnect();
public abstract CmsError NC_Disconnect();
/**
* <summary>
@@ -188,8 +224,11 @@ namespace CMS_CORE
* </summary>
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* */
public Boolean NC_IsConnected() { return Connected; }
public Boolean NC_IsConnected()
{
return Connected;
}
/**
* <summary>
@@ -201,8 +240,8 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <param name="ActualTime">Reference of a DateTime Variable where data will be saved</param>
* */
public abstract CmsError NC_RDateTime(ref DateTime ActualTime);
public abstract CmsError NC_RDateTime(ref DateTime ActualTime);
/**
* <summary>
@@ -214,6 +253,7 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <param name="SN">Reference of a String Variable where data will be saved</param>
* */
public abstract CmsError NC_RSerialNumber(ref String SN);
/**
@@ -226,6 +266,7 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <param name="ModelName">Reference of a String Variable where data will be saved</param>
* */
public abstract CmsError NC_RModelName(ref String ModelName);
/**
@@ -238,6 +279,7 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <param name="SWV">Reference of a String Variable where data will be saved</param>
* */
public abstract CmsError NC_RSoftwareVersion(ref String SWV);
/**
@@ -250,6 +292,7 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <param name="MachNumber">Reference of a String Variable where data will be saved</param>
* */
public abstract CmsError NC_RMachineNumber(ref String MachNumber);
/**
@@ -262,6 +305,7 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <param name="ProcNumber">Reference of a ushort Variable where data will be saved</param>
* */
public abstract CmsError NC_RProcessesNum(ref ushort ProcNumber);
/**
@@ -274,12 +318,12 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <param name="Language">Reference of a CultureInfo Variable where data will be saved</param>
* */
public abstract CmsError NC_RLanguage(ref CultureInfo Language);
public abstract CmsError NC_RLanguage(ref CultureInfo Language);
/**
* <summary>
* Read active alarms of the NC (Nc-Process indipendent). For OSAI Nc the list can contain only one Message
* Read active alarms of the NC (Nc-Process indipendent). For OSAI Nc the list can contain only one Message
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
@@ -288,6 +332,7 @@ namespace CMS_CORE
* <param name="ProcNumber">Process to execute the action</param>
* <param name="alarms">Reference of a List of String Variables where data will be saved</param>
* */
public abstract CmsError NC_RActiveAlarms(ref List<AlarmModel> alarms);
/**
@@ -300,13 +345,15 @@ namespace CMS_CORE
* <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);
public abstract CmsError NC_GetTranslatedPlcMessages(string language, ref Dictionary<int, string> messages);
#endregion
#endregion NC High-level data (to override)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region NC Low-level data (to override)
/**
@@ -320,6 +367,7 @@ namespace CMS_CORE
* <param name="Bit">Set the Bit to Read. (0..7)</param>
* <param name="Value">Reference of a variable with Param values</param>
* */
public abstract CmsError NC_RParam(short Index, short Bit, ref Boolean Value);
/**
@@ -332,6 +380,7 @@ namespace CMS_CORE
* <param name="Index">Index of the parameter</param>
* <param name="Value">Reference of a variable with Param values</param>
* */
public abstract CmsError NC_RParam(short Index, ref byte Value);
/**
@@ -344,6 +393,7 @@ namespace CMS_CORE
* <param name="Index">Index of the parameter</param>
* <param name="Value">Reference of a variable with Param values</param>
* */
public abstract CmsError NC_RParam(short Index, ref short Value);
/**
@@ -356,6 +406,7 @@ namespace CMS_CORE
* <param name="Index">Index of the parameter</param>
* <param name="Value">Reference of a variable with Param values</param>
* */
public abstract CmsError NC_RParam(short Index, ref int Value);
/**
@@ -368,10 +419,13 @@ namespace CMS_CORE
* <param name="Index">Index of the parameter</param>
* <param name="Value">Reference of a variable with Param values</param>
* */
public abstract CmsError NC_RParam(short Index, ref double Value);
#endregion
#endregion NC Low-level data (to override)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region PLC High-level data (to override)
/**
@@ -384,20 +438,36 @@ namespace CMS_CORE
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <param name="Alarms">Reference of a List of String Variables where data will be saved</param>
* */
public abstract CmsError PLC_RActiveMessages(ref List<PlcAlarmModel> Alarms);
/**
* <summary>
* Start refresh message
* Start refresh message procedure
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <param name="id">Alarm id to refresh</param>
* <param name="id">Alarm id to refresh</param>
* * */
public abstract CmsError PLC_WRefreshMessage(uint id);
/**
* <summary>
* Start restore message procedure
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <param name="id">Alarm id to restore</param>
*
* */
public abstract CmsError PLC_WRestoreMessage(uint id);
/**
* <summary>
* Read the status of the Power on data ( Pre-Power-On / Post-Power-On )
@@ -408,6 +478,7 @@ namespace CMS_CORE
* </summary>
* <param name="powerOnModel"> Reference to the structure where the power on data will be saved</param>
**/
public abstract CmsError PLC_RPowerOnData(ref PreAndPostPowerOnModel powerOnModel);
/**
@@ -421,17 +492,19 @@ namespace CMS_CORE
* <param name="id"> Id of the edited power on data </param>
* <param name="value"> Reference to the value of the power on data</param>
**/
public abstract CmsError PLC_WPowerOnData(uint id, bool value);
/**
* <summary>
* Read the status of the UI functions from PLC
* Read the status of the UI functionality from PLC
* <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);
/**
@@ -444,6 +517,7 @@ namespace CMS_CORE
* <param name="functions">Reference to the axes reset procedure data</param>
* </summary>
**/
public abstract CmsError PLC_RAxesResetData(ref AxisResetDataModel axisResetData);
/**
@@ -456,8 +530,22 @@ namespace CMS_CORE
* <param name="counters">Reference to the counters data</param>
* </summary>
**/
public abstract CmsError PLC_RMachineCounters(ref List<CounterModel> counters);
/**
* <summary>
* Read nc softkeys values from PLC
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <param name="softKeys">Reference to the nc softkey data</param>
* </summary>
**/
public abstract CmsError PLC_RNcSoftKeys(ref List<SoftKeysModel> ncSoftKeys);
/**
* <summary>
* Read user softkeys values from PLC
@@ -468,11 +556,25 @@ namespace CMS_CORE
* <param name="softKeys">Reference to the softkey data</param>
* </summary>
**/
public abstract CmsError PLC_RSoftKeys(ref List<SoftKeysModel> softKeys);
public abstract CmsError PLC_RUserSoftKeys(ref List<SoftKeysModel> softKeys);
/**
* <summary>
* Write user softkey click into PLC
* Write Nc softkey interaction into PLC
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* <returns cref="CmsError">Returns an when an internal or a library error occours</returns>
* <param name="id">Nc softkey id</param>
* </summary>
**/
public abstract CmsError PLC_WNcSoftKey(uint id);
/**
* <summary>
* Write user softkey interaction into PLC
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
@@ -480,19 +582,46 @@ namespace CMS_CORE
* <param name="id">User softkey id</param>
* </summary>
**/
public abstract CmsError PLC_WSoftKey(uint id);
public abstract CmsError PLC_WUserSoftKey(uint id);
/**
* <summary>
* Read heads data from PLC
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <param name="heads">Recerence to the heads data</param>
* <param name="number">Number of heads data that are read</param>
* </summary>
**/
public abstract CmsError PLC_RHeadsData(List<HeadDataModel> heads, int number);
/**
* <summary>
* Write head override sign into PLC
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <param name="id">Head id</param>
* <param name="sign">Type of increment of the override</param>
* </summary>
**/
public abstract CmsError PLC_WHeadOverride(uint id, HEAD_OVERRIDE_SIGN sign);
#endregion
#endregion PLC High-level data (to override)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region PROCESS (PATH, CHANNEL) data (to override)
/**
* <summary>
* Read the actual status of the Process "ProcNumber"
* Read the actual status of the Process "ProcNumber"
* <para>See <see cref="Nc.PROC_STATUS"/> for information about the PROC_Status type</para>
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
@@ -502,11 +631,12 @@ namespace CMS_CORE
* <param name="ProcNumber">Process number which the data refer</param>
* <param name="Status">Reference of a PROC_Status Variable where data will be saved</param>
* */
public abstract CmsError PROC_RStatus(ushort ProcNumber, ref PROC_STATUS Status);
/**
* <summary>
* Read the selected Mode Process "ProcNumber"
* Read the selected Mode Process "ProcNumber"
* <para>See <see cref="Nc.PROC_MODE"/> for information about the PROC_Status type</para>
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
@@ -516,12 +646,12 @@ namespace CMS_CORE
* <param name="ProcNumber">Process number which the data refer</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);
/**
* <summary>
* Read active alarms of the process "ProcNumber". For OSAI Nc the list can contain only one Message
* Read active alarms of the process "ProcNumber". For OSAI Nc the list can contain only one Message
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
@@ -530,8 +660,8 @@ namespace CMS_CORE
* <param name="ProcNumber">Process number which the data refer</param>
* <param name="Alarms">Reference of a List of String Variables where data will be saved</param>
* */
public abstract CmsError PROC_RActiveAlarms(ushort procNumber, ref List<AlarmModel> alarms);
public abstract CmsError PROC_RActiveAlarms(ushort procNumber, ref List<AlarmModel> alarms);
/**
* <summary>
@@ -544,8 +674,8 @@ namespace CMS_CORE
* <param name="procNumber">Process number which the data refer</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);
/**
* <summary>
@@ -558,6 +688,7 @@ namespace CMS_CORE
* <param name="procNumber">Process number which the data refer</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);
/**
@@ -568,10 +699,10 @@ namespace CMS_CORE
* </para>
* <param name="procNumber">Process number which the data refer</param>
* <param name="processData">Reference to part program data structure</param>
* </summary>
* </summary>
**/
public abstract CmsError PROC_RStatusAndData(ushort procNumber, ref ProcessDataModel processData);
public abstract CmsError PROC_RStatusAndData(ushort procNumber, ref ProcessDataModel processData);
/**
*<summary>
@@ -580,8 +711,9 @@ namespace CMS_CORE
* Compatibility: Fanuc | Osai | Siemens
* </para>
* <param name="procNumber">Reference to the process number selected</param>
* </summary>
* </summary>
**/
public abstract CmsError PROC_RSelectedProcess(ref ushort procNumber);
/**
@@ -591,12 +723,15 @@ namespace CMS_CORE
* Compatibility: Fanuc | Osai | Siemens
* </para>
* <param name="procNumber">New selected process number</param>
* </summary>
* </summary>
**/
public abstract CmsError PROC_WSelectProcess(ushort procNumber);
#endregion
#endregion PROCESS (PATH, CHANNEL) data (to override)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region AXES data (to override)
/**
@@ -610,12 +745,13 @@ namespace CMS_CORE
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
* */
public abstract CmsError AXES_RInterpPosition(ushort ProcNumber, ref Dictionary<String, double> Axes);
/**
* <summary>
* Read the Programmed position of all axes in Process "ProcNumber".
* For Fanuc-Nc there's not "Programmed position" variables. Si it is calculated from Machine-Pos and Distance-to-go
* Read the Programmed position of all axes in Process "ProcNumber".
* For Fanuc-Nc there's not "Programmed position" variables. Si it is calculated from Machine-Pos and Distance-to-go
* <para>
* Compatibility: Fanuc | Osai | Demo
* </para>
@@ -624,6 +760,7 @@ namespace CMS_CORE
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
* */
public abstract CmsError AXES_RProgrPosition(ushort ProcNumber, ref Dictionary<String, double> Axes);
/**
@@ -637,6 +774,7 @@ namespace CMS_CORE
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
* */
public abstract CmsError AXES_RMachinePosition(ushort ProcNumber, ref Dictionary<String, double> Axes);
/**
@@ -650,6 +788,7 @@ namespace CMS_CORE
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
* */
public abstract CmsError AXES_RFollowingError(ushort ProcNumber, ref Dictionary<String, double> Axes);
/**
@@ -663,12 +802,19 @@ namespace CMS_CORE
* <param name="ProcNumber">Process to execute the action</param>
* <param name="Axes">Reference of Dictionary "Key,Value" with: Key: Axis Name, Value: Position</param>
* */
public abstract CmsError AXES_RDistanceToGo(ushort ProcNumber, ref Dictionary<String, double> Axes);
public abstract CmsError AXES_RAxesNames(ushort process, ref List<AxisModel> axesData);
#endregion
public abstract CmsError AXES_RSelectedAxis(ref byte axisId);
public abstract CmsError AXES_WSelectAxis(byte axisId);
#endregion AXES data (to override)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region MEMORY Low-level function: single valiable in memory (to override)
/**
@@ -685,6 +831,7 @@ namespace CMS_CORE
* <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);
/**
@@ -702,10 +849,9 @@ namespace CMS_CORE
* <param name="MemBit">Set the Bit to Read-Write. (0..7)</param>
* <param name="Value">Reference to variable to read/Write</param>
* */
public abstract CmsError MEM_RWBoolean(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int MemBit, ref Boolean Value);
/**
* <summary>Read/Write Byte variable from/into NC Memory Area
* <para>
@@ -720,6 +866,7 @@ namespace CMS_CORE
* <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);
/**
@@ -737,10 +884,9 @@ namespace CMS_CORE
* <param name="MemByteStart">Set to 1 if the Byte is the second of a WORD (only for OSAI Nc)</param>
* <param name="Value">Reference to variable to read/Write</param>
* */
public abstract CmsError MEM_RWByte(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int MemByte, ref Byte Value);
/**
* <summary>Read/Write unsigned 2 Byte (NC: Word:, .NET: ushort) variable from/into NC Memory Area
* <para>
@@ -755,6 +901,7 @@ namespace CMS_CORE
* <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);
/**
@@ -772,10 +919,9 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWWord(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, ref ushort Value);
/**
* <summary>Read/Write signed 2 Byte (NC: Word:, .NET: short) variable from/into NC Memory Area
* <para>
@@ -790,6 +936,7 @@ namespace CMS_CORE
* <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);
/**
@@ -807,10 +954,9 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWShort(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, ref short Value);
/**
* <summary>Read/Write signed 4 Byte (NC: DWord:, .NET: uint) variable from/into NC Memory Area
* <para>
@@ -825,6 +971,7 @@ namespace CMS_CORE
* <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);
/**
@@ -842,10 +989,9 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWDWord(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, ref uint Value);
/**
* <summary>Read/Write signed 4 Byte (NC: DWord:, .NET: int) variable from/into NC Memory Area
* <para>
@@ -860,6 +1006,7 @@ namespace CMS_CORE
* <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);
/**
@@ -877,11 +1024,13 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWInteger(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, ref int Value);
#endregion
#endregion MEMORY Low-level function: single valiable in memory (to override)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region NC Low-level function: variables List in memory (to override)
/**
@@ -899,6 +1048,7 @@ namespace CMS_CORE
* <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);
/**
@@ -917,10 +1067,9 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWByteList(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int MemByteStart, int Number, ref List<Byte> Value);
/**
* <summary>Read/Write List of unsigned 2 Byte (NC: Word:, .NET: ushort) from/into NC Memory Area
* <para>
@@ -935,6 +1084,7 @@ namespace CMS_CORE
* <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);
/**
@@ -952,10 +1102,9 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWWordList(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<ushort> Value);
/**
* <summary>Read/Write List of signed 2 Byte (NC: Word:, .NET: short) from/into NC Memory Area
* <para>
@@ -972,6 +1121,7 @@ namespace CMS_CORE
* */
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>
@@ -987,10 +1137,9 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWShortList(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<short> Value);
/**
* <summary>Read/Write List of unsigned 4 Byte (NC: DWord:, .NET: uint) from/into NC Memory Area
* <para>
@@ -1005,6 +1154,7 @@ namespace CMS_CORE
* <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);
/**
@@ -1022,10 +1172,9 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWDWordList(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<uint> Value);
/**
* <summary>Read/Write List of signed 4 Byte (NC: DWord:, .NET: int) from/into NC Memory Area
* <para>
@@ -1040,6 +1189,7 @@ namespace CMS_CORE
* <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);
/**
@@ -1057,11 +1207,13 @@ namespace CMS_CORE
* <param name="Number">Number of sequential data Read/Write. (Used only in Reading Operation)</param>
* <param name="Value">List of values to read/Write</param>
* */
public abstract CmsError MEM_RWIntegerList(Boolean bWrite, int Process, MEMORY_TYPE MemType, int MemTable, int MemIndex, int Number, ref List<int> Value);
#endregion
#endregion NC Low-level function: variables List in memory (to override)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region File Management (To override)
/**
@@ -1075,6 +1227,7 @@ namespace CMS_CORE
* <param name="partProgramLocalName">Name of the Part Program and name of new local file</param>
* <param name="localFile">Reference to the new local file where the NC Part Program data will be saved</param>
* */
public abstract CmsError FILES_RProgramToFile(string partProgramPath, FileStream localFile);
/**
@@ -1087,6 +1240,7 @@ namespace CMS_CORE
* <param name="partProgramPath">Path of the Part Program stored in the Nc</param>
* <param name="localFile">Reference to the local Part Program file</param>
* */
public abstract CmsError FILES_WProgramFromFile(string partProgramPath, FileStream localFile);
/**
@@ -1095,15 +1249,16 @@ namespace CMS_CORE
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
* </summary>
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <returns cref="CmsError">Returns an error when an internal or a library error occours</returns>
* <param name="partProgramPath">Path where the Part Program is saved in the NC</param>
* <param name="newPartProgramPath">Path of the copy Part Program destination</param>
* <param name="failIfExist"></param>
* */
public abstract CmsError FILES_CopyProgram(string partProgramPath, string newPartProgramPath, bool failIfExist);
/**
* <summary>Delete a Nc Part Program
* <summary>Delete a Nc Part Program
* <para>
* Compatibility: Fanuc | Osai | Demo | Siemens
* </para>
@@ -1112,11 +1267,13 @@ namespace CMS_CORE
* <param name="partProgramPath">Path where the Nc Part Program is saved in the NC</param>
* <param name="partProgramName">Name of the Part Program file</param>
* */
public abstract CmsError FILES_DeleteProgram(string partProgramPath, string partProgramName);
#endregion
#endregion File Management (To override)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region CONSTANTS (Struct and Enum are Static for definition)
// Read Write type
@@ -1130,6 +1287,7 @@ namespace CMS_CORE
// R-W MEMORY Type
/** <summary>Nc Memory Type (Table)</summary> */
public enum MEMORY_TYPE
{
/** <summary>Null Type</summary> */
@@ -1207,7 +1365,6 @@ namespace CMS_CORE
/** <summary>Osai SYMO Area</summary> */
Osai_SYMO = 102,
///////////////////////////////////////////////////////////////////
//Siemens Memory Type,
/** <summary>Siemens DB</summary> */
@@ -1221,6 +1378,7 @@ namespace CMS_CORE
// NC Memory Type Name
internal const String FANUC_MEMTYPE = "Fanuc_";
internal const String SIEMENS_MEMTYPE = "Siemens_";
internal const String OSAI_MEMTYPE = "Osai_";
internal const String DEMO_MEMTYPE = "Demo_";
@@ -1231,6 +1389,7 @@ namespace CMS_CORE
//Fanuc Variable & Const
internal const short FANUC_MAXNVAR = 5;
internal const short FANUC_MAXMSGCNC = 10;
internal const short FANUC_MAXMSGPMC = 5;
internal const short FANUC_ABSOLUTEPOS = 0;
@@ -1238,6 +1397,7 @@ namespace CMS_CORE
internal const short FANUC_RELATIVEPOS = 2;
internal const short FANUC_DISTTOGO = 3;
internal const short FANUC_ALLPOS = -1;
internal enum FANUC_DType : short { BYTE = 0, WORD = 1, LONG = 2 };
internal const ushort OSAI_PROGRAMMEDPOS = 1;
@@ -1247,9 +1407,10 @@ namespace CMS_CORE
internal const ushort OSAI_DISTTOGO = 5;
internal const ushort OSAI_MACHINEPOS = 6;
#endregion
#endregion CONSTANTS (Struct and Enum are Static for definition)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Fixed memory area
//Lingua CN
@@ -1257,17 +1418,19 @@ namespace CMS_CORE
//Matricola Macchina
internal MEMORY_CELL MATR_MACCH_OSAI = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 3403, 0, 1);
internal MEMORY_CELL MATR_MACCH_FANUC = new MEMORY_CELL(MEMORY_TYPE.Fanuc_D, 4018, 0, 1);
internal MEMORY_CELL MATR_MACCH_SIEMENS = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 255, 0, 1);
//Messaggi PLC
internal MEMORY_CELL PLC_MESS_OSAI = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 12000, 0, 64);
#endregion
#endregion Fixed memory area
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Helper Function
internal void AddNcAlarmToList(uint id, string message, List<AlarmModel> alarms)
{
alarms.Add(new AlarmModel()
@@ -1300,6 +1463,7 @@ namespace CMS_CORE
Process = processes
});
}
#endregion
#endregion Helper Function
}
}
}
+95 -25
View File
@@ -352,16 +352,6 @@ namespace CMS_CORE.Osai
#region PLC High-level data
public override CmsError PLC_RPowerOnData(ref PreAndPostPowerOnModel powerOnModel)
{
return NO_ERROR;
}
public override CmsError PLC_WPowerOnData(uint id, bool value)
{
return NO_ERROR;
}
//Get the PLC Active Alarms
//public override CmsError PLC_RActiveMessages(ref List<PlcAlarmModel> alarms)
//{
@@ -407,19 +397,19 @@ namespace CMS_CORE.Osai
try
{
alarms.Clear();
List<int> readedValues = new List<int>();
List<int> readValues = new List<int>();
// Read on data from memory
CmsError cmsError = MEM_RWIntegerList(R, 0,
MEMORY_ADDRESS.ALARMS_STATUS.MemType,
MEMORY_ADDRESS.ALARMS_STATUS.Address,
(MEMORY_ADDRESS.ALARMS_STATUS.Size + MEMORY_ADDRESS.ALARMS_DATA.Size) / 4,
ref readedValues);
ref readValues);
if (cmsError.IsError())
return cmsError;
// Convert integer array into bit array
bool[] statusBits = new BitArray(readedValues.ToArray()).Cast<bool>().ToArray();
bool[] statusBits = new BitArray(readValues.ToArray()).Cast<bool>().ToArray();
for (int i = 0; i < MEMORY_ADDRESS.ALARMS_STATUS.Size * 8; i++)
{
@@ -461,6 +451,21 @@ namespace CMS_CORE.Osai
return NO_ERROR;
}
public override CmsError PLC_WRestoreMessage(uint id)
{
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_RFunctionAccess(ref List<FunctionalityModel> functions)
{
functions = new List<FunctionalityModel>();
@@ -477,12 +482,22 @@ namespace CMS_CORE.Osai
return NO_ERROR;
}
public override CmsError PLC_RSoftKeys(ref List<SoftKeysModel> softKeys)
public override CmsError PLC_WNcSoftKey(uint id)
{
return NO_ERROR;
}
public override CmsError PLC_WSoftKey(uint id)
public override CmsError PLC_RNcSoftKeys(ref List<SoftKeysModel> ncSoftKeys)
{
return NO_ERROR;
}
public override CmsError PLC_RUserSoftKeys(ref List<SoftKeysModel> softKeys)
{
return NO_ERROR;
}
public override CmsError PLC_WUserSoftKey(uint id)
{
return NO_ERROR;
}
@@ -759,7 +774,7 @@ namespace CMS_CORE.Osai
#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 Process, ref Dictionary<String, double> Axes)
public override CmsError AXES_RInterpPosition(ushort process, ref Dictionary<String, double> Axes)
{
//Check if the NC is Connected
CmsError cmsError = CheckConnection();
@@ -776,7 +791,7 @@ namespace CMS_CORE.Osai
//Try to get information
try
{
nReturn = OpenNC.GetAxesPosition(Process, 0, OSAI_INTERPOLPOS, ref nAxis, out Pos, out errorClass, out errorNum);
nReturn = OpenNC.GetAxesPosition(process, 0, OSAI_INTERPOLPOS, ref nAxis, out Pos, out errorClass, out errorNum);
//If there's an error launch exception
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
@@ -811,7 +826,7 @@ namespace CMS_CORE.Osai
}
//Get a dictionary with the Programmed position of the axes in Process
public override CmsError AXES_RProgrPosition(ushort Process, ref Dictionary<String, double> Axes)
public override CmsError AXES_RProgrPosition(ushort process, ref Dictionary<String, double> Axes)
{
//Check if the NC is Connected
CmsError cmsError = CheckConnection();
@@ -828,7 +843,7 @@ namespace CMS_CORE.Osai
//Try to get information
try
{
nReturn = OpenNC.GetAxesPosition(Process, 0, OSAI_PROGRAMMEDPOS, ref nAxis, out Pos, out errorClass, out errorNum);
nReturn = OpenNC.GetAxesPosition(process, 0, OSAI_PROGRAMMEDPOS, ref nAxis, out Pos, out errorClass, out errorNum);
//If there's an error launch exception
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
@@ -863,7 +878,7 @@ namespace CMS_CORE.Osai
}
//Get a dictionary with the Machine position of the axes in Process
public override CmsError AXES_RMachinePosition(ushort Process, ref Dictionary<String, double> Axes)
public override CmsError AXES_RMachinePosition(ushort process, ref Dictionary<String, double> Axes)
{
//Check if the NC is Connected
CmsError cmsError = CheckConnection();
@@ -880,7 +895,7 @@ namespace CMS_CORE.Osai
//Try to get information
try
{
nReturn = OpenNC.GetAxesPosition(Process, 0, OSAI_MACHINEPOS, ref nAxis, out Pos, out errorClass, out errorNum);
nReturn = OpenNC.GetAxesPosition(process, 0, OSAI_MACHINEPOS, ref nAxis, out Pos, out errorClass, out errorNum);
//If there's an error launch exception
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
@@ -915,7 +930,7 @@ namespace CMS_CORE.Osai
}
//Get a dictionary with the Following Error of the axes in Process
public override CmsError AXES_RFollowingError(ushort Process, ref Dictionary<String, double> Axes)
public override CmsError AXES_RFollowingError(ushort process, ref Dictionary<String, double> Axes)
{
//Check if the NC is Connected
CmsError cmsError = CheckConnection();
@@ -932,7 +947,7 @@ namespace CMS_CORE.Osai
//Try to get information
try
{
nReturn = OpenNC.GetAxesPosition(Process, 0, OSAI_FOLLERROR, ref nAxis, out Pos, out errorClass, out errorNum);
nReturn = OpenNC.GetAxesPosition(process, 0, OSAI_FOLLERROR, ref nAxis, out Pos, out errorClass, out errorNum);
//If there's an error launch exception
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
@@ -967,7 +982,7 @@ namespace CMS_CORE.Osai
}
//Get a dictionary with the Distance To Go of the axes in Process
public override CmsError AXES_RDistanceToGo(ushort Process, ref Dictionary<String, double> Axes)
public override CmsError AXES_RDistanceToGo(ushort process, ref Dictionary<String, double> Axes)
{
//Check if the NC is Connected
CmsError cmsError = CheckConnection();
@@ -984,7 +999,7 @@ namespace CMS_CORE.Osai
//Try to get information
try
{
nReturn = OpenNC.GetAxesPosition(Process, 0, OSAI_FOLLERROR, ref nAxis, out Pos, out errorClass, out errorNum);
nReturn = OpenNC.GetAxesPosition(process, 0, OSAI_FOLLERROR, ref nAxis, out Pos, out errorClass, out errorNum);
//If there's an error launch exception
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
@@ -1018,6 +1033,61 @@ namespace CMS_CORE.Osai
return NO_ERROR;
}
public override CmsError AXES_RAxesNames(ushort process, ref List<AxisModel> axesData)
{
//Check if the NC is Connected
CmsError cmsError = CheckConnection();
if (cmsError.IsError())
return cmsError;
axesData.Clear();
ushort nReturn, axesNumber = 64;
uint errorClass, errorNum;
unsignedshortarray axesProcess;
unsignedshortarray axesType;
unsignedshortarray axesInterface;
byte[] axesName;
//Try to get information
try
{
// Read axes info from NC
nReturn = OpenNC.GetAxesInfo3(ushort.MaxValue, ref axesNumber, out axesProcess, out axesName, out axesType, out axesInterface, out errorClass, out errorNum);
for (int i = 0; i < axesNumber; i++)
{
var charName = Convert.ToChar(axesName[i]);
// Filter per master axes and process
if((charName < 'a' || charName > 'z') && charName != 'S' && charName != '\0' && axesProcess[i] == process)
{
// Add to returned value
axesData.Add(new AxisModel()
{
Id = i + 1,
Name = charName.ToString()
});
}
}
return NO_ERROR;
}
catch (Exception ex)
{
return ManageException(ex);
}
}
public override CmsError AXES_RSelectedAxis(ref byte axisId)
{
return NO_ERROR;
}
public override CmsError AXES_WSelectAxis(byte axisId)
{
return NO_ERROR;
}
#endregion PROCESS-AXES (PATH) High-level data
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+31 -2
View File
@@ -298,6 +298,11 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
public override CmsError PLC_WRestoreMessage(uint id)
{
return NO_ERROR;
}
public override CmsError PLC_RFunctionAccess(ref List<FunctionalityModel> functions)
{
functions = new List<FunctionalityModel>();
@@ -324,12 +329,22 @@ namespace CMS_CORE.Siemens
return NO_ERROR;
}
public override CmsError PLC_RSoftKeys(ref List<SoftKeysModel> softKeys)
public override CmsError PLC_RNcSoftKeys(ref List<SoftKeysModel> ncSoftKeys)
{
return NO_ERROR;
}
public override CmsError PLC_WSoftKey(uint id)
public override CmsError PLC_RUserSoftKeys(ref List<SoftKeysModel> softKeys)
{
return NO_ERROR;
}
public override CmsError PLC_WNcSoftKey(uint id)
{
return NO_ERROR;
}
public override CmsError PLC_WUserSoftKey(uint id)
{
return NO_ERROR;
}
@@ -598,6 +613,20 @@ namespace CMS_CORE.Siemens
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError AXES_RAxesNames(ushort process, ref List<AxisModel> axesData)
{
return NO_ERROR;
}
public override CmsError AXES_RSelectedAxis(ref byte axisId)
{
return NO_ERROR;
}
public override CmsError AXES_WSelectAxis(byte axisId)
{
return NO_ERROR;
}
#endregion PROCESS-AXES (PATH) High-level data
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -325,13 +325,20 @@ namespace Nc_Demo_Application.Database
public List<NcAxisModel> GetNcAxes()
{
int lastId = 0;
List<NcAxisModel> axes = new List<NcAxisModel>();
foreach (DataRow row in ncAxesDataTable.Rows)
{
if (Convert.IsDBNull(row["id"]))
lastId = lastId + 1;
else
lastId = Convert.ToInt32(row["id"]);
// Convert DataTable.row into axis model
NcAxisModel tmpAxis = new NcAxisModel
{
id = Convert.ToInt32(row["id"]),
id = lastId,
name = row["name"].ToString(),
actual = Convert.ToDouble(row["actual"]),
programmed = Convert.ToDouble(row["programmed"]),