Start abstract config for axis read data

This commit is contained in:
Samuele Locatelli
2020-09-23 19:03:52 +02:00
parent ed11a9a06e
commit 92fab66462
3 changed files with 138 additions and 6 deletions
+12 -6
View File
@@ -136,9 +136,11 @@ namespace CMS_CORE_Library.Models
public class AxisInfo
{
public short Id { get; set; } = 0;
public int errorCode { get; set; } = 0;
public int movPhase { get; set; } = 0;
public int statusCode { get; set; } = 0;
public int ErrorCode { get; set; } = 0;
public int MovPhase { get; set; } = 0;
public int StatusWord { get; set; } = 0;
public int ControlWord { get; set; } = 0;
public double TargetPos { get; set; } = 0;
public override bool Equals(object obj)
{
@@ -148,11 +150,15 @@ namespace CMS_CORE_Library.Models
if (Id != item.Id)
return false;
if (errorCode != item.errorCode)
if (ErrorCode != item.ErrorCode)
return false;
if (movPhase != item.movPhase)
if (MovPhase != item.MovPhase)
return false;
if (statusCode != item.statusCode)
if (StatusWord != item.StatusWord)
return false;
if (ControlWord != item.ControlWord)
return false;
if (TargetPos != item.TargetPos)
return false;
return true;
}
+12
View File
@@ -626,6 +626,18 @@ namespace CMS_CORE_Library
/// <returns></returns>
public abstract CmsError PLC_WAckPzProdEnd();
/// <summary>
/// Get current Axis RT data
/// </summary>
/// <param name="currParamList"></param>
/// <returns></returns>
public abstract CmsError PLC_RAxisRTList(ref Dictionary<int, ThermoModels.AxisRT> currAxisRT);
/// <summary>
/// Get current Axis Info data
/// </summary>
/// <param name="currParamList"></param>
/// <returns></returns>
public abstract CmsError PLC_RAxisInfoList(ref Dictionary<int, ThermoModels.AxisInfo> currAxisInfo);
/// <summary>
/// Get current recipe parameter list
/// </summary>
+114
View File
@@ -2073,6 +2073,120 @@ namespace CMS_CORE_Library.S7Net
return libraryError;
}
/// <summary>
/// Get current Axis RT data
/// </summary>
/// <param name="currParamList"></param>
/// <returns></returns>
public override CmsError PLC_RAxisRTList(ref Dictionary<int, ThermoModels.AxisRT> currAxisRT)
{
CmsError libraryError = NO_ERROR;
#if false
CmsError libraryError = NO_ERROR;
List<byte> currMem = new List<byte>();
int packSize = 8;
// leggo da PLC a array di byte di appoggio...
libraryError = MEM_RWByteList(R, 0, PARAMETER_RT_DATA.MemType, PARAMETER_RT_DATA.Address, PARAMETER_RT_DATA.SubAddress, 0, PARAMETER_RT_DATA.Size, ref currMem);
if (libraryError.IsError())
return libraryError;
// controllo SE ho dati...
if (currMem.Count > 0)
{
// 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))
{
try
{
ThermoParamList[currParam.Id].Enabled = currParam.Enabled;
ThermoParamList[currParam.Id].HasError = currParam.HasError;
ThermoParamList[currParam.Id].Visible = currParam.Visible;
ThermoParamList[currParam.Id].ValueAct = currParam.ValueAct;
}
catch
{ }
}
else
{
try
{
ThermoParamList.Add(currParam.Id, new ThermoModels.RecipeParam() { Id = currParam.Id, Enabled = currParam.Enabled, HasError = currParam.HasError, Visible = currParam.Visible, ValueAct = currParam.ValueAct });
}
catch
{ }
}
}
}
}
#endif
return libraryError;
}
/// <summary>
/// Get current Axis Info data
/// </summary>
/// <param name="currParamList"></param>
/// <returns></returns>
public override CmsError PLC_RAxisInfoList(ref Dictionary<int, ThermoModels.AxisInfo> currAxisInfo)
{
CmsError libraryError = NO_ERROR;
#if false
CmsError libraryError = NO_ERROR;
List<byte> currMem = new List<byte>();
int packSize = 8;
// leggo da PLC a array di byte di appoggio...
libraryError = MEM_RWByteList(R, 0, PARAMETER_RT_DATA.MemType, PARAMETER_RT_DATA.Address, PARAMETER_RT_DATA.SubAddress, 0, PARAMETER_RT_DATA.Size, ref currMem);
if (libraryError.IsError())
return libraryError;
// controllo SE ho dati...
if (currMem.Count > 0)
{
// 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))
{
try
{
ThermoParamList[currParam.Id].Enabled = currParam.Enabled;
ThermoParamList[currParam.Id].HasError = currParam.HasError;
ThermoParamList[currParam.Id].Visible = currParam.Visible;
ThermoParamList[currParam.Id].ValueAct = currParam.ValueAct;
}
catch
{ }
}
else
{
try
{
ThermoParamList.Add(currParam.Id, new ThermoModels.RecipeParam() { Id = currParam.Id, Enabled = currParam.Enabled, HasError = currParam.HasError, Visible = currParam.Visible, ValueAct = currParam.ValueAct });
}
catch
{ }
}
}
}
}
#endif
return libraryError;
}
/// <summary>
/// read current recipe parameter list
/// </summary>