diff --git a/CMS_CORE_Library/CMS_CORE_Library.csproj b/CMS_CORE_Library/CMS_CORE_Library.csproj
index a79a51c..4b249d3 100644
--- a/CMS_CORE_Library/CMS_CORE_Library.csproj
+++ b/CMS_CORE_Library/CMS_CORE_Library.csproj
@@ -151,7 +151,6 @@
-
diff --git a/CMS_CORE_Library/Models/DataStructures.cs b/CMS_CORE_Library/Models/DataStructures.cs
index f22b48a..775b38a 100644
--- a/CMS_CORE_Library/Models/DataStructures.cs
+++ b/CMS_CORE_Library/Models/DataStructures.cs
@@ -535,7 +535,46 @@ namespace CMS_CORE_Library.Models
#region Thermo models
+ ///
+ /// Represents thermo gauge data
+ ///
+ public class GaugeModel
+ {
+ public uint TimeAdv { get; set; } = 0;
+ public int Power { get; set; } = 0;
+ public int Vacuum { get; set; } = 0;
+ public int Air { get; set; } = 0;
+ public override bool Equals(object obj)
+ {
+ // Object is not a GaugeModel instance
+ if (!(obj is GaugeModel item))
+ return false;
+
+ if (TimeAdv != item.TimeAdv)
+ return false;
+
+ if (Power != item.Power)
+ return false;
+
+ if (Vacuum != item.Vacuum)
+ return false;
+
+ if (Air != item.Air)
+ return false;
+
+ return true;
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+ }
+
+ ///
+ /// Recipe Parameters
+ ///
public class RecipeParam
{
public short Id { get; set; } = 0;
@@ -548,20 +587,86 @@ namespace CMS_CORE_Library.Models
public bool Enabled { get; set; } = false;
public bool HasError { get; set; } = false;
public double ValueAct { get; set; } = 0;
+
+ public override bool Equals(object obj)
+ {
+ // Object is not a GaugeModel instance
+ if (!(obj is RecipeParam item))
+ return false;
+
+ if (Id != item.Id)
+ return false;
+ if (SetpointHMI != item.SetpointHMI)
+ return false;
+ if (SetpointPLC != item.SetpointPLC)
+ return false;
+ if (ValMax != item.ValMax)
+ return false;
+ if (ValMin != item.ValMin)
+ return false;
+ if (UnitMeasure != item.UnitMeasure)
+ return false;
+ if (Visible != item.Visible)
+ return false;
+ if (Enabled != item.Enabled)
+ return false;
+ if (HasError != item.HasError)
+ return false;
+ if (ValueAct != item.ValueAct)
+ return false;
+
+ return true;
+ }
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
}
public class ModuleBlock
{
public ushort Id { get; set; } = 0;
- public uint EstimatedDuration { get; set; } = 0;
- public uint EstimatedDelay { get; set; } = 0;
- public List PrecedingId { get; set; } = new List();
- public uint ActualDuration { get; set; } = 0;
public uint ActualDelay { get; set; } = 0;
+ public uint ActualDuration { get; set; } = 0;
+ public uint EstimatedDelay { get; set; } = 0;
+ public uint EstimatedDuration { get; set; } = 0;
+ public List PrecedingId { get; set; } = new List();
public bool Visible { get; set; } = false;
public bool Running { get; set; } = false;
public bool HasError { get; set; } = false;
+
+ public override bool Equals(object obj)
+ {
+ // Object is not a GaugeModel instance
+ if (!(obj is ModuleBlock item))
+ return false;
+
+ if (Id != item.Id)
+ return false;
+ if (ActualDelay != item.ActualDelay)
+ return false;
+ if (ActualDuration != item.ActualDuration)
+ return false;
+ if (EstimatedDelay != item.EstimatedDelay)
+ return false;
+ if (EstimatedDuration != item.EstimatedDuration)
+ return false;
+ if (PrecedingId != item.PrecedingId)
+ return false;
+ if (Visible != item.Visible)
+ return false;
+ if (Running != item.Running)
+ return false;
+ if (HasError != item.HasError)
+ return false;
+
+ return true;
+ }
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
}
public class WarmerChannel
@@ -571,6 +676,30 @@ namespace CMS_CORE_Library.Models
public byte SetpointPLC { get; set; } = 0;
public byte ChStatus { get; set; } = 0;
public byte PercAct { get; set; } = 0;
+
+ public override bool Equals(object obj)
+ {
+ // Object is not a GaugeModel instance
+ if (!(obj is WarmerChannel item))
+ return false;
+
+ if (IdChannel != item.IdChannel)
+ return false;
+ if (SetpointThermoCam != item.SetpointThermoCam)
+ return false;
+ if (SetpointPLC != item.SetpointPLC)
+ return false;
+ if (ChStatus != item.ChStatus)
+ return false;
+ if (PercAct != item.PercAct)
+ return false;
+
+ return true;
+ }
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
}
@@ -589,6 +718,46 @@ namespace CMS_CORE_Library.Models
public double VacuumReadVal { get; set; } = 0;
public double MouldEnergyOUT { get; set; } = 0;
public double MouldEnergyIN { get; set; } = 0;
+
+ public override bool Equals(object obj)
+ {
+ // Object is not a GaugeModel instance
+ if (!(obj is ProdInfo item))
+ return false;
+
+ if (NumTarget != item.NumTarget)
+ return false;
+ if (NumDone != item.NumDone)
+ return false;
+ if (TimeWarm != item.TimeWarm)
+ return false;
+ if (TimeVent != item.TimeVent)
+ return false;
+ if (TimeVacuum != item.TimeVacuum)
+ return false;
+ if (TimeCycleGross != item.TimeCycleGross)
+ return false;
+ if (TimeCycleNet != item.TimeCycleNet)
+ return false;
+ if (MaterialTempEndWarm != item.MaterialTempEndWarm)
+ return false;
+ if (MaterialTempEndVent != item.MaterialTempEndVent)
+ return false;
+ if (MoldTemp != item.MoldTemp)
+ return false;
+ if (VacuumReadVal != item.VacuumReadVal)
+ return false;
+ if (MouldEnergyOUT != item.MouldEnergyOUT)
+ return false;
+ if (MouldEnergyIN != item.MouldEnergyIN)
+ return false;
+
+ return true;
+ }
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
}
public class ProdCycle
@@ -597,6 +766,28 @@ namespace CMS_CORE_Library.Models
public ushort MessageId { get; set; } = 0;
public ushort Mode { get; set; } = 0;
public uint TimeAdv { get; set; } = 0;
+
+ public override bool Equals(object obj)
+ {
+ // Object is not a GaugeModel instance
+ if (!(obj is ProdCycle item))
+ return false;
+
+ if (Status != item.Status)
+ return false;
+ if (MessageId != item.MessageId)
+ return false;
+ if (Mode != item.Mode)
+ return false;
+ if (TimeAdv != item.TimeAdv)
+ return false;
+
+ return true;
+ }
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
}
#endregion
diff --git a/CMS_CORE_Library/Models/ThermoModels.cs b/CMS_CORE_Library/Models/ThermoModels.cs
deleted file mode 100644
index b9b9b12..0000000
--- a/CMS_CORE_Library/Models/ThermoModels.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace CMS_CORE_Library.Models
-{
- public class ThermoModels
- {
- ///
- /// Represents thermo gauge data
- ///
- public class GaugeModel
- {
- public uint TimeAdv { get; set; } = 0;
- public int Power { get; set; } = 0;
- public int Vacuum { get; set; } = 0;
- public int Air { get; set; } = 0;
-
- public override bool Equals(object obj)
- {
- // Object is not a DTOProcessDataModel instance
- if (!(obj is GaugeModel item))
- return false;
-
- if (TimeAdv != item.TimeAdv)
- return false;
-
- if (Power != item.Power)
- return false;
-
- if (Vacuum != item.Vacuum)
- return false;
-
- if (Air != item.Air)
- return false;
-
- return true;
- }
-
- }
- }
-}
diff --git a/CMS_CORE_Library/NcThermo.cs b/CMS_CORE_Library/NcThermo.cs
index 0ccc3b9..ee0999e 100644
--- a/CMS_CORE_Library/NcThermo.cs
+++ b/CMS_CORE_Library/NcThermo.cs
@@ -6,7 +6,6 @@ using System.Globalization;
using System.IO;
using System.Reflection;
using static CMS_CORE_Library.Models.DataStructures;
-using static CMS_CORE_Library.Models.ThermoModels;
using static CMS_CORE_Library.Nc;
using static CMS_CORE_Library.Nc.MEMORY_TYPE;
@@ -631,11 +630,27 @@ namespace CMS_CORE_Library
#region THERMO high level data
+ ///
+ /// Get current recipe parameter list
+ ///
+ /// updates only RT parameters (false = update all)
+ ///
+ ///
public abstract CmsError PLC_RRecipeParamList(bool onlyRT, ref Dictionary currParamList);
- public abstract CmsError PLC_RRecipeLastParamList(ref Dictionary currParamList);
-
+ ///
+ /// Write recipe updated parameter
+ ///
+ ///
+ ///
public abstract CmsError PLC_WRecipeParam(RecipeParam updtParam);
+ ///
+ /// Get current Modules Block list
+ ///
+ /// updates only RT parameters (false = update all)
+ ///
+ ///
+ public abstract CmsError PLC_RModBlocList(bool onlyRT, ref Dictionary currParamList);
#endregion THERMO high level data
diff --git a/CMS_CORE_Library/S7Net/Nc_S7Net.cs b/CMS_CORE_Library/S7Net/Nc_S7Net.cs
index 50df32f..bd95357 100644
--- a/CMS_CORE_Library/S7Net/Nc_S7Net.cs
+++ b/CMS_CORE_Library/S7Net/Nc_S7Net.cs
@@ -14,7 +14,6 @@ using System.Threading;
using System.Xml.Linq;
using static CMS_CORE_Library.Models.DataStructures;
using static CMS_CORE_Library.NcThermo;
-using static CMS_CORE_Library.Models.ThermoModels;
using static CMS_CORE_Library.Nc.MEMORY_TYPE;
using static CMS_CORE_Library.S7Net.MEMORY_ADDRESS;
using static CMS_CORE_Library.Utils.Nc_Utils;
@@ -24,6 +23,8 @@ namespace CMS_CORE_Library.S7Net
{
public class Nc_S7Net : NcThermo
{
+
+ #region costanti ed oggetti
// Global Constants
private const string NcNotFound = "Missing response";
@@ -73,6 +74,8 @@ namespace CMS_CORE_Library.S7Net
///
protected Plc currPLC;
+ #endregion
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Constructor & global methods
@@ -87,7 +90,6 @@ namespace CMS_CORE_Library.S7Net
{
initObjects(IpAddress, RemotePort, false, true, true, true, true, true);
}
-
///
/// Instantiate The NC-Siemens Class
///
@@ -137,7 +139,10 @@ namespace CMS_CORE_Library.S7Net
ThermoProdCycle = new ProdCycle();
ThermoProdInfo = new ProdInfo();
}
-
+ ///
+ /// Connessione al PLC
+ ///
+ ///
public override CmsError NC_Connect()
{
// Try to get information
@@ -176,9 +181,10 @@ namespace CMS_CORE_Library.S7Net
return NO_ERROR;
}
-
-
- // Disconnect Method
+ ///
+ /// Disconnect Method
+ ///
+ ///
public override CmsError NC_Disconnect()
{
// Set Connected to FALSE and close the sessions
@@ -194,106 +200,15 @@ namespace CMS_CORE_Library.S7Net
}
return NO_ERROR;
}
-
-#if false
- private void SetupToolTableData()
- {
- DataSvc dataSvc = new DataSvc();
- // Read max tool number
- Item itemToRead = new Item("/NC/_N_NC_TEA_ACX/$MN_MM_NUM_TOOL");
- dataSvc.Read(itemToRead);
- MAX_TOOL_NUMER = (int)itemToRead.Value;
-
- // Read max edge per tool number
- itemToRead = new Item("/NC/_N_NC_TEA_ACX/$MN_MM_MAX_CUTTING_EDGE_PERTOOL");
- dataSvc.Read(itemToRead);
- MAX_EDGES_PER_TOOL = (int)itemToRead.Value;
-
- // Read max tools per family
- itemToRead = new Item("/NC/_N_NC_TEA_ACX/$MN_MAXNUM_REPLACEMENT_TOOLS");
- dataSvc.Read(itemToRead);
- MAX_TOOLS_PER_FAMILY = (int)itemToRead.Value;
-
- // Read max multitools number
- itemToRead = new Item("/NC/_N_NC_TEA_ACX/$MN_MM_NUM_MULTITOOL");
- dataSvc.Read(itemToRead);
- MAX_MULTITOOLS_NUMBER = (int)itemToRead.Value;
-
- // Read max tools per multitools
- itemToRead = new Item("/NC/_N_NC_TEA_ACX/$MN_MAX_TOOLS_PER_MULTITOOL");
- dataSvc.Read(itemToRead);
- MAX_TOOLS_PER_MULTITOOL = (int)itemToRead.Value;
- // Read file
- string[] toolsStrings = ReadToolTableFile();
-
- // Read max multitools locations
- itemToRead = new Item("/NC/_N_NC_TEA_ACX/$MN_MM_NUM_MULTITOOL_LOCATIONS");
- dataSvc.Read(itemToRead);
- MAX_MULTITOOLS_LOCATIONS = (int)itemToRead.Value;
-
- // Read Life option
- //itemToRead = new Item("/NC/_N_NC_TEA_ACX/$MN_MM_TOOL_MANAGEMENT_MASK");
- //LIFE_OPTION_ACTIVE = GetBitValue(Convert.ToInt32(itemToRead.Value), 6);
- // MULTITOOL_OPTION_ACTIVE = GetBitValue(Convert.ToInt32(itemToRead.Value), 10);
- MULTITOOL_OPTION_ACTIVE = false;
-
- // Read Life option
- itemToRead = new Item("/NC/_N_NC_TEA_ACX/$MNS_ACCESS_WRITE_TM_SUPVIS");
- dataSvc.Read(itemToRead);
- LIFE_OPTION_ACTIVE = Convert.ToInt32(itemToRead.Value) == 7;
- // If not active remove fields from config
- if (!LIFE_OPTION_ACTIVE)
- RemoveLifeParamsFromConfig();
-
- // Read file
- PopulateToolsTableFromFileStrings(toolsStrings);
-
- Array.Clear(toolsStrings, 0, toolsStrings.Count());
-
- //// Subscribe to multitools number
- //DataSvc d = new DataSvc();
- //Item i = new Item() { Path = "/Tool/MTCatalogue/numMultiTools[u1]" };
- //d.Subscribe(MultitoolsNumber_OnChange, i);
- }
-
- private void SetupMagazinePositionListener()
- {
- // Setup magazine positions listener
- List- magPosItems = new List
- ();
- foreach (var position in MagazinePositionsData)
- {
- int paramId = ((position.PositionId - 1) * 11) + 5;
- magPosItems.Add(new Item()
- {
- Path = string.Format("/Tool/Magazine/placeData[c{0} , {1}]", position.MagazineId, paramId),
- SymbolicName = position.MagazineId + "_" + position.PositionId
- });
- }
-
- if (magPosItems.Count > 0)
- // Subscribe
- MagazinePositionSvc.Subscribe(MagazinePositionEnabled_OnChange, magPosItems.ToArray());
- }
-
- private void SetupMagazineActionListener()
- {
- Item magActionsItem = new Item() { Path = MAGAZINE_ACTION_PATH };
-
- // Setup magazine actions listener
- MagazineActionsSvc.Subscribe(MagazineAction_OnChange, magActionsItem);
- }
-#endif
-
- private void RemoveLifeParamsFromConfig()
- {
-#if false
- SiemensToolFieldsConfig.RemoveAll(x => x.Category == "life");
- SiemensEdgesFieldsConfiguration.EdgeConfiguration.RemoveAll(x => x.Category == "life");
-#endif
- }
-
+ ///
+ /// Compilazione dizionario allarmi x lingua
+ ///
+ ///
+ ///
+ ///
public override CmsError NC_GetTranslatedPlcMessages(string language, ref Dictionary messages)
{
+ // FIXME TODO
#if false
string filePath;
try
@@ -324,9 +239,14 @@ namespace CMS_CORE_Library.S7Net
#endif
return FUNCTION_NOT_ALLOWED_ERROR;
}
-
+ ///
+ /// Elenco lingue disponibili
+ ///
+ ///
+ ///
public override CmsError NC_GetAvailableLanguages(ref ICollection languages)
{
+ // FIXME TODO
#if false
try
{
@@ -373,7 +293,11 @@ namespace CMS_CORE_Library.S7Net
#region High level methods
- // Get the processes-count configurated
+ ///
+ /// Get the processes-count configurated
+ ///
+ ///
+ ///
public override CmsError NC_RProcessesNum(ref ushort ProcNumber)
{
CmsError cmsError = ReadStaticNCData();
@@ -385,7 +309,11 @@ namespace CMS_CORE_Library.S7Net
return NO_ERROR;
}
- // Get the NC model Name
+ ///
+ /// Get the NC model Name
+ ///
+ ///
+ ///
public override CmsError NC_RModelName(ref string ModelName)
{
CmsError cmsError = ReadStaticNCData();
@@ -397,7 +325,11 @@ namespace CMS_CORE_Library.S7Net
return NO_ERROR;
}
- // Get the NC Software Version
+ ///
+ /// Get the NC Software Version
+ ///
+ ///
+ ///
public override CmsError NC_RSoftwareVersion(ref string SWV)
{
CmsError cmsError = ReadStaticNCData();
@@ -409,7 +341,11 @@ namespace CMS_CORE_Library.S7Net
return NO_ERROR;
}
- // Get the NC Language
+ ///
+ /// Get the NC Language
+ ///
+ ///
+ ///
public override CmsError NC_RLanguage(ref CultureInfo Language)
{
// Read static data
@@ -422,13 +358,21 @@ namespace CMS_CORE_Library.S7Net
return NO_ERROR;
}
- // Set the NC Language
+ ///
+ /// Set the NC Language
+ ///
+ ///
+ ///
public override CmsError NC_WLanguage(CultureInfo Language)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
- // Get the NC Serial number
+ ///
+ /// Get the NC Serial number
+ ///
+ ///
+ ///
public override CmsError NC_RSerialNumber(ref string serialNumber)
{
CmsError cmsError = ReadStaticNCData();
@@ -440,7 +384,12 @@ namespace CMS_CORE_Library.S7Net
return NO_ERROR;
}
- // Get CMS Machine number
+ ///
+ /// Get CMS Machine number
+ ///
+ ///
+ ///
+ ///
public override CmsError NC_RMachineNumber(bool hasLetters, ref string MachNumber)
{
if (!hasLetters)
@@ -467,14 +416,22 @@ namespace CMS_CORE_Library.S7Net
return NO_ERROR;
}
- // Get the Date-Time of the NC
+ ///
+ /// Get the Date-Time of the NC
+ ///
+ ///
+ ///
public override CmsError NC_RDateTime(ref DateTime ActualTime)
{
ActualTime = DateTime.Now;
return NO_ERROR;
}
- // Check if the NC is in running state
+ ///
+ /// Check if the NC is in running state
+ ///
+ ///
+ ///
public override CmsError NC_RIsRunning(ref bool running)
{
ushort nProcess = 0;
@@ -502,7 +459,11 @@ namespace CMS_CORE_Library.S7Net
return NO_ERROR;
}
- // Get NC unit of measure
+ ///
+ /// Get NC unit of measure
+ ///
+ ///
+ ///
public override CmsError NC_RUnitOfMeasure(ref string unitOfMeasure)
{
CmsError cmsError = ReadStaticNCData();
@@ -514,13 +475,21 @@ namespace CMS_CORE_Library.S7Net
return NO_ERROR;
}
- // Get the Nc Active Alarms
+ ///
+ /// Get the Nc Active Alarms
+ ///
+ ///
+ ///
public override CmsError NC_RActiveAlarms(ref List alarms)
{
return FUNCTION_NOT_ALLOWED_ERROR;
}
- // Set the Nc Active Page of the NC
+ ///
+ /// Set the Nc Active Page of the NC
+ ///
+ ///
+ ///
public override CmsError NC_SetScreenVisible(SCREEN_PAGE screen)
{
return FUNCTION_NOT_ALLOWED_ERROR;
@@ -550,9 +519,14 @@ namespace CMS_CORE_Library.S7Net
plcWatchdog = true;
return MEM_RWBoolean(W, 0, NC_WATCHDOG.MemType, NC_WATCHDOG.Address, NC_WATCHDOG.SubAddress, 0, ref plcWatchdog);
}
-
+ ///
+ /// Active message list
+ ///
+ ///
+ ///
public override CmsError PLC_RActiveMessages(ref List alarms)
{
+ // FIXME TODO controllare
bool[] statusBits;
int i = 0;
List readValues = new List();
@@ -561,12 +535,12 @@ namespace CMS_CORE_Library.S7Net
{
alarms.Clear();
- // Read on data from memory
+ // Read on data from memory
cmsError = MEM_RWIntegerList(R, 0,
ALARMS_STATUS.MemType,
ALARMS_STATUS.Address,
ALARMS_STATUS.SubAddress,
- (ALARMS_STATUS.Size / 4) + (ALARMS_DATA.Size / 2), // statys_bytes / 4 + data_word / 2
+ (ALARMS_STATUS.Size / 4) + (ALARMS_DATA.Size / 2), // status_bytes / 4 + data_word / 2
ref readValues);
if (cmsError.IsError())
@@ -574,19 +548,6 @@ namespace CMS_CORE_Library.S7Net
alarms.Clear();
- //List readValues = new List();
-
- //// Read on data from memory
- //CmsError cmsError = MEM_RWIntegerList(R, 0,
- // ALARMS_STATUS.MemType,
- // ALARMS_STATUS.Address,
- // ALARMS_STATUS.SubAddress,
- // (ALARMS_STATUS.Size + ALARMS_DATA.Size) / 4, // byte / 4
- // ref readValues);
-
- //if (cmsError.IsError())
- // return cmsError;
-
// Convert integer array into bit array
statusBits = IntToBits(readValues.ToArray());
@@ -1153,156 +1114,6 @@ namespace CMS_CORE_Library.S7Net
public override CmsError PLC_RScadaSiemens(ref List objects)
{
return FUNCTION_NOT_ALLOWED_ERROR;
-
-#if false
- try
- {
- List
- items = new List
- ();
-
- string bit,
- address;
- char charType = 'B';
-
- // Cycle through object
- for (int i = 0; i < objects.Count(); i++)
- {
- // Split memory string -> X.Y.Z
- string[] splittedMem = objects[i].Address.Split('.');
- bit = "0";
- address = "0";
-
- bool read = true;
-
- switch (objects[i].MemType)
- {
- case SCADA_MEM_TYPE.BOOL:
- {
- // Check if memory contains default value
- if (splittedMem[0].ToUpper() == "FALSE")
- {
- objects[i].Value = false;
- read = false;
- break;
- }
- else if (splittedMem[0].ToUpper() == "TRUE")
- {
- objects[i].Value = true;
- read = false;
- break;
- }
-
- bit = splittedMem[2];
- address = splittedMem[1];
- charType = 'X'; // Siemens memory type character
- }
- break;
- case SCADA_MEM_TYPE.BYTE:
- {
- address = splittedMem[1];
- charType = 'B';
- }
- break;
- case SCADA_MEM_TYPE.INT:
- {
- address = splittedMem[1];
- charType = 'D';
- }
- break;
- case SCADA_MEM_TYPE.WORD:
- {
- address = splittedMem[1];
- charType = 'W';
- }
- break;
- case SCADA_MEM_TYPE.REAL:
- {
- address = splittedMem[1];
- charType = 'D';
- }
- break;
- }
-
- // If needs to read
- if (read)
- {
- // Convert splitted address into Siemens address
- ConvertMemToPath(MEMORY_TYPE.Siemens_DB,
- Convert.ToInt32(splittedMem[0]),
- Convert.ToInt32(address),
- Convert.ToInt32(bit),
- 1,
- charType,
- out string item);
-
- // Add to the list of items to be readed
- items.Add(new Item()
- {
- Path = item
- });
- }
- }
-
- if (items.Count() > 0)
- {
- // Read data
- DataSvc dataSvc = new DataSvc();
- dataSvc.Read(items.ToArray());
-
- int alreadyReaded = 0;
- for (int i = 0; i < objects.Count(); i++)
- {
- // Skip the objects already valorised
- if (objects[i].Value == null)
- {
- switch (objects[i].MemType)
- {
- case SCADA_MEM_TYPE.BOOL:
- {
- // Valorize data
- objects[i].Value = Convert.ToBoolean(items[i - alreadyReaded].Value);
- }
- break;
- case SCADA_MEM_TYPE.BYTE:
- {
- objects[i].Value = Convert.ToByte(items[i - alreadyReaded].Value);
- }
- break;
- case SCADA_MEM_TYPE.INT:
- {
- objects[i].Value = Convert.ToInt32(items[i - alreadyReaded].Value);
- }
- break;
- case SCADA_MEM_TYPE.WORD:
- {
- objects[i].Value = Convert.ToInt16(items[i - alreadyReaded].Value);
- }
- break;
- case SCADA_MEM_TYPE.REAL:
- {
- // Convert value to double
- var byteVal = BitConverter.GetBytes((uint)items[i - alreadyReaded].Value);
- var value = unchecked(Convert.ToDouble(BitConverter.ToSingle(byteVal, 0)));
-
- objects[i].Value = Math.Round(value, objects[i].Round);
- }
- break;
- }
- }
- else
- {
- // Count items already readed
- alreadyReaded++;
- }
- }
- }
- }
- catch (Exception ex)
- {
- return ManageException(ex);
- }
-
- return NO_ERROR;
-#endif
}
public override CmsError PLC_WScadaValue(string memIndex, SCADA_MEM_TYPE memType, object value)
@@ -2018,31 +1829,31 @@ namespace CMS_CORE_Library.S7Net
return NO_ERROR;
}
+ ///
+ /// read current recipe parameter list
+ ///
+ /// updates only RT parameters (false = update all)
+ ///
+ ///
public override CmsError PLC_RRecipeParamList(bool onlyRT, ref Dictionary 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;
- }
-
-
- public override CmsError PLC_RRecipeLastParamList(ref Dictionary currParamList)
- {
- // copio lista act in output...
- refreshMemRecipeParameter();
+ // refresh dati veloci / RT
refreshMemRecipeParameterRT();
+
+ // copio lista act in output...
currParamList = ThermoParamList;
return NO_ERROR;
}
-
+ ///
+ /// Write recipe updated parameter
+ ///
+ ///
+ ///
public override CmsError PLC_WRecipeParam(RecipeParam updtParam)
{
// init variabili accessorie