DemoWrite m155

This commit is contained in:
Lucio Maranta
2018-11-16 12:27:30 +00:00
parent abf2dbabe2
commit 3cfd7f76e3
2 changed files with 22 additions and 19 deletions
+5 -2
View File
@@ -829,8 +829,10 @@ namespace CMS_CORE_Library.Demo
public override CmsError PLC_WOperatorInputResponse(int process, double responseVal)
{
byte approxymatedVal = Convert.ToByte(responseVal >= 255 ? 255 : responseVal);
int procAddress = OPERATOR_INPUT_RESPONSE.Address + process - 1;
return NO_ERROR;
return MEM_RWByte(W, 0, MEMORY_TYPE.Demo, procAddress, 0, ref approxymatedVal);
}
public override CmsError PLC_RMTConnectData(ref List<MtConnectDataIsNeededModel> value)
@@ -3103,7 +3105,8 @@ namespace CMS_CORE_Library.Demo
internal static MEMORY_CELL COUNTERS_STROBE = new MEMORY_CELL(MEMORY_TYPE.Demo, 3010, 2);
internal static MEMORY_CELL OPERATOR_INPUT_NEEDED = new MEMORY_CELL(MEMORY_TYPE.Demo, 450, 1);
internal static MEMORY_CELL MTCONNECT_DATA_NEEDED = new MEMORY_CELL(MEMORY_TYPE.Demo, 451, 1);
internal static MEMORY_CELL OPERATOR_INPUT_RESPONSE = new MEMORY_CELL(MEMORY_TYPE.Demo, 451, 1);
internal static MEMORY_CELL MTCONNECT_DATA_NEEDED = new MEMORY_CELL(MEMORY_TYPE.Demo, 452, 1);
}
#endregion Memory addresses
+17 -17
View File
@@ -972,39 +972,39 @@ namespace CMS_CORE_Library.Osai
return NO_ERROR;
}
//Get the process Alarm
// Get the process Alarm
public override CmsError PROC_RActiveAlarms(ushort procNumber, ref List<AlarmModel> alarms)
{
//Check if the NC is Connected
// Check if the NC is Connected
CmsError cmsError = CheckConnection();
if (cmsError.IsError())
return cmsError;
ushort nReturn;
//Try to get information
// Try to get information
try
{
//Clear the OLD Message
// Clear the OLD Message
alarms.Clear();
//Execute the method
// Execute the method
nReturn = OpenNC.ReadCurrentErrorMsg(procNumber, out MSGERROR err, out uint errorClass, out uint errorNum);
//If there's an error launch exception
// If there's an error launch exception
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
return GetNCError(errorClass, errorNum);
//If there's an error
// If there's an error
if (err.CodeErr != 0)
{
//Create a CNDEX style error
// Create a CNDEX style error
Cndex.MSG_ERROR CndexError = ConverToCndexMessage(err);
MESSAGE_TEXT Message = new MESSAGE_TEXT();
//Translate using OSAI .DLL (a new one!)
// Translate using OSAI .DLL (a new one!)
OSAIErrorManagerLibrary.TranslateErrorMsg(ref CndexError, ref Message);
//Build the new String Message
// Build the new String Message
AddAlarmToList((uint)CndexError.Code_Err, OsaiToStepMessage(Message), procNumber, alarms);
}
}
@@ -1016,10 +1016,10 @@ namespace CMS_CORE_Library.Osai
return NO_ERROR;
}
//Get PP Lines
// Get PP Lines
public override CmsError PROC_RPPLines(ushort ProcNumber, ref List<string> Lines)
{
//Check if the NC is Connected
// Check if the NC is Connected
CmsError cmsError = CheckConnection();
if (cmsError.IsError())
return cmsError;
@@ -1033,20 +1033,20 @@ namespace CMS_CORE_Library.Osai
string L7 = "";
string L8 = "";
//Try to get information
// Try to get information
try
{
//Execute the method
// Execute the method
nReturn = OpenNC.GetPartProgramLines(ProcNumber, out L1, out L2, out L3, out L4, out L5, out L6, out L7, out L8, out uint errorClass, out uint errorNum);
//If there's an error launch exception
// If there's an error launch exception
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
return GetNCError(errorClass, errorNum);
//Clear All Values
// Clear All Values
Lines.Clear();
//Build the new Lines
// Build the new Lines
Lines.Add(L1);
Lines.Add(L2);
Lines.Add(L3);