diff --git a/Thermo.Active.Config/Config/moduleBlockConfig.xml b/Thermo.Active.Config/Config/moduleBlockConfig.xml
new file mode 100644
index 00000000..ef3095f8
--- /dev/null
+++ b/Thermo.Active.Config/Config/moduleBlockConfig.xml
@@ -0,0 +1,185 @@
+
+
+
+ 1
+
+ DiscesaCZ ENG
+ DiscesaCZ ITA
+
+ MOVEMENT
+
+ -1
+ false
+ false
+ 1
+
+
+ 2
+
+ MembDiscesaZ ENG
+ MembDiscesaZ ITA
+
+ MOVEMENT
+
+ -1
+ false
+ false
+ 1
+
+
+ 3
+
+ MembZ ENG
+ MembZ ITA
+
+ MOVEMENT
+
+ -1
+ false
+ false
+ 1
+
+
+ 4
+
+ Mod_MembSalitaZ ENG
+ Mod_MembSalitaZ ITA
+
+ MOVEMENT
+
+ -1
+ false
+ false
+ 1
+
+
+ 6
+
+ Mod_RiscaldoInf ENG
+ Mod_RiscaldoInf ITA
+
+ HEATING
+
+ -1
+ false
+ false
+ 1
+
+
+ 7
+
+ Mod_RiscaldoSup ENG
+ Mod_RiscaldoSup ITA
+
+ HEATING
+
+ 0
+ false
+ false
+ 2
+
+
+ 8
+
+ Mod_PirometroRisc ENG
+ Mod_PirometroRisc ITA
+
+ HEATING
+
+ 80
+ true
+ true
+ 3
+
+
+ 13
+
+ Mod_Imbutitura ENG
+ Mod_Imbutitura ITA
+
+ DRAWING
+
+ 99
+ true
+ true
+ 2
+
+
+ 16
+
+ Mod_Raffreddamento ENG
+ Mod_Raffreddamento ITA
+
+ COOLING
+
+ -1
+ true
+ false
+ 2
+
+
+ 17
+
+ Mod_PirometroRaffr ENG
+ Mod_PirometroRaffr ITA
+
+ COOLING
+
+ 139
+ true
+ true
+ 3
+
+
+ 19
+
+ Mod_Vuoto ENG
+ Mod_Vuoto ITA
+
+ VACUUM
+
+ -1
+ true
+ false
+ 4
+
+
+ 21
+
+ Mod_VuotoDiretto ENG
+ Mod_VuotoDiretto ITA
+
+ VACUUM
+
+ -1
+ true
+ false
+ 5
+
+
+ 36
+
+ Mod_EstrazioneZ ENG
+ Mod_EstrazioneZ ITA
+
+ EXTRACTION
+
+ -1
+ true
+ false
+ 2
+
+
+ 42
+
+ Mod_SalitaCZ ENG
+ Mod_SalitaCZ ITA
+
+ MOVEMENT
+
+ -1
+ false
+ false
+ 1
+
+
\ No newline at end of file
diff --git a/Thermo.Active.Config/Config/moduleBlockConfigValidator.xsd b/Thermo.Active.Config/Config/moduleBlockConfigValidator.xsd
new file mode 100644
index 00000000..220ba2fb
--- /dev/null
+++ b/Thermo.Active.Config/Config/moduleBlockConfigValidator.xsd
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Thermo.Active.Config/Config/risk2007.xml b/Thermo.Active.Config/Config/risk2007.xml
new file mode 100644
index 00000000..61a34c58
--- /dev/null
+++ b/Thermo.Active.Config/Config/risk2007.xml
@@ -0,0 +1,981 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+
\ No newline at end of file
diff --git a/Thermo.Active.Config/Config/risk2007Validator.xsd b/Thermo.Active.Config/Config/risk2007Validator.xsd
new file mode 100644
index 00000000..415a9194
--- /dev/null
+++ b/Thermo.Active.Config/Config/risk2007Validator.xsd
@@ -0,0 +1,304 @@
+
+
+
+
+
+
+ Id tipo resistenza. Corrisponde al'id riferimento
+
+
+
+
+ Numero riga di appartenenza
+
+
+
+
+ Id della termocoppia installata. 0 = no termocoppia, altrimenti 1...
+
+
+
+
+ Id della termocoppia di riferimento
+
+
+
+
+ Id del gruppo di appartenenza
+
+
+
+
+ Numero del canale assoluto
+
+
+
+
+ TRUE = duty cycle nuovo, altrimenti FALSE
+
+
+
+
+ Spazio da aggiungere prima della resistenza [pix]
+
+
+
+
+ Spazio da aggiungere dopo la resistenza [pix]
+
+
+
+
+ Sfasamento per pilotaggio a impulsi:
+possibilità di far lavorare alcuni canali sfasati rispetto agli altri, in modo da avere un assorbimento istantaneo il più basso possibile.
+Default=FALSE
+
+
+
+
+
+ Ritardo per la partenza del soft-start ad impulsi per ogni singolo canale senza che questo abbia necessariamente finito la rampa
+Default=0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Id tipo resistenza
+
+
+
+ Corrente riferimento specifico per il tipo resistenza
+
+
+
+
+ Potenza nominale della resistenza espressa in Watt
+
+
+
+
+ Marca e modello resistenza
+
+
+
+
+ 1=250mm 2=125mm
+
+
+
+
+ Soglia bassa sotto cui considerare l'assorbimento un allarme
+
+
+
+
+ Usata in collaudo. Esprime la semiampiezza dell'intorno di corrente di lettura entro cui l'assorbimento è considerato coretto
+
+
+
+
+ Usata in lavoro. Esprime il numero di letture non buone oltre cui considerare allarme
+
+
+
+
+ Impostazioni softstart.
+Bit0-4: definiscono la velocità del softstart. Il valore indica il numero di ripetizioni del singolo step della rampa. Più il valore è piccolo maggiore sarà la velocità del softstart. [default 3].
+Bit5: se = 0 il softstart lavora con tabella fissa (solo 50hZ), se = 1 il softstart lavora con i valori WaveMax e IntervalWidth, anche con frequenze diverse da 50hZ.
+
+
+
+
+ Numero di letture dell'allarme oltre cui considerare vero l'allarme
+
+
+
+
+ Limite di percentuale per soft start
+Default=100
+Esempio: se pct target = 50% e SoftLim=35%, viene effettuato il soft start fino al 35% poi si salta alla pct target di 50%
+
+
+
+
+
+
+ Percentuale minima per duty a impulsi
+Default=0
+Esempio: se PctMin=40% per pct target da 0-39% viene usato il pilataggio a parzializzazione di fase (alogeno) da 40% a 100% viene usato il pilotaggio a impulsi (quarzo)
+
+
+
+
+
+
+
+ Record di configurazione correnti per tipo resistenza
+
+
+
+ Boh!!!
+
+
+
+
+ Sensibilità [W]
+
+
+
+
+ Sensibilità [W]
+
+
+
+
+ Sensibilità [W]
+
+
+
+
+ Sensibilità [W]
+
+
+
+
+ Sensibilità [W]
+
+
+
+
+ Sensibilità [W]
+
+
+
+
+ Sensibilità [W]
+
+
+
+
+ Sensibilità [W]
+
+
+
+
+
+ Configurazione sistema di riscaldo NEW_Risk2007
+
+
+
+
+
+
+
+
+
+ 0 = riscaldo superiore, 1 = riscaldo inferiore, 2 = preriscaldo sup., 3 = preriscaldo inf.
+
+
+
+
+ Fattore di scala per disegnare il riscaldo [TwinPix]
+
+
+
+
+ Fattore di proporzione fra larghezza e altezza [larghezza/altezza]
+
+
+
+
+ Offset di compensazione lettura termocoppia
+
+
+
+
+ Interasse fra le righe di resistenza [mm]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Indirizzo di memorizzazione termocoppie lato CPU: 4D5=R8TC8IO, D5=NEW_RISK2007
+
+
+
+
+ Velocità di trasmissione [baud] (9600,19200)
+
+
+
+
+ Porta seriale per comunicazione con CPU riscaldo
+
+
+
+
+ Fattore di moltiplicazione della lettura della termocoppia: 0.5=R8TC8IO, 0.6=NEW_RISK2007
+
+
+
+
+ TRUE = utilizzo la parametrizzazione per il softStart, FALSE = utilizzo il softstart cablato nel firmware delle res8CH
+
+
+
+
+ Numero di semionde massime in un secondo (50hZ = 120, 60hZ = 140)
+
+
+
+
+ Durata in tempo di 1/100 di semionda [microsec] (50hZ = 95, 60hZ = 82)
+
+
+
+
+ Durata timeout per spegnimento riscaldo in caso di mancanza di comunicazione con la CPU. Trascorso il timout serve rimandare un comando di ON alla CPU per la riaccensione del riscaldo. Indicando 0 la CPU ignora lo spegnimento automatico su assenza di comunicazione. [sec]
+
+
+
+
+ Durata in tempo di 1/100 di semionda [microsec] per lampade al quarzo
+
+
+
+
+ Frequenza di invio dei frame di regolazione dalla cpu per lampade al quarzo
+
+
+
+
+
diff --git a/Thermo.Active.Config/ServerConfig.cs b/Thermo.Active.Config/ServerConfig.cs
index 361d1889..e18c1028 100644
--- a/Thermo.Active.Config/ServerConfig.cs
+++ b/Thermo.Active.Config/ServerConfig.cs
@@ -33,6 +33,9 @@ namespace Thermo.Active.Config
public static List InitialAlarmsConfig;
public static List HeadsConfig;
public static List RecipeConfig;
+ public static List ModBlockConfig;
+ public static List RiskResistConfig;
+ public static List RiskChannelConfig;
public static CmsConnectConfigModel CmsConnectConfig;
public static AreasConfigModel ProductionConfig;
diff --git a/Thermo.Active.Config/ServerConfigController.cs b/Thermo.Active.Config/ServerConfigController.cs
index 68df96f3..86c811d4 100644
--- a/Thermo.Active.Config/ServerConfigController.cs
+++ b/Thermo.Active.Config/ServerConfigController.cs
@@ -13,14 +13,14 @@ using System.Xml.Linq;
using System.Xml.Schema;
using System.Xml.Serialization;
using static Thermo.Active.Config.ServerConfig;
-using static Thermo.Active.Model.Constants;
+using static Thermo.Active.Model.Constants;
using static Thermo.Active.Utils.SupportFunctions;
namespace Thermo.Active.Config
{
public static class ServerConfigController
{
- private static string actualFileName;
+ private static string actualFileName;
public static void ReadStartupConfig()
{
@@ -34,6 +34,8 @@ namespace Thermo.Active.Config
ReadAlarmsConfig();
ReadHeadsConfig();
ReadRecipeConfig();
+ ReadModBlockConfig();
+ ReadRiskConfig();
// ReadCMSConnectConfig();
ReadMacros();
ReadScadaFile();
@@ -42,7 +44,7 @@ namespace Thermo.Active.Config
catch (XmlException ex)
{
ExceptionManager.ManageError(ERROR_LEVEL.FATAL,
- "Error while reading file: " + ex.SourceUri +
+ "Error while reading file: " + ex.SourceUri +
"\n Error: " + ex.Message,
true
);
@@ -51,7 +53,7 @@ namespace Thermo.Active.Config
{
var message = ex.Message;
if (ex.InnerException != null)
- message += "\n"+ex.InnerException.Message;
+ message += "\n" + ex.InnerException.Message;
ExceptionManager.ManageError(ERROR_LEVEL.FATAL, message, true);
}
}
@@ -60,7 +62,7 @@ namespace Thermo.Active.Config
{
// Create new instance
XmlSchemaSet readerSettings = new XmlSchemaSet();
-
+
// Add Schema from Assembly
Assembly myAssembly = Assembly.GetExecutingAssembly();
using (Stream schemaStream = myAssembly.GetManifestResourceStream(configSchemaFilePath))
@@ -70,11 +72,11 @@ namespace Thermo.Active.Config
readerSettings.Add(null, schemaReader);
}
}
-
+
actualFileName = configFilePath;
// Open file reader
- XDocument xmlConfigFile = XDocument.Load((!isFullPath ? BASE_PATH + "\\": "") + configFilePath);
+ XDocument xmlConfigFile = XDocument.Load((!isFullPath ? BASE_PATH + "\\" : "") + configFilePath);
// Validate file
xmlConfigFile.Validate(readerSettings, ValidationHandler);
@@ -130,13 +132,13 @@ namespace Thermo.Active.Config
break;
case AREAS.SCADA_KEY:
- SetAreaValue(ref ScadaConfig, element);
+ SetAreaValue(ref ScadaConfig, element);
break;
case AREAS.JOBEDITOR_KEY:
SetAreaValue(ref JobEditorConfig, element);
break;
-
+
case AREAS.USERS_KEY:
SetAreaValue(ref UsersConfig, element);
break;
@@ -158,20 +160,20 @@ namespace Thermo.Active.Config
private static void ValidationHandler(object sender, ValidationEventArgs e)
{
if (e.Severity == XmlSeverityType.Warning)
- {
+ {
ExceptionManager.ManageError(ERROR_LEVEL.WARNING, e.Message, true);
- }
+ }
else if (e.Severity == XmlSeverityType.Error)
- {
+ {
ExceptionManager.ManageError(ERROR_LEVEL.FATAL,
// "Error while reading file: " + e.Exception.SourceUri +
"Error while reading XML file \"" + actualFileName + "\" \n\n" + e.Message,
true
);
- }
+ }
}
- public static bool CheckAreaStatus(string areaName)
+ public static bool CheckAreaStatus(string areaName)
{ // Get Area status ( enabled field) by name
switch (areaName)
{
@@ -206,7 +208,7 @@ namespace Thermo.Active.Config
}
private static void ReadScadaFile()
- {
+ {
DirectoryInfo d = new DirectoryInfo(SCADA_DIRECTORY);
FileInfo[] files = d.GetFiles("*.xml");
@@ -218,7 +220,7 @@ namespace Thermo.Active.Config
StreamReader sr = new StreamReader(SCADA_DIRECTORY + file.Name);
XmlSerializer xmlSerializer = new XmlSerializer(typeof(ScadaSchemaModel));
- ScadaSchemaModel schema = xmlSerializer.Deserialize(sr) as ScadaSchemaModel;
+ ScadaSchemaModel schema = xmlSerializer.Deserialize(sr) as ScadaSchemaModel;
// Setup incremental ids
@@ -231,7 +233,8 @@ namespace Thermo.Active.Config
{
Id = i++,
Buttons = x.Buttons.Select(y => { y.Id = i++; return y; }).ToArray(),
- Images = x.Images.Select(y => {
+ Images = x.Images.Select(y =>
+ {
y.Id = i++;
y.Name = GetImageBase64String(SCADA_DIRECTORY + name, y.Name);
return y;
@@ -277,7 +280,7 @@ namespace Thermo.Active.Config
InstallationDate = x.Element("installationDate").Value,
MgiOption = Convert.ToBoolean(x.Element("mgiOption").Value),
SiemensKeyboardOption = Convert.ToBoolean(x.Element("siemensKeyboardOption").Value),
- MachineNumberHasLetters = Convert.ToBoolean(x.Element("machineNumberHasLetters").Value)
+ MachineNumberHasLetters = Convert.ToBoolean(x.Element("machineNumberHasLetters").Value)
}).FirstOrDefault();
// Read Prod Software Config with LINQ
@@ -286,9 +289,9 @@ namespace Thermo.Active.Config
.Descendants(PROD_SFT_CONFIG_KEY)
.Select(x => new SoftwareProdConfigModel()
{
- Enabled = Convert.ToBoolean(x.Element("enabled").Value),
+ Enabled = Convert.ToBoolean(x.Element("enabled").Value),
Path = x.Element("path").Value
- }).FirstOrDefault();
+ }).FirstOrDefault();
// Read server config with LINQ and save into static config
ServerStartupConfig = xmlConfigFile
@@ -302,7 +305,7 @@ namespace Thermo.Active.Config
EnableDirectoryBrowsing = Convert.ToBoolean(x.Element("enableDirectoryBrowsing").Value),
DatabaseAddress = x.Element("databaseAddress").Value,
AutoOpenCmsClient = Convert.ToBoolean(x.Element("autoOpenCmsClient").Value),
- TextEditorPath = x.Element("textEditorPath").Value,
+ TextEditorPath = x.Element("textEditorPath").Value,
MTCFolderPath = x.Element("MTCFolderPath").Value,
MTCApplicationName = x.Element("MTCApplicationName").Value,
MaxAlarmsRows = Convert.ToInt32(x.Element("maxAlarmsRows").Value),
@@ -345,7 +348,7 @@ namespace Thermo.Active.Config
XDocument xmlConfigFile = GetXmlHandlerWithValidator(MAINTENANCES_CONFIG_SCHEMA_PATH, MAINTENANCES_CONFIG_PATH);
ReadAssistanceConfig();
-
+
MaintenancesConfig = xmlConfigFile
.Descendants("maintenances")
.Elements("maintenance")
@@ -374,11 +377,11 @@ namespace Thermo.Active.Config
XDocument xmlConfigFile = GetXmlHandlerWithValidator(MAINTENANCES_CONFIG_SCHEMA_PATH, MAINTENANCES_CONFIG_PATH);
ReadAssistanceConfigFromXml(
xmlConfigFile.Root.Descendants("cmsContacts").FirstOrDefault(),
- out CmsContactConfig,
- out CmsAuxContact1,
+ out CmsContactConfig,
+ out CmsAuxContact1,
out CmsAuxContact2
);
-
+
xmlConfigFile = GetXmlHandlerWithValidator(MAINTENANCES_CONFIG_SCHEMA_PATH, MAINTENANCES_CONFIG_PATH);
ReadAssistanceConfigFromXml(
xmlConfigFile.Root.Descendants("scmContacts").FirstOrDefault(),
@@ -545,7 +548,7 @@ namespace Thermo.Active.Config
{
AlarmId = Convert.ToInt32(x.Element("alarmId").Value),
PlcId = Convert.ToInt32(x.Element("plcId").Value),
- RestoreIsActive = Convert.ToBoolean(x.Element("restoreIsActive").Value)
+ RestoreIsActive = Convert.ToBoolean(x.Element("restoreIsActive").Value)
})
.ToList();
}
@@ -572,19 +575,21 @@ namespace Thermo.Active.Config
})
.ToList();
}
-
+ ///
+ /// Recipe Config setup from file
+ ///
private static void ReadRecipeConfig()
{
XDocument xmlConfigFile = GetXmlHandlerWithValidator(RECIPE_CONFIG_SCHEMA_PATH, RECIPE_CONFIG_PATH);
- // Read head config from XML file
+ // Read Recipe config from XML file
RecipeConfig = xmlConfigFile
.Root
.Elements()
.Select(x => new RecipeConfigModel()
{
Id = Convert.ToInt16(x.Element("id").Value),
- Category = GetTActCategory(x.Element("category").Value),
+ Category = GetTActParamType(x.Element("category").Value),
SubCategory_1 = x.Element("subCategory_1").Value,
SubCategory_2 = x.Element("subCategory_2").Value,
Name = x.Element("name").Value,
@@ -593,6 +598,143 @@ namespace Thermo.Active.Config
})
.ToList();
}
+ ///
+ /// Module config setup from file
+ ///
+ private static void ReadModBlockConfig()
+ {
+ XDocument xmlConfigFile = GetXmlHandlerWithValidator(MODBLOCK_CONFIG_SCHEMA_PATH, MODBLOCK_CONFIG_PATH);
+
+ // Read head config from XML file
+ ModBlockConfig = xmlConfigFile
+ .Root
+ .Elements()
+ .Select(x => new ModBlockConfigModel()
+ {
+ Id = Convert.ToInt16(x.Element("id").Value),
+ LocalizedLabels = x.Element("localizedLabels").Elements().ToDictionary(
+ y => y.Attribute("langKey").Value, y => y.Value
+ ),
+ Type = GetTActMB_Type(x.Element("type").Value),
+ Section = GetTActMB_Section(x.Element("section").Value),
+ IdParam = Convert.ToInt16(x.Element("idParam").Value),
+ ShowDelay = Convert.ToBoolean(x.Element("showDelay").Value),
+ Priority = Convert.ToInt16(x.Element("priority").Value)
+ })
+ .ToList();
+ }
+ ///
+ /// Warmers config setup from file
+ ///
+ private static void ReadRiskConfig()
+ {
+ XDocument xmlConfigFile = GetXmlHandlerWithValidator(RISK_CONFIG_SCHEMA_PATH, RISK_CONFIG_PATH);
+
+ int i = 0;
+
+ List Riflettori = new List();
+ List Resistenze = new List();
+ List Riferimenti = new List();
+
+ // carico gli oggetti "nativi"
+ Riferimenti = xmlConfigFile
+ .Root
+ .Elements("riferimenti")
+ .Select(x => new RiskRiferimenti()
+ {
+ Id = Convert.ToInt16(x.Value),
+ Dimensione = Convert.ToInt16(x.Attribute("dimensione").Value),
+ Potenza = Convert.ToInt16(x.Attribute("potenza").Value)
+ })
+ .ToList();
+
+
+ Riflettori = xmlConfigFile
+ .Root
+ .Elements("riflettore")
+ .Select(x => new RiskRiflettore()
+ {
+ Tipo = Convert.ToInt16(x.Attribute("tipo").Value),
+ Resistenze = x.Elements("resistenza")
+ .Select(y => new RiskResistenza()
+ {
+ Canale = Convert.ToInt16(y.Attribute("canale").Value),
+ Riga = Convert.ToInt16(y.Attribute("riga").Value),
+ Tipo = Convert.ToInt16(y.Attribute("tipo").Value)
+ }
+ )
+ .ToList()
+ })
+ .ToList();
+
+ // conversione da modelli RISK a modello Thermo...
+ int numCol = -1;
+ int ResistId = 0;
+ int oldRow = 0;
+ int currRow = 0;
+ RiskChannelConfig = new List();
+ RiskResistConfig = new List();
+
+ // ciclo x calcolare i canali
+ foreach (var riflettore in Riflettori)
+ {
+ // ciclo sulle resistente
+ foreach (var resistenza in riflettore.Resistenze)
+ {
+ // cerco se ho già il canale
+ var found = RiskChannelConfig.Find(item => item.IdChannel == resistenza.Canale);
+ if (found == null)
+ {
+ // cerco il TIPO...
+ var riferimento = Riferimenti.Find(x => x.Id == resistenza.Tipo);
+ if(riferimento!=null)
+ {
+ RiskChannelConfig.Add(new RiskChannelModel()
+ {
+ IdChannel = resistenza.Canale,
+ IdReflector = riflettore.Tipo,
+ SetpointRecipe = 0,
+ SetpointThermo = 0,
+ MaxPower = riferimento.Potenza
+ });
+ }
+
+ }
+
+ }
+
+ }
+
+ // ciclo sui riflettori x recuperare le resistenze...
+ foreach (var riflettore in Riflettori)
+ {
+ // ciclo sulle resistente
+ foreach (var resistenza in riflettore.Resistenze)
+ {
+ if (oldRow != resistenza.Riga)
+ {
+ numCol = 0;
+ oldRow = resistenza.Riga;
+ }
+ else
+ {
+ numCol++;
+ }
+
+ // cerco il TIPO...
+ var riferimento = Riferimenti.Find(x => x.Id == resistenza.Tipo);
+
+ RiskResistConfig.Add(new RiskResistModel()
+ {
+ Id = ResistId++,
+ Row = resistenza.Riga,
+ Column = numCol,
+ IdChannel = resistenza.Canale,
+ Dimension = riferimento.Dimensione
+ }); ;
+ }
+ }
+ }
private static void ReadCMSConnectConfig()
{
@@ -624,14 +766,14 @@ namespace Thermo.Active.Config
Token = x.Element("token").Value
})
.FirstOrDefault();
-
+
if (DecodeCMSConnectGatewayLogin(tempGatewayConfigModel.Token, out _tempUSR, out _tempPSW))
{
tempGatewayConfigModel.Username = _tempUSR;
tempGatewayConfigModel.Password = _tempPSW;
}
else
- throw new Exception("Error while reading \""+ CMS_CONNECT_CONFIG_PATH + "\": Gateway Token not valid");
+ throw new Exception("Error while reading \"" + CMS_CONNECT_CONFIG_PATH + "\": Gateway Token not valid");
CmsConnectConfig.Gateway = tempGatewayConfigModel;
}
diff --git a/Thermo.Active.Config/Thermo.Active.Config.csproj b/Thermo.Active.Config/Thermo.Active.Config.csproj
index e171df4b..27d70235 100644
--- a/Thermo.Active.Config/Thermo.Active.Config.csproj
+++ b/Thermo.Active.Config/Thermo.Active.Config.csproj
@@ -69,9 +69,15 @@
Always
+
+ PreserveNewest
+
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
Designer
@@ -159,5 +165,15 @@
Designer
+
+
+ Designer
+
+
+
+
+ Designer
+
+
\ No newline at end of file
diff --git a/Thermo.Active.Model/ConfigModels/ModBlockConfigModel.cs b/Thermo.Active.Model/ConfigModels/ModBlockConfigModel.cs
new file mode 100644
index 00000000..52738f36
--- /dev/null
+++ b/Thermo.Active.Model/ConfigModels/ModBlockConfigModel.cs
@@ -0,0 +1,16 @@
+using System.Collections.Generic;
+using static Thermo.Active.Model.Constants;
+
+namespace Thermo.Active.Model.ConfigModels
+{
+ public class ModBlockConfigModel
+ {
+ public int Id;
+ public Dictionary LocalizedLabels { get; set; }
+ public TACT_MBLOCK_TYPE Type { get; set; }
+ public TACT_MBLOCK_SECTION Section { get; set; }
+ public int IdParam{ get; set; }
+ public bool ShowDelay { get; set; }
+ public int Priority { get; set; }
+ }
+}
diff --git a/Thermo.Active.Model/ConfigModels/RiskConfigModel.cs b/Thermo.Active.Model/ConfigModels/RiskConfigModel.cs
new file mode 100644
index 00000000..7c1f6d30
--- /dev/null
+++ b/Thermo.Active.Model/ConfigModels/RiskConfigModel.cs
@@ -0,0 +1,39 @@
+using System.Collections.Generic;
+using static Thermo.Active.Model.Constants;
+
+namespace Thermo.Active.Model.ConfigModels
+{
+ public class RiskRiflettore
+ {
+ public int Tipo;
+ public List Resistenze;
+ }
+ public class RiskResistenza
+ {
+ public int Tipo;
+ public int Riga;
+ public int Canale;
+ }
+ public class RiskRiferimenti
+ {
+ public int Id;
+ public int Potenza;
+ public int Dimensione;
+ }
+ public class RiskResistModel
+ {
+ public int Id;
+ public int IdChannel;
+ public int Column;
+ public int Row;
+ public int Dimension;
+ }
+ public class RiskChannelModel
+ {
+ public int IdChannel;
+ public int IdReflector;
+ public int SetpointRecipe;
+ public int SetpointThermo;
+ public int MaxPower;
+ }
+}
diff --git a/Thermo.Active.Model/Constants.cs b/Thermo.Active.Model/Constants.cs
index b3e58e33..480e679d 100644
--- a/Thermo.Active.Model/Constants.cs
+++ b/Thermo.Active.Model/Constants.cs
@@ -90,6 +90,25 @@ namespace Thermo.Active.Model
Options
}
+ public enum TACT_MBLOCK_TYPE
+ {
+ ND = 0,
+ HEATING,
+ DRAWING,
+ MOVEMENT,
+ VACUUM,
+ COOLING,
+ EXTRACTION
+ }
+
+ public enum TACT_MBLOCK_SECTION
+ {
+ ND = 0,
+ HEATING,
+ FORMING,
+ EXTRACTION
+ }
+
public enum MAINTENANCE_UNIT_OF_MEASURE
{
mm = 0,
@@ -216,6 +235,12 @@ namespace Thermo.Active.Model
public const string RECIPE_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "recipeConfigValidator.xsd";
public const string RECIPE_CONFIG_PATH = CONFIG_DIRECTORY + "recipeConfig.xml";
+ public const string MODBLOCK_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "moduleBlockConfigValidator.xsd";
+ public const string MODBLOCK_CONFIG_PATH = CONFIG_DIRECTORY + "moduleBlockConfig.xml";
+
+ public const string RISK_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "risk2007Validator.xsd";
+ public const string RISK_CONFIG_PATH = CONFIG_DIRECTORY + "risk2007.xml";
+
public const string NC_SOFTKEYS_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "ncSoftKeyConfigValidator.xsd";
public const string NC_SOFTKEYS_CONFIG_PATH = CONFIG_DIRECTORY + "ncSoftKeyConfig.xml";
diff --git a/Thermo.Active.Model/DTOModels/Recipe/DTOModule.cs b/Thermo.Active.Model/DTOModels/Recipe/DTOModule.cs
new file mode 100644
index 00000000..26831f6f
--- /dev/null
+++ b/Thermo.Active.Model/DTOModels/Recipe/DTOModule.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Thermo.Active.Model.DTOModels.Recipe
+{
+ public class DTOModule
+ {
+ public int Id { get; set; } = 0;
+ public int ActualDuration { get; set; } = 0;
+ public int ActualDelay { get; set; } = 0;
+ public int EstimDuration { get; set; } = 0;
+ public int EstimDelay { get; set; } = 0;
+ public List PrevModId { get; set; } = new List();
+ public RBStatus Status { get; set; }
+
+ public override bool Equals(object obj)
+ {
+ if (!(obj is DTOModule item))
+ return false;
+
+ if (Id!= item.Id)
+ return false;
+ if (ActualDuration != item.ActualDuration)
+ return false;
+ if (ActualDelay != item.ActualDelay)
+ return false;
+ if (PrevModId != item.PrevModId)
+ return false;
+ if (EstimDelay != item.EstimDelay)
+ return false;
+ if (!Status.Equals(item.Status))
+ return false;
+
+ return true;
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+ }
+
+ public struct RBStatus
+ {
+ public bool Visible { get; set; }
+ public bool Executing { get; set; }
+ public bool HasError { get; set; }
+ public override bool Equals(object obj)
+ {
+ if (!(obj is RBStatus item))
+ return false;
+
+ if (Visible != item.Visible)
+ return false;
+ if (Executing != item.Executing)
+ return false;
+ if (HasError != item.HasError)
+ return false;
+
+ return true;
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+ }
+}
diff --git a/Thermo.Active.Model/DTOModels/Recipe/DTOModuleConfigModel.cs b/Thermo.Active.Model/DTOModels/Recipe/DTOModuleConfigModel.cs
new file mode 100644
index 00000000..93d3c905
--- /dev/null
+++ b/Thermo.Active.Model/DTOModels/Recipe/DTOModuleConfigModel.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Thermo.Active.Model.DTOModels.Recipe
+{
+ public class DTOModuleConfigModel
+ {
+ public int Id;
+ public string Label;
+ public BlockType Type;
+ public BlockSection Section;
+ public int IdMainParam = -1; // -1 = non visibile
+ public bool DelayVisible;
+ public int VisualPriority;
+ }
+
+ public enum BlockType
+ {
+ HEATING,
+ DRAWING,
+ MOVEMENT,
+ VACUUM,
+ COOLING,
+ EXTRACTION
+ }
+ public enum BlockSection
+ {
+ HEATING,
+ FORMING,
+ EXTRACTION
+ }
+}
diff --git a/Thermo.Active.Model/DTOModels/Recipe/DTOModulesBlock.cs b/Thermo.Active.Model/DTOModels/Recipe/DTOModulesBlock.cs
new file mode 100644
index 00000000..33aca349
--- /dev/null
+++ b/Thermo.Active.Model/DTOModels/Recipe/DTOModulesBlock.cs
@@ -0,0 +1,97 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Thermo.Active.Model.DTOModels.Recipe
+{
+ public class DTOModulesBlock
+ {
+ public int Id { get; set; } = 0;
+ public double SetpointHMI { get; set; } = 0;
+ public double SetpointPLC { get; set; } = 0;
+ //public RPRange Range { get; set; }
+ //public RPStatus Status { get; set; }
+ public string UnitMeasure { get; set; }
+ public double ValueAct { get; set; }
+
+ public override bool Equals(object obj)
+ {
+ if (!(obj is DTOModulesBlock item))
+ return false;
+
+ if (Id!= item.Id)
+ return false;
+ if (SetpointHMI != item.SetpointHMI)
+ return false;
+ if (SetpointPLC != item.SetpointPLC)
+ return false;
+ //if (!Range.Equals(item.Range))
+ // return false;
+ //if (!Status.Equals(item.Status))
+ // return false;
+ if (UnitMeasure != item.UnitMeasure)
+ return false;
+ if (ValueAct != item.ValueAct)
+ return false;
+
+ return true;
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+ }
+
+#if false
+ public struct RPRange
+ {
+ public double Min { get; set; }
+ public double Max { get; set; }
+ public override bool Equals(object obj)
+ {
+ if (!(obj is RPRange item))
+ return false;
+
+ if (Min != item.Min)
+ return false;
+ if (Max != item.Max)
+ return false;
+
+ return true;
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+ }
+ public struct RPStatus
+ {
+ public bool Visible { get; set; }
+ public bool Enabled { get; set; }
+ public bool HasError { get; set; }
+ public override bool Equals(object obj)
+ {
+ if (!(obj is RPStatus item))
+ return false;
+
+ if (Visible != item.Visible)
+ return false;
+ if (Enabled != item.Enabled)
+ return false;
+ if (HasError != item.HasError)
+ return false;
+
+ return true;
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+ }
+#endif
+}
diff --git a/Thermo.Active.Model/DTOModels/Recipe/DTOWarmers.cs b/Thermo.Active.Model/DTOModels/Recipe/DTOWarmers.cs
new file mode 100644
index 00000000..66fb0f79
--- /dev/null
+++ b/Thermo.Active.Model/DTOModels/Recipe/DTOWarmers.cs
@@ -0,0 +1,97 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Thermo.Active.Model.DTOModels.Recipe
+{
+ public class DTOWarmers
+ {
+ public int Id { get; set; } = 0;
+ public double SetpointHMI { get; set; } = 0;
+ public double SetpointPLC { get; set; } = 0;
+ //public RPRange Range { get; set; }
+ //public RPStatus Status { get; set; }
+ public string UnitMeasure { get; set; }
+ public double ValueAct { get; set; }
+
+ public override bool Equals(object obj)
+ {
+ if (!(obj is DTOWarmers item))
+ return false;
+
+ if (Id!= item.Id)
+ return false;
+ if (SetpointHMI != item.SetpointHMI)
+ return false;
+ if (SetpointPLC != item.SetpointPLC)
+ return false;
+ //if (!Range.Equals(item.Range))
+ // return false;
+ //if (!Status.Equals(item.Status))
+ // return false;
+ if (UnitMeasure != item.UnitMeasure)
+ return false;
+ if (ValueAct != item.ValueAct)
+ return false;
+
+ return true;
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+ }
+
+#if false
+ public struct RPRange
+ {
+ public double Min { get; set; }
+ public double Max { get; set; }
+ public override bool Equals(object obj)
+ {
+ if (!(obj is RPRange item))
+ return false;
+
+ if (Min != item.Min)
+ return false;
+ if (Max != item.Max)
+ return false;
+
+ return true;
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+ }
+ public struct RPStatus
+ {
+ public bool Visible { get; set; }
+ public bool Enabled { get; set; }
+ public bool HasError { get; set; }
+ public override bool Equals(object obj)
+ {
+ if (!(obj is RPStatus item))
+ return false;
+
+ if (Visible != item.Visible)
+ return false;
+ if (Enabled != item.Enabled)
+ return false;
+ if (HasError != item.HasError)
+ return false;
+
+ return true;
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+ }
+#endif
+}
diff --git a/Thermo.Active.Model/DTOModels/Recipe/RecipeParam.cs b/Thermo.Active.Model/DTOModels/Recipe/RecipeParam.cs
deleted file mode 100644
index 0be98501..00000000
--- a/Thermo.Active.Model/DTOModels/Recipe/RecipeParam.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.DTOModels.Recipe
-{
- ///
- /// Struttura parametri "lenti" (lettura NON frequente)
- ///
- public class RecipeParam
- {
- public int Id { get; set; }
- public double SetpointHMI { get; set; }
- public double SetpointPLC { get; set; }
- public double ValueMax { get; set; }
- public double ValueMin { get; set; }
- public string UnitMeasure { get; set; }
- }
-}
diff --git a/Thermo.Active.Model/DTOModels/Recipe/RecipeParamRT.cs b/Thermo.Active.Model/DTOModels/Recipe/RecipeParamRT.cs
deleted file mode 100644
index 97628808..00000000
--- a/Thermo.Active.Model/DTOModels/Recipe/RecipeParamRT.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Thermo.Active.Model.DTOModels.Recipe
-{
- ///
- /// Struttura parametri "veloci" (RT=RealTime, lettura frequente)
- ///
- public class RecipeParamRT
- {
- public short Id { get; set; }
- public short StatusBit { get; set; }
- public double ValueAct { get; set; }
- }
-
- [Flags]
- public enum StatusVal
- {
- None = 0x0,
- Visible = 0x1,
- Enabled = 0x2,
- HasError = 0x4
- }
-}
diff --git a/Thermo.Active.Model/Thermo.Active.Model.csproj b/Thermo.Active.Model/Thermo.Active.Model.csproj
index b4394495..20404e3f 100644
--- a/Thermo.Active.Model/Thermo.Active.Model.csproj
+++ b/Thermo.Active.Model/Thermo.Active.Model.csproj
@@ -63,6 +63,8 @@
+
+
@@ -102,6 +104,10 @@
+
+
+
+
@@ -114,8 +120,6 @@
-
-
diff --git a/Thermo.Active.NC/NcAdapter.cs b/Thermo.Active.NC/NcAdapter.cs
index 9e6c059f..e510d828 100644
--- a/Thermo.Active.NC/NcAdapter.cs
+++ b/Thermo.Active.NC/NcAdapter.cs
@@ -1079,18 +1079,20 @@ namespace Thermo.Active.NC
// solo x S7...
if (NcConfig.NcVendor == NC_VENDOR.S7NET)
{
- Dictionary currPlcRecipe = new Dictionary();
+ Dictionary currPlcRecipe = new Dictionary();
CmsError cmsError = NO_ERROR;
if (useLastRead)
{
- cmsError = numericalControl.PLC_RRecipeLastParamList(ref currPlcRecipe);
+ cmsError = numericalControl.PLC_RRecipeParamList(false, ref currPlcRecipe);
}
else
{
cmsError = numericalControl.PLC_RRecipeParamList(refreshOnlyRT, ref currPlcRecipe);
}
+
if (cmsError.IsError())
return cmsError;
+
DTORecipeParam currParam = new DTORecipeParam();
// leggo l'intero array delle DB... QUI FAKE sulle DB configurate...
List recipeConfig = RecipeConfig.Select(x => new DTORecipeConfigModel()
@@ -1110,7 +1112,7 @@ namespace Thermo.Active.NC
if (currPlcRecipe.ContainsKey(item.Id))
{
// recupero da mem PLC
- DataStructures.RecipeParam paramPLC = currPlcRecipe[item.Id];
+ ThermoModels.RecipeParam paramPLC = currPlcRecipe[item.Id];
currRange = new RPRange()
{
Min = paramPLC.ValMin,
@@ -1178,11 +1180,11 @@ namespace Thermo.Active.NC
if (NcConfig.NcVendor == NC_VENDOR.S7NET)
{
// ciclo x ogni valore della ricetta aggiornata ricevuto
- DataStructures.RecipeParam currParam;
+ ThermoModels.RecipeParam currParam;
foreach (var item in updtRecipe)
{
// salvo SOLO il setpoint HMI...
- currParam = new DataStructures.RecipeParam()
+ currParam = new ThermoModels.RecipeParam()
{
Id = (short)item.Value.Id,
SetpointHMI = item.Value.SetpointHMI
@@ -1575,7 +1577,6 @@ namespace Thermo.Active.NC
return cmsError;
}
-
///
/// Scrive tutti i parametri della ricetta indicati
///
@@ -1656,6 +1657,58 @@ namespace Thermo.Active.NC
return cmsError;
}
+ ///
+ /// Legge tutti i parametri della ricetta
+ ///
+ /// Oggetto elenco modules block
+ ///
+ public CmsError ReadModulesBlock(out Dictionary currModules)
+ {
+ CmsError cmsError = NO_ERROR;
+ currModules = new Dictionary();
+
+ // FIXME TODO
+#if false
+ DTORecipeParam currParam = new DTORecipeParam();
+ RPRange currRange = new RPRange();
+ RPStatus currStatus = new RPStatus();
+
+ // gestione errore
+ cmsError = ReadRecipeData(false, true, out currModules);
+ if (cmsError.IsError())
+ return cmsError;
+#endif
+
+ // restituisco cod errore se trovato
+ return cmsError;
+ }
+
+ ///
+ /// Legge tutti i parametri della ricetta
+ ///
+ /// Oggetto elenco 1024 ch riscaldi
+ ///
+ public CmsError ReadWarmers(out Dictionary currWarmers)
+ {
+ CmsError cmsError = NO_ERROR;
+ currWarmers = new Dictionary();
+
+ // FIXME TODO
+#if false
+ DTORecipeParam currParam = new DTORecipeParam();
+ RPRange currRange = new RPRange();
+ RPStatus currStatus = new RPStatus();
+
+ // gestione errore
+ cmsError = ReadRecipeData(false, true, out currModules);
+ if (cmsError.IsError())
+ return cmsError;
+#endif
+
+ // restituisco cod errore se trovato
+ return cmsError;
+ }
+
#endregion Read Data
diff --git a/Thermo.Active.Utils/supportFunctions.cs b/Thermo.Active.Utils/supportFunctions.cs
index 269cd3f8..b41ac62a 100644
--- a/Thermo.Active.Utils/supportFunctions.cs
+++ b/Thermo.Active.Utils/supportFunctions.cs
@@ -39,13 +39,47 @@ namespace Thermo.Active.Utils
default: return HEAD_TYPE.WJ;
}
}
-
- public static TACT_PARAM_TYPE GetTActCategory(string strCategory)
+ ///
+ /// Conversion string --> TACT_PARAM_TYPE
+ ///
+ ///
+ ///
+ public static TACT_PARAM_TYPE GetTActParamType(string strValue)
{
TACT_PARAM_TYPE answ = TACT_PARAM_TYPE.ND;
try
{
- answ = (TACT_PARAM_TYPE)Enum.Parse(typeof(TACT_PARAM_TYPE), strCategory);
+ answ = (TACT_PARAM_TYPE)Enum.Parse(typeof(TACT_PARAM_TYPE), strValue);
+ }
+ catch { }
+ return answ;
+ }
+ ///
+ /// Conversion string --> TACT_MBLOCK_TYPE
+ ///
+ ///
+ ///
+ public static TACT_MBLOCK_TYPE GetTActMB_Type(string strValue)
+ {
+ TACT_MBLOCK_TYPE answ = TACT_MBLOCK_TYPE.ND;
+ try
+ {
+ answ = (TACT_MBLOCK_TYPE)Enum.Parse(typeof(TACT_MBLOCK_TYPE), strValue);
+ }
+ catch { }
+ return answ;
+ }
+ ///
+ /// Conversion string --> TACT_MBLOCK_SECTION
+ ///
+ ///
+ ///
+ public static TACT_MBLOCK_SECTION GetTActMB_Section(string strValue)
+ {
+ TACT_MBLOCK_SECTION answ = TACT_MBLOCK_SECTION.ND;
+ try
+ {
+ answ = (TACT_MBLOCK_SECTION)Enum.Parse(typeof(TACT_MBLOCK_SECTION), strValue);
}
catch { }
return answ;
diff --git a/Thermo.Active/Controllers/WebApi/ModulesController.cs b/Thermo.Active/Controllers/WebApi/ModulesController.cs
new file mode 100644
index 00000000..035927cc
--- /dev/null
+++ b/Thermo.Active/Controllers/WebApi/ModulesController.cs
@@ -0,0 +1,41 @@
+using CMS_CORE_Library.Models;
+using Thermo.Active.Model.DTOModels;
+using Thermo.Active.NC;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Threading.Tasks;
+using System.Web.Http;
+using static CMS_CORE_Library.Models.DataStructures;
+using static Thermo.Active.Config.ServerConfig;
+using static Thermo.Active.Model.Constants;
+using Thermo.Active.Model.DTOModels.Recipe;
+
+namespace Thermo.Active.Controllers.WebApi
+{
+ [RoutePrefix("api/ModBlock")]
+ public class ModulesController : ApiController
+ {
+ [Route("current"), HttpGet]
+ public IHttpActionResult GetCurrentModules()
+ {
+ using (NcAdapter ncAdapter = new NcAdapter())
+ {
+ // Try connection
+ CmsError libraryError = ncAdapter.Connect();
+ if (libraryError.errorCode != 0)
+ return NotFound();
+
+ CmsError cmsError = ncAdapter.ReadModulesBlock(out Dictionary currModules);
+ if (cmsError.IsError())
+ return BadRequest(cmsError.localizationKey);
+
+ return Ok(currModules);
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Thermo.Active/Controllers/WebApi/WarmersController.cs b/Thermo.Active/Controllers/WebApi/WarmersController.cs
new file mode 100644
index 00000000..f437f5b5
--- /dev/null
+++ b/Thermo.Active/Controllers/WebApi/WarmersController.cs
@@ -0,0 +1,83 @@
+using CMS_CORE_Library.Models;
+using Thermo.Active.Model.DTOModels;
+using Thermo.Active.NC;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Threading.Tasks;
+using System.Web.Http;
+using static CMS_CORE_Library.Models.DataStructures;
+using static Thermo.Active.Config.ServerConfig;
+using static Thermo.Active.Model.Constants;
+using Thermo.Active.Model.DTOModels.Recipe;
+
+namespace Thermo.Active.Controllers.WebApi
+{
+ [RoutePrefix("api/warmers")]
+ public class WarmersController : ApiController
+ {
+ [Route("current"), HttpGet]
+ public IHttpActionResult GetCurrentWarmers()
+ {
+ using (NcAdapter ncAdapter = new NcAdapter())
+ {
+ // Try connection
+ CmsError libraryError = ncAdapter.Connect();
+ if (libraryError.errorCode != 0)
+ return NotFound();
+
+ CmsError cmsError = ncAdapter.ReadWarmers(out Dictionary currWarmers);
+ if (cmsError.IsError())
+ return BadRequest(cmsError.localizationKey);
+
+ return Ok(currWarmers);
+ }
+ }
+
+
+ // FIXME TODO determinare IN PRIMIS nel modello COSA e come aggiornare...
+#if false
+ [Route("update"), HttpPut]
+ public IHttpActionResult WriteWarmers(Dictionary parametersList)
+ {
+ using (NcAdapter ncAdapter = new NcAdapter())
+ {
+ // Try connection
+ CmsError libraryError = ncAdapter.Connect();
+
+ CmsError cmsError = ncAdapter.ReadFullRecipe(out Dictionary prevRecipe);
+ if (cmsError.IsError())
+ return BadRequest(cmsError.localizationKey);
+
+ Dictionary updtRecipe = new Dictionary();
+
+ foreach (var item in parametersList)
+ {
+ if (prevRecipe.ContainsKey(item.Key))
+ {
+ // aggiorno il valore HMI nel parametro
+ var currParam = prevRecipe[item.Key];
+ currParam.SetpointHMI = item.Value;
+ // salvo (1 parametro, potrei fare N...)
+ updtRecipe.Add(item.Key, currParam);
+ }
+ else
+ {
+ return NotFound();
+ }
+ }
+
+ // scrivo sul PLC
+ ncAdapter.WriteRecipeParams(updtRecipe);
+
+ // ritorno solo fatto!
+ return Ok();
+ }
+ }
+#endif
+
+ }
+}
\ No newline at end of file
diff --git a/Thermo.Active/Listeners/ListenersHandler.cs b/Thermo.Active/Listeners/ListenersHandler.cs
index 1571ea8b..47bb4851 100644
--- a/Thermo.Active/Listeners/ListenersHandler.cs
+++ b/Thermo.Active/Listeners/ListenersHandler.cs
@@ -114,6 +114,9 @@ namespace Thermo.Active.Listeners
SignalRListener.SendThermoGaugeData(a);
}));
+ // FIXME TODO ADD ProdCycle
+
+ // FIXME TODO ADD ProdInfo
// Broadcast
infos.Add(MessageServices.Current.Subscribe(BROADCAST_DATA, (a, b) =>
diff --git a/Thermo.Active/Thermo.Active.csproj b/Thermo.Active/Thermo.Active.csproj
index 3677d1d4..f6b40ad4 100644
--- a/Thermo.Active/Thermo.Active.csproj
+++ b/Thermo.Active/Thermo.Active.csproj
@@ -222,6 +222,8 @@
+
+