Removed old method + fix startup
This commit is contained in:
@@ -40,6 +40,27 @@ namespace Thermo.Active.Config
|
||||
// ReadCMSConnectConfig();
|
||||
ReadMacros();
|
||||
ReadScadaFile();
|
||||
}
|
||||
catch (XmlException ex)
|
||||
{
|
||||
ExceptionManager.ManageError(ERROR_LEVEL.FATAL,
|
||||
"Error while reading file: " + ex.SourceUri +
|
||||
"\n Error: " + ex.Message,
|
||||
true
|
||||
);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var message = ex.Message;
|
||||
if (ex.InnerException != null)
|
||||
message += "\n" + ex.InnerException.Message;
|
||||
ExceptionManager.ManageError(ERROR_LEVEL.FATAL, message, true);
|
||||
}
|
||||
}
|
||||
public static void ReadLastRecipe()
|
||||
{
|
||||
try
|
||||
{
|
||||
ReadLiveData();
|
||||
}
|
||||
catch (XmlException ex)
|
||||
@@ -729,7 +750,7 @@ namespace Thermo.Active.Config
|
||||
SetpointThermo = 0,
|
||||
MaxPower = riferimento.Potenza,
|
||||
NumResist = 1,
|
||||
CalcIchMin=riferimento.Modello.Contains("Quarzo")
|
||||
CalcIchMin = riferimento.Modello.Contains("Quarzo")
|
||||
});
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1368,39 +1368,15 @@ namespace Thermo.Active.NC
|
||||
// solo x S7...
|
||||
if (NcConfig.NcVendor == NC_VENDOR.S7NET)
|
||||
{
|
||||
// single old method (OK)
|
||||
if (false)
|
||||
// ciclo x ogni valore della ricetta aggiornata ricevuto
|
||||
foreach (var item in updtRecipe)
|
||||
{
|
||||
#if false
|
||||
// ciclo x ogni valore della ricetta aggiornata ricevuto
|
||||
ThermoModels.RecipeParam currParam;
|
||||
foreach (var item in updtRecipe)
|
||||
{
|
||||
// salvo SOLO il setpoint HMI...
|
||||
currParam = new ThermoModels.RecipeParam()
|
||||
{
|
||||
Id = (short)item.Value.Id,
|
||||
SetpointHMI = item.Value.SetpointHMI * item.Value.ScaleFactor
|
||||
};
|
||||
// scrivo!
|
||||
CmsError cmsError = numericalControl.PLC_WRecipeParam(currParam);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// ciclo x ogni valore della ricetta aggiornata ricevuto
|
||||
foreach (var item in updtRecipe)
|
||||
{
|
||||
newParameters.Add(item.Value.Id, (int)(item.Value.SetpointHMI * item.Value.ScaleFactor));
|
||||
}
|
||||
// scrivo!
|
||||
CmsError cmsError = numericalControl.PLC_WRecipeParameters(newParameters);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
newParameters.Add(item.Value.Id, (int)(item.Value.SetpointHMI * item.Value.ScaleFactor));
|
||||
}
|
||||
// scrivo!
|
||||
CmsError cmsError = numericalControl.PLC_WRecipeParameters(newParameters);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -445,7 +445,7 @@ namespace Thermo.Active.Controllers.WebApi
|
||||
}
|
||||
}
|
||||
|
||||
protected static CmsError WriteCurrentRecipeToPlc()
|
||||
public static CmsError WriteCurrentRecipeToPlc()
|
||||
{
|
||||
CmsError checkError = NO_ERROR;
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ using static Thermo.Active.Config.ServerConfig;
|
||||
using static Thermo.Active.Model.Constants;
|
||||
using static Thermo.Active.Utils.ThermoActiveLogger;
|
||||
using static Thermo.Active.Utils.ExceptionManager;
|
||||
using Thermo.Active.Controllers.WebApi;
|
||||
|
||||
namespace Thermo.Active
|
||||
{
|
||||
@@ -84,6 +85,11 @@ namespace Thermo.Active
|
||||
if (!string.IsNullOrWhiteSpace(ServerStartupConfig.ServerAddress.ToString()))
|
||||
opt.Urls.Add("http://" + ServerStartupConfig.ServerAddress.ToString() + ":" + ServerStartupConfig.ServerPort.ToString());
|
||||
|
||||
// read and save last CURRENT RECIPE data...
|
||||
ServerConfigController.ReadLastRecipe();
|
||||
RecipeController.WriteCurrentRecipeToPlc();
|
||||
|
||||
//starts threads
|
||||
using (WebApp.Start<App_Start.Startup>(opt))
|
||||
{
|
||||
if (databaseStatus)
|
||||
|
||||
Reference in New Issue
Block a user