Portato in core oggetto recipe (+override)
This commit is contained in:
@@ -1304,6 +1304,17 @@ namespace CMS_CORE_Library.Demo
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region THERMO high level data
|
||||
|
||||
public override CmsError PLC_RRecipeParamList(bool onlyRT, ref Dictionary<int, RecipeParam> currParamList)
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
#endregion THERMO high level data
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region PROCESS (PATH) High-level data
|
||||
|
||||
public override CmsError PROC_RStatus(ushort ProcNumber, ref PROC_STATUS Status)
|
||||
|
||||
@@ -1599,6 +1599,17 @@ namespace CMS_CORE_Library.Fanuc
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region THERMO high level data
|
||||
|
||||
public override CmsError PLC_RRecipeParamList(bool onlyRT, ref Dictionary<int, RecipeParam> currParamList)
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
#endregion THERMO high level data
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region PROCESS (PATH) High-level data
|
||||
|
||||
// Get process part program data
|
||||
|
||||
@@ -615,6 +615,15 @@ namespace CMS_CORE_Library
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region THERMO high level data
|
||||
|
||||
public abstract CmsError PLC_RRecipeParamList(bool onlyRT, ref Dictionary<int, RecipeParam> currParamList);
|
||||
|
||||
|
||||
#endregion THERMO high level data
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region PROCESS (PATH, CHANNEL) data (to override)
|
||||
|
||||
/**
|
||||
|
||||
@@ -1695,6 +1695,17 @@ namespace CMS_CORE_Library.Osai
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region THERMO high level data
|
||||
|
||||
public override CmsError PLC_RRecipeParamList(bool onlyRT, ref Dictionary<int, RecipeParam> currParamList)
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
#endregion THERMO high level data
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region PROCESS (PATH) High-level data
|
||||
|
||||
//Get the process status
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
|
||||
// usando l'asterisco '*' come illustrato di seguito:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.0")]
|
||||
[assembly: AssemblyVersion("1.1.2.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.2.0")]
|
||||
|
||||
+151
-142
@@ -311,8 +311,15 @@ namespace CMS_CORE_Library.S7Net
|
||||
{
|
||||
// Set Connected to FALSE and close the sessions
|
||||
Connected = false;
|
||||
currPLC.Close();
|
||||
|
||||
if (currPLC != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
currPLC.Close();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
@@ -2099,6 +2106,147 @@ namespace CMS_CORE_Library.S7Net
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region THERMO high level data
|
||||
|
||||
public override CmsError PLC_RRecipeParamList(bool onlyRT, ref Dictionary<int, RecipeParam> currParamList)
|
||||
{
|
||||
// refresh dati veloci / RT
|
||||
refreshMemRecipeParameterRT();
|
||||
// se richiesto NON SOLO RT faccio refresh anche dati "lenti"
|
||||
if (!onlyRT)
|
||||
{
|
||||
refreshMemRecipeParameter();
|
||||
}
|
||||
|
||||
// copio lista act in output...
|
||||
currParamList = thermoParamList;
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
protected void refreshMemRecipeParameterRT()
|
||||
{
|
||||
List<byte> currMem = new List<byte>();
|
||||
|
||||
// leggo da PLC a array di byte di appoggio...
|
||||
CmsError cmsError = MEM_RWByteList(R, 0, PARAMETER_RT_DATA.MemType, PARAMETER_RT_DATA.Address, PARAMETER_RT_DATA.SubAddress, PARAMETER_RT_DATA.Size, ref currMem);
|
||||
|
||||
int packSize = 8;
|
||||
|
||||
// converto a blocchi di 8 byte...
|
||||
byte[] memArray = currMem.ToArray();
|
||||
for (int i = 0; i < PARAMETER_RT_DATA.Size / packSize; i++)
|
||||
{
|
||||
PlcParamRT currParam = new PlcParamRT(memArray.Skip(i * packSize).Take(packSize).ToArray());
|
||||
// solo se ID > 0...
|
||||
if (currParam.Id > 0)
|
||||
{
|
||||
// update oggetto thermoParamList...
|
||||
if (thermoParamList.ContainsKey(currParam.Id))
|
||||
{
|
||||
thermoParamList[currParam.Id].Enabled = currParam.Enabled;
|
||||
thermoParamList[currParam.Id].HasError = currParam.HasError;
|
||||
thermoParamList[currParam.Id].Visible = currParam.Visible;
|
||||
thermoParamList[currParam.Id].ValueAct = currParam.ValueAct;
|
||||
}
|
||||
else
|
||||
{
|
||||
thermoParamList.Add(currParam.Id, new RecipeParam() { Id = currParam.Id, Enabled = currParam.Enabled, HasError = currParam.HasError, Visible = currParam.Visible, ValueAct = currParam.ValueAct });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
protected void refreshMemRecipeParameter()
|
||||
{
|
||||
List<byte> currMem = new List<byte>();
|
||||
|
||||
// leggo da PLC a array di byte di appoggio...
|
||||
CmsError cmsError = MEM_RWByteList(R, 0, PARAMETER_DATA.MemType, PARAMETER_DATA.Address, PARAMETER_DATA.SubAddress, PARAMETER_DATA.Size, ref currMem);
|
||||
|
||||
int packSize = 20;
|
||||
|
||||
// converto a blocchi di 8 byte...
|
||||
byte[] memArray = currMem.ToArray();
|
||||
for (int i = 0; i < PARAMETER_DATA.Size / packSize; i++)
|
||||
{
|
||||
PlcParam currParam = new PlcParam(memArray.Skip(i * packSize).Take(packSize).ToArray());
|
||||
// solo se ID > 0...
|
||||
if (currParam.Id > 0)
|
||||
{
|
||||
// update oggetto thermoParamList...
|
||||
if (thermoParamList.ContainsKey(currParam.Id))
|
||||
{
|
||||
thermoParamList[currParam.Id].SetpointHMI = currParam.SetpointHMI;
|
||||
thermoParamList[currParam.Id].SetpointPLC = currParam.SetpointPLC;
|
||||
thermoParamList[currParam.Id].ValMax = currParam.ValMax;
|
||||
thermoParamList[currParam.Id].ValMin = currParam.ValMin;
|
||||
thermoParamList[currParam.Id].UnitMeasure = currParam.UnitMeasure;
|
||||
}
|
||||
else
|
||||
{
|
||||
thermoParamList.Add(currParam.Id, new RecipeParam() { Id = currParam.Id, SetpointHMI = currParam.SetpointHMI, SetpointPLC = currParam.SetpointPLC, ValMax = currParam.ValMax, ValMin = currParam.ValMin, UnitMeasure = currParam.UnitMeasure });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Oggetto Parametro RT da PLC
|
||||
/// </summary>
|
||||
protected class PlcParamRT
|
||||
{
|
||||
public short Id { get; set; } = 0;
|
||||
private ushort Stato { get; set; } = 0;
|
||||
public bool Visible { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public bool HasError { get; set; }
|
||||
public int ValueAct { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Deserializzazione da byte ad oggetto ParamRT
|
||||
/// </summary>
|
||||
/// <param name="rawData"></param>
|
||||
public PlcParamRT(byte[] rawData)
|
||||
{
|
||||
// converto i dati da byte grezzi ai 3 componenti...
|
||||
Id = S7.Net.Types.Int.FromByteArray(rawData.Skip(0).Take(2).ToArray());
|
||||
Stato = S7.Net.Types.Word.FromByteArray(rawData.Skip(2).Take(2).ToArray());
|
||||
ValueAct = S7.Net.Types.DInt.FromByteArray(rawData.Skip(4).Take(4).ToArray());
|
||||
// calcolo bit...
|
||||
Visible = (Stato & 1) == 1;
|
||||
Enabled = (Stato & 2) == 2;
|
||||
HasError = (Stato & 4) == 4;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Oggetto Parametro da PLC
|
||||
/// </summary>
|
||||
protected class PlcParam
|
||||
{
|
||||
public short Id { get; set; } = 0;
|
||||
public int SetpointHMI { get; set; } = 0;
|
||||
public int SetpointPLC { get; set; } = 0;
|
||||
public int ValMax { get; set; } = 0;
|
||||
public int ValMin { get; set; } = 0;
|
||||
public ushort UnitMeasure { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Deserializzazione da byte ad oggetto Param
|
||||
/// </summary>
|
||||
/// <param name="rawData"></param>
|
||||
public PlcParam(byte[] rawData)
|
||||
{
|
||||
// converto i dati da byte grezzi ai 3 componenti...
|
||||
Id = S7.Net.Types.Int.FromByteArray(rawData.Skip(0).Take(2).ToArray());
|
||||
SetpointHMI = S7.Net.Types.DInt.FromByteArray(rawData.Skip(2).Take(4).ToArray());
|
||||
SetpointPLC = S7.Net.Types.DInt.FromByteArray(rawData.Skip(6).Take(4).ToArray());
|
||||
ValMax = S7.Net.Types.DInt.FromByteArray(rawData.Skip(10).Take(4).ToArray());
|
||||
ValMin = S7.Net.Types.DInt.FromByteArray(rawData.Skip(14).Take(4).ToArray());
|
||||
UnitMeasure = S7.Net.Types.Word.FromByteArray(rawData.Skip(18).Take(2).ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region PROCESS-AXES (PATH) High-level data
|
||||
|
||||
public override CmsError AXES_RInterpPosition(ushort channel, ref Dictionary<string, double> axes)
|
||||
@@ -4053,149 +4201,10 @@ namespace CMS_CORE_Library.S7Net
|
||||
|
||||
#endregion Subordinate Private Functions
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region THERMO high level data
|
||||
|
||||
public CmsError PLC_RRecipeParamList(bool onlyRT, ref Dictionary<int, RecipeParam> currParamList)
|
||||
{
|
||||
// refresh dati veloci / RT
|
||||
refreshMemRecipeParameterRT();
|
||||
// se richiesto NON SOLO RT faccio refresh anche dati "lenti"
|
||||
if (!onlyRT)
|
||||
{
|
||||
refreshMemRecipeParameter();
|
||||
}
|
||||
|
||||
// copio lista act in output...
|
||||
currParamList = thermoParamList;
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
protected void refreshMemRecipeParameterRT()
|
||||
{
|
||||
List<byte> currMem = new List<byte>();
|
||||
|
||||
// leggo da PLC a array di byte di appoggio...
|
||||
CmsError cmsError = MEM_RWByteList(R, 0, PARAMETER_RT_DATA.MemType, PARAMETER_RT_DATA.Address, PARAMETER_RT_DATA.SubAddress, PARAMETER_RT_DATA.Size, ref currMem);
|
||||
|
||||
int packSize = 8;
|
||||
|
||||
// converto a blocchi di 8 byte...
|
||||
byte[] memArray = currMem.ToArray();
|
||||
for (int i = 0; i < PARAMETER_RT_DATA.Size / packSize; i++)
|
||||
{
|
||||
PlcParamRT currParam = new PlcParamRT(memArray.Skip(i * packSize).Take(packSize).ToArray());
|
||||
// solo se ID > 0...
|
||||
if (currParam.Id > 0)
|
||||
{
|
||||
// update oggetto thermoParamList...
|
||||
if (thermoParamList.ContainsKey(currParam.Id))
|
||||
{
|
||||
thermoParamList[currParam.Id].Enabled = currParam.Enabled;
|
||||
thermoParamList[currParam.Id].HasError = currParam.HasError;
|
||||
thermoParamList[currParam.Id].Visible = currParam.Visible;
|
||||
thermoParamList[currParam.Id].ValueAct = currParam.ValueAct;
|
||||
}
|
||||
else
|
||||
{
|
||||
thermoParamList.Add(currParam.Id, new RecipeParam() { Id = currParam.Id, Enabled = currParam.Enabled, HasError = currParam.HasError, Visible = currParam.Visible, ValueAct = currParam.ValueAct });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
protected void refreshMemRecipeParameter()
|
||||
{
|
||||
List<byte> currMem = new List<byte>();
|
||||
|
||||
// leggo da PLC a array di byte di appoggio...
|
||||
CmsError cmsError = MEM_RWByteList(R, 0, PARAMETER_DATA.MemType, PARAMETER_DATA.Address, PARAMETER_DATA.SubAddress, PARAMETER_DATA.Size, ref currMem);
|
||||
|
||||
int packSize = 20;
|
||||
|
||||
// converto a blocchi di 8 byte...
|
||||
byte[] memArray = currMem.ToArray();
|
||||
for (int i = 0; i < PARAMETER_DATA.Size / packSize; i++)
|
||||
{
|
||||
PlcParam currParam = new PlcParam(memArray.Skip(i * packSize).Take(packSize).ToArray());
|
||||
// solo se ID > 0...
|
||||
if (currParam.Id > 0)
|
||||
{
|
||||
// update oggetto thermoParamList...
|
||||
if (thermoParamList.ContainsKey(currParam.Id))
|
||||
{
|
||||
thermoParamList[currParam.Id].SetpointHMI = currParam.SetpointHMI;
|
||||
thermoParamList[currParam.Id].SetpointPLC = currParam.SetpointPLC;
|
||||
thermoParamList[currParam.Id].ValMax = currParam.ValMax;
|
||||
thermoParamList[currParam.Id].ValMin = currParam.ValMin;
|
||||
thermoParamList[currParam.Id].UnitMeasure = currParam.UnitMeasure;
|
||||
}
|
||||
else
|
||||
{
|
||||
thermoParamList.Add(currParam.Id, new RecipeParam() { Id = currParam.Id, SetpointHMI = currParam.SetpointHMI, SetpointPLC = currParam.SetpointPLC, ValMax = currParam.ValMax, ValMin = currParam.ValMin, UnitMeasure = currParam.UnitMeasure });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Oggetto Parametro RT da PLC
|
||||
/// </summary>
|
||||
protected class PlcParamRT
|
||||
{
|
||||
public short Id { get; set; } = 0;
|
||||
private ushort Stato { get; set; } = 0;
|
||||
public bool Visible { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public bool HasError { get; set; }
|
||||
public int ValueAct { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Deserializzazione da byte ad oggetto ParamRT
|
||||
/// </summary>
|
||||
/// <param name="rawData"></param>
|
||||
public PlcParamRT(byte[] rawData)
|
||||
{
|
||||
// converto i dati da byte grezzi ai 3 componenti...
|
||||
Id = S7.Net.Types.Int.FromByteArray(rawData.Skip(0).Take(2).ToArray());
|
||||
Stato = S7.Net.Types.Word.FromByteArray(rawData.Skip(2).Take(2).ToArray());
|
||||
ValueAct = S7.Net.Types.DInt.FromByteArray(rawData.Skip(4).Take(4).ToArray());
|
||||
// calcolo bit...
|
||||
Visible = (Stato & 1) == 1;
|
||||
Enabled = (Stato & 2) == 2;
|
||||
HasError = (Stato & 4) == 4;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Oggetto Parametro da PLC
|
||||
/// </summary>
|
||||
protected class PlcParam
|
||||
{
|
||||
public short Id { get; set; } = 0;
|
||||
public int SetpointHMI { get; set; } = 0;
|
||||
public int SetpointPLC { get; set; } = 0;
|
||||
public int ValMax { get; set; } = 0;
|
||||
public int ValMin { get; set; } = 0;
|
||||
public ushort UnitMeasure { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Deserializzazione da byte ad oggetto Param
|
||||
/// </summary>
|
||||
/// <param name="rawData"></param>
|
||||
public PlcParam(byte[] rawData)
|
||||
{
|
||||
// converto i dati da byte grezzi ai 3 componenti...
|
||||
Id = S7.Net.Types.Int.FromByteArray(rawData.Skip(0).Take(2).ToArray());
|
||||
SetpointHMI = S7.Net.Types.DInt.FromByteArray(rawData.Skip(2).Take(4).ToArray());
|
||||
SetpointPLC = S7.Net.Types.DInt.FromByteArray(rawData.Skip(6).Take(4).ToArray());
|
||||
ValMax = S7.Net.Types.DInt.FromByteArray(rawData.Skip(10).Take(4).ToArray());
|
||||
ValMin = S7.Net.Types.DInt.FromByteArray(rawData.Skip(14).Take(4).ToArray());
|
||||
UnitMeasure = S7.Net.Types.Word.FromByteArray(rawData.Skip(18).Take(2).ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
internal static class MEMORY_ADDRESS
|
||||
{
|
||||
// Tabella DB principale
|
||||
|
||||
@@ -2113,6 +2113,17 @@ namespace CMS_CORE_Library.Siemens
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region THERMO high level data
|
||||
|
||||
public override CmsError PLC_RRecipeParamList(bool onlyRT, ref Dictionary<int, RecipeParam> currParamList)
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
#endregion THERMO high level data
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region PROCESS (PATH) High-level data
|
||||
|
||||
// Get the process Mode
|
||||
|
||||
Reference in New Issue
Block a user