Added method for Thermo recipe confirm
This commit is contained in:
@@ -634,6 +634,12 @@ namespace CMS_CORE_Library
|
||||
/// <returns></returns>
|
||||
public abstract CmsError PLC_WRecipeParam(ThermoModels.RecipeParam updtParam);
|
||||
/// <summary>
|
||||
/// Confirm/Cancel recipe modifications
|
||||
/// </summary>
|
||||
/// <param name="confirmUpdate">true: HMI --> PLC, false: PLC --> HMI</param>
|
||||
/// <returns></returns>
|
||||
public abstract CmsError PLC_WRecipeEdit(bool confirmUpdate);
|
||||
/// <summary>
|
||||
/// Get current Modules Block list
|
||||
/// </summary>
|
||||
/// <param name="onlyRT">updates only RT parameters (false = update all)</param>
|
||||
|
||||
@@ -1853,6 +1853,33 @@ namespace CMS_CORE_Library.S7Net
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
/// <summary>
|
||||
/// Confirm/Cancel recipe modifications
|
||||
/// </summary>
|
||||
/// <param name="confirmUpdate">true: HMI --> PLC, false: PLC --> HMI</param>
|
||||
/// <returns></returns>
|
||||
public override CmsError PLC_WRecipeEdit(bool confirmUpdate)
|
||||
{
|
||||
// se update --> scrivo strobe comando update...
|
||||
if (confirmUpdate)
|
||||
{
|
||||
// Call confirm update
|
||||
CmsError cmsError = PLC_WStrobe(PARAMETER_EDIT_ACK, PARAMETER_EDIT_STROBE, 2);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
}
|
||||
// altrimenti mando strobe comando cancel...
|
||||
else
|
||||
{
|
||||
// Call cancel update
|
||||
CmsError cmsError = PLC_WStrobe(PARAMETER_EDIT_ACK, PARAMETER_EDIT_STROBE, 3);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get current Modules Block list
|
||||
/// </summary>
|
||||
@@ -1946,7 +1973,7 @@ namespace CMS_CORE_Library.S7Net
|
||||
MoldTemp = S7.Net.Types.Double.FromByteArray(currMem.Skip(34).Take(4).ToArray()),
|
||||
VacuumReadVal = S7.Net.Types.Double.FromByteArray(currMem.Skip(38).Take(4).ToArray()),
|
||||
MouldEnergyOUT = S7.Net.Types.Double.FromByteArray(currMem.Skip(42).Take(4).ToArray()),
|
||||
MouldEnergyIN= S7.Net.Types.Double.FromByteArray(currMem.Skip(46).Take(4).ToArray())
|
||||
MouldEnergyIN = S7.Net.Types.Double.FromByteArray(currMem.Skip(46).Take(4).ToArray())
|
||||
};
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -2808,18 +2835,56 @@ namespace CMS_CORE_Library.S7Net
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
//Read-Write a Byte-Value-List inside the NC. In writing-mode the field "Number" is not required
|
||||
/// <summary>
|
||||
/// Read-Write a SINGLE Byte inside the NC. In writing-mode the field "Number" is not required
|
||||
/// </summary>
|
||||
/// <param name="bWrite"></param>
|
||||
/// <param name="Process"></param>
|
||||
/// <param name="MemType"></param>
|
||||
/// <param name="MemTable"></param>
|
||||
/// <param name="MemIndex"></param>
|
||||
/// <param name="MemByte"></param>
|
||||
/// <param name="Value"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
if (ListValue.Count > 0)
|
||||
|
||||
if (MemType != MEMORY_TYPE.Siemens_DB)
|
||||
{
|
||||
Value = ListValue.First();
|
||||
return INCORRECT_PARAMETERS_ERROR;
|
||||
}
|
||||
|
||||
cmsError = null;
|
||||
|
||||
if (bWrite)
|
||||
{
|
||||
// try/catch
|
||||
try
|
||||
{
|
||||
byte[] DB_Byte = new byte[1];
|
||||
DB_Byte[0] = Value;
|
||||
currPLC.WriteBytes(DataType.DataBlock, MemTable, MemIndex, DB_Byte);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return PLC_MEM_CONF_ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
var memByteRead = currPLC.ReadBytes(DataType.DataBlock, MemTable, MemIndex, 1);
|
||||
Value = memByteRead[0];
|
||||
}
|
||||
catch
|
||||
{
|
||||
return PLC_MEM_CONF_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
@@ -4391,6 +4456,10 @@ namespace CMS_CORE_Library.S7Net
|
||||
internal static MEMORY_CELL PARAMETER_DATA = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 600, 20, 8000);
|
||||
internal static MEMORY_CELL PARAMETER_RT_DATA = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 601, 8, 3200);
|
||||
|
||||
// recipe edit confirmation/cancel strobe/ack
|
||||
internal static MEMORY_CELL PARAMETER_EDIT_ACK = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, TABLE, 0, 2);
|
||||
internal static MEMORY_CELL PARAMETER_EDIT_STROBE = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, TABLE, 2, 2);
|
||||
|
||||
// aree Moduli
|
||||
internal static MEMORY_CELL MODULE_DATA = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 602, 18, 2304);
|
||||
internal static MEMORY_CELL MODULE_RT_DATA = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 603, 12, 1536);
|
||||
@@ -4418,6 +4487,7 @@ namespace CMS_CORE_Library.S7Net
|
||||
internal static MEMORY_CELL MACHINE_GAUGE_DATA = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, 605, 6, 16);
|
||||
|
||||
|
||||
|
||||
internal static MEMORY_CELL NC_WATCHDOG = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, TABLE, 0, 1);
|
||||
internal static MEMORY_CELL ACTIVE_WATCHDOG = new MEMORY_CELL(MEMORY_TYPE.Siemens_DB, TABLE, 2, 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user