Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -1,27 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<axes>
|
||||
<axis id="1" >X</axis>
|
||||
<axis id="2" >Y</axis>
|
||||
<axis id="3" >Z</axis>
|
||||
<axis id="4" >B</axis>
|
||||
<axis id="5" >C</axis>
|
||||
<axis id="6" >V</axis>
|
||||
<axis id="7" ></axis>
|
||||
<axis id="8" ></axis>
|
||||
<axis id="9" ></axis>
|
||||
<axis id="10" ></axis>
|
||||
<axis id="11" ></axis>
|
||||
<axis id="12" ></axis>
|
||||
<axis id="13" ></axis>
|
||||
<axis id="14" ></axis>
|
||||
<axis id="15" ></axis>
|
||||
<axis id="16" ></axis>
|
||||
<axis id="17" >SP</axis>
|
||||
<axis id="18" ></axis>
|
||||
<axis id="19" ></axis>
|
||||
<axis id="20" ></axis>
|
||||
<axis id="21" ></axis>
|
||||
<axis id="22" ></axis>
|
||||
<axis id="23" ></axis>
|
||||
<axis id="24" ></axis>
|
||||
<axis id="1" name="X" type="LINEAR" />
|
||||
<axis id="2" name="Y" type="LINEAR" />
|
||||
<axis id="3" name="Z" type="LINEAR" />
|
||||
<axis id="4" name="B" type="ROTATIONAL" />
|
||||
<axis id="5" name="C" type="ROTATIONAL" />
|
||||
<axis id="6" name="V" type="ROTATIONAL" />
|
||||
<axis id="7" name="" type="NA" />
|
||||
<axis id="8" name="" type="NA" />
|
||||
<axis id="9" name="" type="NA" />
|
||||
<axis id="10" name="" type="NA" />
|
||||
<axis id="11" name="" type="NA" />
|
||||
<axis id="12" name="" type="NA" />
|
||||
<axis id="13" name="" type="NA" />
|
||||
<axis id="14" name="" type="NA" />
|
||||
<axis id="15" name="" type="NA" />
|
||||
<axis id="16" name="" type="NA" />
|
||||
<axis id="17" name="SP" type="ROTATIONAL" />
|
||||
<axis id="18" name="" type="NA" />
|
||||
<axis id="19" name="" type="NA" />
|
||||
<axis id="20" name="" type="NA" />
|
||||
<axis id="21" name="" type="NA" />
|
||||
<axis id="22" name="" type="NA" />
|
||||
<axis id="23" name="" type="NA" />
|
||||
<axis id="24" name="" type="NA" />
|
||||
<axis id="25" name="" type="NA" />
|
||||
<axis id="26" name="" type="NA" />
|
||||
<axis id="27" name="" type="NA" />
|
||||
<axis id="28" name="" type="NA" />
|
||||
<axis id="29" name="" type="NA" />
|
||||
<axis id="30" name="" type="NA" />
|
||||
<axis id="31" name="" type="NA" />
|
||||
<axis id="32" name="" type="NA" />
|
||||
</axes>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="axes">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="axis" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:complexContent>
|
||||
<xs:extension base="axisType"/>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:complexType name="axisType">
|
||||
<xs:attribute name="id" type="xs:integer" use="required">
|
||||
</xs:attribute>
|
||||
<xs:attribute name="name" type="xs:string" use="required">
|
||||
</xs:attribute>
|
||||
<xs:attribute name="type" type="axType" use="required">
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
<xs:simpleType name="axType" final="restriction" >
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="NA" />
|
||||
<xs:enumeration value="LINEAR" />
|
||||
<xs:enumeration value="ROTATIONAL" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:schema>
|
||||
@@ -63,6 +63,7 @@ namespace Thermo.Active.Config
|
||||
public static List<RiskResistModel> RiskResistConfig;
|
||||
public static List<RiskChannelModel> RiskChannelConfig;
|
||||
public static List<RiskBoardModel> RiskBoardConfig;
|
||||
public static List<AxesConfigModel> AxesConfig;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace Thermo.Active.Config
|
||||
ReadRecipeConfig();
|
||||
ReadModBlockConfig();
|
||||
ReadRiskConfig();
|
||||
ReadAxesConfig();
|
||||
// ReadCMSConnectConfig();
|
||||
ReadMacros();
|
||||
ReadScadaFile();
|
||||
@@ -867,6 +868,25 @@ namespace Thermo.Active.Config
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Axes config setup from file
|
||||
/// </summary>
|
||||
private static void ReadAxesConfig()
|
||||
{
|
||||
XDocument xmlConfigFile = GetXmlHandlerWithValidator(AXES_CONFIG_SCHEMA_PATH, AXES_CONFIG_PATH);
|
||||
|
||||
// Read head config from XML file
|
||||
AxesConfig = xmlConfigFile
|
||||
.Root
|
||||
.Elements()
|
||||
.Select(x => new AxesConfigModel()
|
||||
{
|
||||
Id = Convert.ToInt16(x.Attribute("id").Value),
|
||||
Name = x.Attribute("name").Value,
|
||||
Type = GetTActAxes_Type(x.Attribute("type").Value)
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
private static void ReadCMSConnectConfig()
|
||||
{
|
||||
String _tempUSR, _tempPSW;
|
||||
|
||||
@@ -207,6 +207,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Config\axesConfigValidator.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
<None Include="Config\Recipes\template.tpl">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
@@ -15,6 +15,7 @@ using Thermo.Active.Database.Controllers;
|
||||
using Thermo.Active.Model.DTOModels;
|
||||
using Thermo.Active.Model.DTOModels.AlarmModels;
|
||||
using Thermo.Active.Model.DTOModels.Scada;
|
||||
using Thermo.Active.Model.DTOModels.ThAxes;
|
||||
using Thermo.Active.Model.DTOModels.ThModules;
|
||||
using Thermo.Active.Model.DTOModels.ThProd;
|
||||
using Thermo.Active.Model.DTOModels.ThRecipe;
|
||||
@@ -507,7 +508,7 @@ public static class ThreadsFunctions
|
||||
MessageServices.Current.Publish(SEND_AXIS_NAMES_DATA, null, axes);
|
||||
}
|
||||
else
|
||||
RestoreConnection();
|
||||
RestoreConnection();
|
||||
|
||||
sw.Stop();
|
||||
|
||||
@@ -515,7 +516,7 @@ public static class ThreadsFunctions
|
||||
UpdateStat(MethodBase.GetCurrentMethod().Name, sw.ElapsedMilliseconds);
|
||||
|
||||
// Wait
|
||||
Thread.Sleep(CalcSleepTime(800, (int)sw.ElapsedMilliseconds));
|
||||
Thread.Sleep(CalcSleepTime(1000, (int)sw.ElapsedMilliseconds));
|
||||
}
|
||||
}
|
||||
catch (ThreadAbortException)
|
||||
@@ -542,15 +543,15 @@ public static class ThreadsFunctions
|
||||
if (ncAdapter.numericalControl.NC_IsConnected())
|
||||
{
|
||||
// Get Data from NC
|
||||
libraryError = ncAdapter.GetAxesPositionsBySelectedProcess(out DTOAxesModel axesPositions);
|
||||
libraryError = ncAdapter.GetAxesPositions(out DTOThermoAxesMovModel axesPositions);
|
||||
if (libraryError.errorCode != 0)
|
||||
ManageLibraryError(libraryError);
|
||||
else
|
||||
// Send through signalR
|
||||
MessageServices.Current.Publish(SEND_AXES, null, axesPositions);
|
||||
MessageServices.Current.Publish(SEND_AXIS_POS, null, axesPositions);
|
||||
}
|
||||
else
|
||||
RestoreConnection();
|
||||
RestoreConnection();
|
||||
|
||||
sw.Stop();
|
||||
|
||||
@@ -558,7 +559,52 @@ public static class ThreadsFunctions
|
||||
UpdateStat(MethodBase.GetCurrentMethod().Name, sw.ElapsedMilliseconds);
|
||||
|
||||
// Wait
|
||||
Thread.Sleep(CalcSleepTime(100, (int)sw.ElapsedMilliseconds));
|
||||
Thread.Sleep(CalcSleepTime(200, (int)sw.ElapsedMilliseconds));
|
||||
}
|
||||
}
|
||||
catch (ThreadAbortException)
|
||||
{
|
||||
ncAdapter.Dispose();
|
||||
}
|
||||
}
|
||||
public static void ReadAxesInfoData()
|
||||
{
|
||||
NcAdapter ncAdapter = new NcAdapter();
|
||||
Stopwatch sw = new Stopwatch();
|
||||
|
||||
try
|
||||
{
|
||||
// Try connection
|
||||
CmsError libraryError = ncAdapter.Connect();
|
||||
if (libraryError.errorCode != 0)
|
||||
ManageLibraryError(libraryError);
|
||||
|
||||
while (true)
|
||||
{
|
||||
sw.Restart();
|
||||
|
||||
#if false
|
||||
if (ncAdapter.numericalControl.NC_IsConnected())
|
||||
{
|
||||
// Get Data from NC
|
||||
libraryError = ncAdapter.GetAxesPositionsBySelectedProcess(out DTOAxesModel axesPositions);
|
||||
if (libraryError.errorCode != 0)
|
||||
ManageLibraryError(libraryError);
|
||||
else
|
||||
// Send through signalR
|
||||
MessageServices.Current.Publish(SEND_AXIS_INFO, null, axesPositions);
|
||||
}
|
||||
else
|
||||
RestoreConnection();
|
||||
#endif
|
||||
|
||||
sw.Stop();
|
||||
|
||||
//Update thread timer
|
||||
UpdateStat(MethodBase.GetCurrentMethod().Name, sw.ElapsedMilliseconds);
|
||||
|
||||
// Wait
|
||||
Thread.Sleep(CalcSleepTime(500, (int)sw.ElapsedMilliseconds));
|
||||
}
|
||||
}
|
||||
catch (ThreadAbortException)
|
||||
|
||||
@@ -19,10 +19,8 @@ namespace Thermo.Active.Core
|
||||
ThreadsFunctions.ReadProcessesPPStatus,
|
||||
ThreadsFunctions.ReadEnabledFunctionality,
|
||||
ThreadsFunctions.ReadExpiredMaintenances,
|
||||
//ThreadsFunctions.ReadAxesPositionsData,
|
||||
ThreadsFunctions.ReadUserSoftKeysData,
|
||||
//ThreadsFunctions.ReadHeadsData,
|
||||
//ThreadsFunctions.ReadAxesNamesData,
|
||||
//ThreadsFunctions.ReadActiveProgramData,
|
||||
//ThreadsFunctions.ReadPartProgramQueueData,
|
||||
// ThreadsFunctions.ReadNcSoftKeysData,
|
||||
@@ -36,6 +34,9 @@ namespace Thermo.Active.Core
|
||||
ThreadsFunctions.ReadModulesData,
|
||||
ThreadsFunctions.ReadScadaData,
|
||||
ThreadsFunctions.ReadMComandsData,
|
||||
ThreadsFunctions.ReadAxesNamesData,
|
||||
ThreadsFunctions.ReadAxesPositionsData,
|
||||
ThreadsFunctions.ReadAxesInfoData,
|
||||
ThreadsFunctions.ReadM154Data // levare?
|
||||
|
||||
};
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using static Thermo.Active.Model.Constants;
|
||||
|
||||
namespace Thermo.Active.Model.ConfigModels
|
||||
{
|
||||
public class AxesConfigModel
|
||||
{
|
||||
public int Id;
|
||||
public string Name { get; set; }
|
||||
public bool IsSelectable { get; set; } = true;
|
||||
public TACT_AXES_TYPE Type { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -102,6 +102,12 @@ namespace Thermo.Active.Model
|
||||
COOLING,
|
||||
EXTRACTION
|
||||
}
|
||||
public enum TACT_AXES_TYPE
|
||||
{
|
||||
NA = 0,
|
||||
LINEAR,
|
||||
ROTATIONAL
|
||||
}
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum TACT_PROD_CATEGORY
|
||||
@@ -272,6 +278,10 @@ namespace Thermo.Active.Model
|
||||
public const string MACROS_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + "macrosConfigValidator.xsd";
|
||||
public const string MACROS_CONFIG_PATH = CONFIG_DIRECTORY + "macrosConfig.xml";
|
||||
|
||||
|
||||
public const string AXES_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + @"axesConfigValidator.xsd";
|
||||
public const string AXES_CONFIG_PATH = CONFIG_DIRECTORY + "axesConfig.xml";
|
||||
|
||||
public const string MAIN_PROGRAM_CONFIG_PATH = CONFIG_DIRECTORY + "customMainProgram.txt";
|
||||
|
||||
|
||||
@@ -300,7 +310,6 @@ namespace Thermo.Active.Model
|
||||
|
||||
public const string SEND_POWER_ON_DATA = "SEND_POWER_ON_DATA";
|
||||
public const string SEND_GENERIC_DATA = "SEND_GENERIC_DATA";
|
||||
public const string SEND_AXES = "SEND_AXES";
|
||||
public const string SEND_PROCESSES_DATA = "SEND_PROCESSES_STATUS";
|
||||
public const string SEND_FUNCTIONALITY_DATA = "SEND_FUNCTION_DATA";
|
||||
public const string SEND_EXPIRED_MAINTENANCES_DATA = "SEND_EXPIRED_MAINTENANCES_DATA";
|
||||
@@ -308,6 +317,8 @@ namespace Thermo.Active.Model
|
||||
public const string SEND_NC_SOFTKEYS_DATA = "SEND_NC_SOFTKEYS_DATA";
|
||||
public const string SEND_HEADS_DATA = "SEND_HEADS_DATA";
|
||||
public const string SEND_AXIS_NAMES_DATA = "SEND_AXIS_NAMES_DATA";
|
||||
public const string SEND_AXIS_POS = "SEND_AXIS_POS";
|
||||
public const string SEND_AXIS_INFO = "SEND_AXIS_INFO";
|
||||
public const string SEND_ACTIVE_PROGRAM_DATA = "SEND_ACTIVE_PROGRAM_DATA";
|
||||
public const string SEND_QUEUE_DATA = "SEND_QUEUE_DATA";
|
||||
public const string SEND_M155_DATA = "SEND_M155_DATA";
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static Thermo.Active.Model.Constants;
|
||||
|
||||
namespace Thermo.Active.Model.DTOModels.ThAxes
|
||||
{
|
||||
public class DTOAxesInfoModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Errori attuali su assi
|
||||
/// </summary>
|
||||
public Dictionary<string, int> errorCode;
|
||||
/// <summary>
|
||||
/// Fase movimento attuale
|
||||
/// </summary>
|
||||
public Dictionary<string, int> movPhase;
|
||||
/// <summary>
|
||||
/// Status Word attuale
|
||||
/// </summary>
|
||||
public Dictionary<string, int> statusCode;
|
||||
|
||||
public DTOAxesInfoModel()
|
||||
{
|
||||
errorCode = new Dictionary<string, int>();
|
||||
movPhase = new Dictionary<string, int>();
|
||||
statusCode = new Dictionary<string, int>();
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is DTOAxesInfoModel item))
|
||||
return false;
|
||||
|
||||
if (!CheckDictInt(errorCode, item.errorCode))
|
||||
return false;
|
||||
if (!CheckDictInt(movPhase, item.movPhase))
|
||||
return false;
|
||||
if (!CheckDictInt(statusCode, item.statusCode))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
private bool CheckDictInt(IDictionary<string, int> x, IDictionary<string, int> y)
|
||||
{
|
||||
// early-exit checks
|
||||
if (y == null)
|
||||
return x == null;
|
||||
if (x == null)
|
||||
return false;
|
||||
|
||||
if (x.Count != y.Count)
|
||||
return false;
|
||||
|
||||
// Check keys are the same
|
||||
foreach (string k in x.Keys)
|
||||
if (!y.ContainsKey(k))
|
||||
return false;
|
||||
|
||||
// Check values are different
|
||||
foreach (string k in x.Keys)
|
||||
{
|
||||
if (y[k] != x[k])
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static Thermo.Active.Model.Constants;
|
||||
|
||||
namespace Thermo.Active.Model.DTOModels.ThAxes
|
||||
{
|
||||
public class DTOThermoAxesMovModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Actual position
|
||||
/// </summary>
|
||||
public Dictionary<string, double> actPosition;
|
||||
/// <summary>
|
||||
/// Actual Speed
|
||||
/// </summary>
|
||||
public Dictionary<string, double> actSpeed;
|
||||
/// <summary>
|
||||
/// Carico attuale assi
|
||||
/// </summary>
|
||||
public Dictionary<string, double> actLoad;
|
||||
|
||||
public DTOThermoAxesMovModel()
|
||||
{
|
||||
actPosition = new Dictionary<string, double>();
|
||||
actSpeed = new Dictionary<string, double>();
|
||||
actLoad = new Dictionary<string, double>();
|
||||
}
|
||||
|
||||
#if false
|
||||
public struct AxisModel
|
||||
{
|
||||
public string name;
|
||||
public double value;
|
||||
}
|
||||
#endif
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is DTOThermoAxesMovModel item))
|
||||
return false;
|
||||
|
||||
if (!CheckDictDouble(actPosition, item.actPosition))
|
||||
return false;
|
||||
if (!CheckDictDouble(actSpeed, item.actSpeed))
|
||||
return false;
|
||||
if (!CheckDictDouble(actLoad, item.actLoad))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
private bool CheckDictDouble(IDictionary<string, double> x, IDictionary<string, double> y)
|
||||
{
|
||||
// early-exit checks
|
||||
if (y == null)
|
||||
return x == null;
|
||||
if (x == null)
|
||||
return false;
|
||||
|
||||
if (x.Count != y.Count)
|
||||
return false;
|
||||
|
||||
// Check keys are the same
|
||||
foreach (string k in x.Keys)
|
||||
if (!y.ContainsKey(k))
|
||||
return false;
|
||||
|
||||
// Check values are different
|
||||
foreach (string k in x.Keys)
|
||||
{
|
||||
double a = Math.Abs(y[k] - x[k]);
|
||||
|
||||
if (Math.Round(a, 3) >= Constants.EPSILON)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,6 +64,7 @@
|
||||
<Compile Include="ConfigModels\CmsConnectConfigModel.cs" />
|
||||
<Compile Include="ConfigModels\ExtSoftwareModel.cs" />
|
||||
<Compile Include="ConfigModels\InputOperatorConfigModel.cs" />
|
||||
<Compile Include="ConfigModels\AxesConfigModel.cs" />
|
||||
<Compile Include="ConfigModels\ThermoProdConfigModel.cs" />
|
||||
<Compile Include="ConfigModels\ModBlockConfigModel.cs" />
|
||||
<Compile Include="ConfigModels\RiskConfigModel.cs" />
|
||||
@@ -108,6 +109,8 @@
|
||||
<Compile Include="DTOModels\DTOAxisNameModel.cs" />
|
||||
<Compile Include="DTOModels\DTOClientConfigurationModel.cs" />
|
||||
<Compile Include="DTOModels\DTOM156InputModel.cs" />
|
||||
<Compile Include="DTOModels\ThAxes\DTOAxesInfoModel.cs" />
|
||||
<Compile Include="DTOModels\ThAxes\DTOAxesMovModel.cs" />
|
||||
<Compile Include="DTOModels\ThModules\DTOModulesBlock.cs" />
|
||||
<Compile Include="DTOModels\ThProd\DTOProdInfo.cs" />
|
||||
<Compile Include="DTOModels\ThProd\DTOThermoPanelProd.cs" />
|
||||
|
||||
@@ -12,6 +12,7 @@ using Thermo.Active.Model.DTOModels;
|
||||
using Thermo.Active.Model.DTOModels.AlarmModels;
|
||||
using Thermo.Active.Model.DTOModels.MaintenanceModels;
|
||||
using Thermo.Active.Model.DTOModels.Scada;
|
||||
using Thermo.Active.Model.DTOModels.ThAxes;
|
||||
using Thermo.Active.Model.DTOModels.ThModules;
|
||||
using Thermo.Active.Model.DTOModels.ThProd;
|
||||
using Thermo.Active.Model.DTOModels.ThRecipe;
|
||||
@@ -276,6 +277,7 @@ namespace Thermo.Active.NC
|
||||
|
||||
#region Axes
|
||||
|
||||
#if false
|
||||
public CmsError GetAxesPositions(out List<DTOAxesModel> axes)
|
||||
{
|
||||
axes = new List<DTOAxesModel>();
|
||||
@@ -338,31 +340,40 @@ namespace Thermo.Active.NC
|
||||
//numericalControl.AXES_RFollowingError(1, ref axes.followingErr);
|
||||
|
||||
return libraryError;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
public CmsError GetAxesPositions(out DTOThermoAxesMovModel axes)
|
||||
{
|
||||
CmsError libraryError = NO_ERROR;
|
||||
axes = new DTOThermoAxesMovModel();
|
||||
|
||||
// leggo dal PLC in lobocco i dati...
|
||||
#if fase
|
||||
libraryError = numericalControl.AXES_RInterpPosition(processNum, ref axes.interpolated);
|
||||
if (libraryError.errorCode != 0)
|
||||
return libraryError;
|
||||
#endif
|
||||
|
||||
return libraryError;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// dati assi da CONF
|
||||
/// </summary>
|
||||
/// <param name="axesNames"></param>
|
||||
/// <returns></returns>
|
||||
public CmsError ReadAxisData(out List<DTOAxisNameModel> axesNames)
|
||||
{
|
||||
CmsError libraryError = NO_ERROR;
|
||||
axesNames = new List<DTOAxisNameModel>();
|
||||
List<AxisModel> plcAxes = new List<AxisModel>();
|
||||
// Read selected process
|
||||
ushort selectedProcess = 0;
|
||||
CmsError libraryError = numericalControl.PROC_RSelectedProcess(ref selectedProcess);
|
||||
if (libraryError.IsError())
|
||||
return libraryError;
|
||||
|
||||
if (selectedProcess != 0)
|
||||
axesNames = AxesConfig.Select(x => new DTOAxisNameModel()
|
||||
{
|
||||
// Read axes names
|
||||
libraryError = numericalControl.AXES_RAxesNames(selectedProcess, ref plcAxes);
|
||||
|
||||
axesNames = plcAxes.Select(x => new DTOAxisNameModel()
|
||||
{
|
||||
Id = x.Id,
|
||||
Name = x.Name,
|
||||
IsSelectable = x.IsSelectable,
|
||||
Type = x.Type.ToString()
|
||||
}).ToList();
|
||||
}
|
||||
Id = x.Id,
|
||||
Name = x.Name,
|
||||
IsSelectable = x.IsSelectable,
|
||||
Type = x.Type.ToString()
|
||||
}).ToList();
|
||||
|
||||
return libraryError;
|
||||
}
|
||||
|
||||
@@ -70,6 +70,21 @@ namespace Thermo.Active.Utils
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Conversion string --> TACT_AXIS_TYPE
|
||||
/// </summary>
|
||||
/// <param name="strValue"></param>
|
||||
/// <returns></returns>
|
||||
public static TACT_AXES_TYPE GetTActAxes_Type(string strValue)
|
||||
{
|
||||
TACT_AXES_TYPE answ = TACT_AXES_TYPE.NA;
|
||||
try
|
||||
{
|
||||
answ = (TACT_AXES_TYPE)Enum.Parse(typeof(TACT_AXES_TYPE), strValue);
|
||||
}
|
||||
catch { }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Conversion string --> TACT_MBLOCK_TYPE
|
||||
/// </summary>
|
||||
/// <param name="strValue"></param>
|
||||
|
||||
@@ -64,9 +64,13 @@ namespace Thermo.Active.Listeners
|
||||
{
|
||||
SignalRListener.SendAxesNamesData(a);
|
||||
}));
|
||||
infos.Add(MessageServices.Current.Subscribe(SEND_AXES, (a, b) =>
|
||||
infos.Add(MessageServices.Current.Subscribe(SEND_AXIS_POS, (a, b) =>
|
||||
{
|
||||
SignalRListener.SendAxesToClient(a);
|
||||
SignalRListener.SendThermoAxesPosition(a);
|
||||
}));
|
||||
infos.Add(MessageServices.Current.Subscribe(SEND_AXIS_INFO, (a, b) =>
|
||||
{
|
||||
SignalRListener.SendThermoAxesInfoData(a);
|
||||
}));
|
||||
infos.Add(MessageServices.Current.Subscribe(SEND_ACTIVE_PROGRAM_DATA, (a, b) =>
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ using Thermo.Active.Controllers.SignalR;
|
||||
using Thermo.Active.Model.DTOModels;
|
||||
using Thermo.Active.Model.DTOModels.AlarmModels;
|
||||
using Thermo.Active.Model.DTOModels.Scada;
|
||||
using Thermo.Active.Model.DTOModels.ThAxes;
|
||||
using Thermo.Active.Model.DTOModels.ThModules;
|
||||
using Thermo.Active.Model.DTOModels.ThProd;
|
||||
using Thermo.Active.Model.DTOModels.ThRecipe;
|
||||
@@ -34,16 +35,8 @@ namespace Thermo.Active.Listeners.SignalR
|
||||
}
|
||||
}
|
||||
|
||||
public static void SendAxesToClient(object newAxesData)
|
||||
{
|
||||
if (!LastAxesPositions.Equals(newAxesData))
|
||||
{
|
||||
var context = GlobalHost.ConnectionManager.GetHubContext<NcHub>();
|
||||
LastAxesPositions = newAxesData as DTOAxesModel;
|
||||
|
||||
context.Clients.Group("ncData").axesPositions(newAxesData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void SendPowerOnDataToClient(object powerOnData)
|
||||
{
|
||||
@@ -170,19 +163,6 @@ namespace Thermo.Active.Listeners.SignalR
|
||||
}
|
||||
}
|
||||
|
||||
public static void SendAxesNamesData(object axesNames)
|
||||
{
|
||||
var context = GlobalHost.ConnectionManager.GetHubContext<NcHub>();
|
||||
List<DTOAxisNameModel> newData = axesNames as List<DTOAxisNameModel>;
|
||||
|
||||
// Check if collections are equals
|
||||
if (newData.Count != LastAxesNamesData.Count || !LastAxesNamesData.All(newData.Contains))
|
||||
{
|
||||
LastAxesNamesData = newData;
|
||||
// Send data to clients
|
||||
context.Clients.Group("ncData").axesNames(axesNames);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SendActiveProgramData(object programData)
|
||||
{
|
||||
@@ -481,6 +461,41 @@ namespace Thermo.Active.Listeners.SignalR
|
||||
}
|
||||
|
||||
|
||||
public static void SendAxesNamesData(object axesNames)
|
||||
{
|
||||
var context = GlobalHost.ConnectionManager.GetHubContext<NcHub>();
|
||||
List<DTOAxisNameModel> newData = axesNames as List<DTOAxisNameModel>;
|
||||
|
||||
// Check if collections are equals
|
||||
if (newData.Count != LastAxesNamesData.Count || !LastAxesNamesData.All(newData.Contains))
|
||||
{
|
||||
LastAxesNamesData = newData;
|
||||
// Send data to clients
|
||||
context.Clients.Group("ncData").axesNames(axesNames);
|
||||
}
|
||||
}
|
||||
public static void SendThermoAxesPosition(object newAxesData)
|
||||
{
|
||||
DTOThermoAxesMovModel currAxes = newAxesData as DTOThermoAxesMovModel;
|
||||
if (!LastAxesPositions.Equals(currAxes))
|
||||
{
|
||||
LastAxesPositions = currAxes;
|
||||
|
||||
var context = GlobalHost.ConnectionManager.GetHubContext<NcHub>();
|
||||
context.Clients.Group("ncData").axesPositions(currAxes);
|
||||
}
|
||||
}
|
||||
public static void SendThermoAxesInfoData(object axesInfoData)
|
||||
{
|
||||
DTOAxesInfoModel currInfoAxes = axesInfoData as DTOAxesInfoModel;
|
||||
if (!LastAxesInfoData.Equals(currInfoAxes))
|
||||
{
|
||||
LastAxesInfoData = currInfoAxes;
|
||||
|
||||
var context = GlobalHost.ConnectionManager.GetHubContext<NcHub>();
|
||||
context.Clients.Group("ncData").axesInfo(currInfoAxes);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetGatewayRebootStatus(object status)
|
||||
{
|
||||
@@ -535,6 +550,8 @@ namespace Thermo.Active.Listeners.SignalR
|
||||
group.axesNames(LastAxesNamesData);
|
||||
// Send positions
|
||||
group.axesPositions(LastAxesPositions);
|
||||
// Send info
|
||||
group.axesInfo(LastAxesInfoData);
|
||||
// Send active program data
|
||||
group.activeProgramData(LastProgramData);
|
||||
// Send magazine is active data
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using Thermo.Active.Model.DTOModels;
|
||||
using Thermo.Active.Model.DTOModels.AlarmModels;
|
||||
using Thermo.Active.Model.DTOModels.Scada;
|
||||
using Thermo.Active.Model.DTOModels.ThAxes;
|
||||
using Thermo.Active.Model.DTOModels.ThModules;
|
||||
using Thermo.Active.Model.DTOModels.ThProd;
|
||||
using Thermo.Active.Model.DTOModels.ThRecipe;
|
||||
@@ -22,8 +23,6 @@ namespace Thermo.Active.Listeners
|
||||
public static List<DTOUserSoftKeyModel> LastUserSoftKeysData = new List<DTOUserSoftKeyModel>();
|
||||
public static List<DTONcSoftKeyModel> LastNcSoftKeysData = new List<DTONcSoftKeyModel>();
|
||||
public static List<DTOHeadModel> LastHeadsData = new List<DTOHeadModel>();
|
||||
public static DTOAxesModel LastAxesPositions = new DTOAxesModel();
|
||||
public static List<DTOAxisNameModel> LastAxesNamesData = new List<DTOAxisNameModel>();
|
||||
public static DTOActiveProgramDataModel LastProgramData = new DTOActiveProgramDataModel();
|
||||
public static Dictionary<int, bool> LastNcMagazineIsActive = new Dictionary<int, bool>();
|
||||
public static List<DTOQueueModel> LastPartProgramQueue = new List<DTOQueueModel>();
|
||||
@@ -33,7 +32,7 @@ namespace Thermo.Active.Listeners
|
||||
public static List<DTOM156InputModel> LastM156Data = new List<DTOM156InputModel>();
|
||||
public static List<DTOScadaModel> LastScadaData = new List<DTOScadaModel>();
|
||||
|
||||
// FIXME TODO inserire oggetti corretti per THERMO
|
||||
// Oggetti specifici per THERMO (1° definizione)
|
||||
public static Dictionary<string, DTORecipeParam> LastRecipeFullData = new Dictionary<string, DTORecipeParam>();
|
||||
public static Dictionary<RecipeSection, RecipeCatStatus> LastRecipeOverData = new Dictionary<RecipeSection, RecipeCatStatus>();
|
||||
public static bool? recipeHasChanged = null;
|
||||
@@ -44,6 +43,10 @@ namespace Thermo.Active.Listeners
|
||||
public static ThermoModels.ProdCycleModel LastProdCycleData = new ThermoModels.ProdCycleModel();
|
||||
public static DTOProdInfo LastProdInfoData = new DTOProdInfo();
|
||||
public static DTOThermoPanelProd LastProdPanelData = new DTOThermoPanelProd();
|
||||
// Oggetti per assi THERMO
|
||||
public static List<DTOAxisNameModel> LastAxesNamesData = new List<DTOAxisNameModel>();
|
||||
public static DTOAxesInfoModel LastAxesInfoData = new DTOAxesInfoModel();
|
||||
public static DTOThermoAxesMovModel LastAxesPositions = new DTOThermoAxesMovModel();
|
||||
|
||||
public static bool LastIsNcConnected = false;
|
||||
}
|
||||
|
||||
@@ -30,4 +30,4 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("0.15.87")]
|
||||
[assembly: AssemblyVersion("0.15.88")]
|
||||
Reference in New Issue
Block a user