|
@@ -1,7 +1,4 @@
|
|
-using System;
|
|
|
|
-using System.Collections.Generic;
|
|
|
|
-using System.Threading;
|
|
|
|
-using Aitex.Core.RT.DataCenter;
|
|
|
|
|
|
+using Aitex.Core.RT.DataCenter;
|
|
using Aitex.Core.RT.Device;
|
|
using Aitex.Core.RT.Device;
|
|
using Aitex.Core.RT.Event;
|
|
using Aitex.Core.RT.Event;
|
|
using Aitex.Core.RT.Log;
|
|
using Aitex.Core.RT.Log;
|
|
@@ -9,7 +6,9 @@ using Aitex.Core.RT.OperationCenter;
|
|
using Aitex.Core.RT.SCCore;
|
|
using Aitex.Core.RT.SCCore;
|
|
using Aitex.Core.Util;
|
|
using Aitex.Core.Util;
|
|
using MECF.Framework.Common.Communications;
|
|
using MECF.Framework.Common.Communications;
|
|
-using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.FFUs.MayAir;
|
|
|
|
|
|
+using System;
|
|
|
|
+using System.Collections.Generic;
|
|
|
|
+using System.Threading;
|
|
|
|
|
|
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.FFUs.AAF
|
|
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.FFUs.AAF
|
|
{
|
|
{
|
|
@@ -47,7 +46,7 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.FFUs.AAF
|
|
{
|
|
{
|
|
get
|
|
get
|
|
{
|
|
{
|
|
- if(SC.ContainsItem($"{_scRoot}.{Name}.EnableLogMessage"))
|
|
|
|
|
|
+ if (SC.ContainsItem($"{_scRoot}.{Name}.EnableLogMessage"))
|
|
return SC.GetValue<bool>($"{_scRoot}.{Name}.EnableLogMessage");
|
|
return SC.GetValue<bool>($"{_scRoot}.{Name}.EnableLogMessage");
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
@@ -78,7 +77,7 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.FFUs.AAF
|
|
}
|
|
}
|
|
|
|
|
|
public string Address
|
|
public string Address
|
|
- {get;set; }
|
|
|
|
|
|
+ { get; set; }
|
|
|
|
|
|
public bool IsConnected
|
|
public bool IsConnected
|
|
{
|
|
{
|
|
@@ -112,7 +111,7 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.FFUs.AAF
|
|
_ffuCount = ffucount;
|
|
_ffuCount = ffucount;
|
|
}
|
|
}
|
|
|
|
|
|
- ~FfuAAF()
|
|
|
|
|
|
+ ~FfuAAF()
|
|
{
|
|
{
|
|
_connection.Disconnect();
|
|
_connection.Disconnect();
|
|
|
|
|
|
@@ -134,15 +133,15 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.FFUs.AAF
|
|
|
|
|
|
public void QuerySpeed()
|
|
public void QuerySpeed()
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+
|
|
_lstHandler.AddLast(new FfuAAFQuerySpeedHandler(this, 1, 1));
|
|
_lstHandler.AddLast(new FfuAAFQuerySpeedHandler(this, 1, 1));
|
|
|
|
|
|
if (_ffuCount == 2)
|
|
if (_ffuCount == 2)
|
|
- {
|
|
|
|
|
|
+ {
|
|
_lstHandler.AddLast(new FfuAAFQuerySpeedHandler(this, 3, 1));
|
|
_lstHandler.AddLast(new FfuAAFQuerySpeedHandler(this, 3, 1));
|
|
}
|
|
}
|
|
if (_ffuCount == 3)
|
|
if (_ffuCount == 3)
|
|
- {
|
|
|
|
|
|
+ {
|
|
_lstHandler.AddLast(new FfuAAFQuerySpeedHandler(this, 5, 1));
|
|
_lstHandler.AddLast(new FfuAAFQuerySpeedHandler(this, 5, 1));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -174,7 +173,7 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.FFUs.AAF
|
|
int address = SC.GetValue<int>($"{_scRoot}.{Name}.DeviceAddress");
|
|
int address = SC.GetValue<int>($"{_scRoot}.{Name}.DeviceAddress");
|
|
|
|
|
|
_deviceAddress = address.ToString("D3");
|
|
_deviceAddress = address.ToString("D3");
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
_nMaxSpeed = SC.GetValue<int>($"{_scRoot}.{Name}.MaxSpeed");
|
|
_nMaxSpeed = SC.GetValue<int>($"{_scRoot}.{Name}.MaxSpeed");
|
|
_connection = new FfuAAFConnection(portName);
|
|
_connection = new FfuAAFConnection(portName);
|
|
@@ -245,7 +244,7 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.FFUs.AAF
|
|
OP.Subscribe("FFU1.SetFFUSpeedBySC", (cmd, param) =>
|
|
OP.Subscribe("FFU1.SetFFUSpeedBySC", (cmd, param) =>
|
|
{
|
|
{
|
|
int speed = SC.GetValue<int>("System.FFU1FanSpeedSetPoint");
|
|
int speed = SC.GetValue<int>("System.FFU1FanSpeedSetPoint");
|
|
- SetSpeed(speed,1);
|
|
|
|
|
|
+ SetSpeed(speed, 1);
|
|
EV.PostInfoLog(Module, "Set FFU1 speed");
|
|
EV.PostInfoLog(Module, "Set FFU1 speed");
|
|
return true;
|
|
return true;
|
|
});
|
|
});
|
|
@@ -260,7 +259,7 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.FFUs.AAF
|
|
|
|
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
private bool OnTimer()
|
|
private bool OnTimer()
|
|
{
|
|
{
|
|
try
|
|
try
|
|
@@ -275,7 +274,7 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.FFUs.AAF
|
|
{
|
|
{
|
|
_lstHandler.Clear();
|
|
_lstHandler.Clear();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (_trigRetryConnect.Q)
|
|
if (_trigRetryConnect.Q)
|
|
{
|
|
{
|
|
_connection.SetPortAddress(SC.GetStringValue($"{_scRoot}.{Name}.Address"));
|
|
_connection.SetPortAddress(SC.GetStringValue($"{_scRoot}.{Name}.Address"));
|
|
@@ -287,23 +286,23 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.FFUs.AAF
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
if (_lstHandler.Count == 0)
|
|
if (_lstHandler.Count == 0)
|
|
{
|
|
{
|
|
- lock(_locker)
|
|
|
|
|
|
+ lock (_locker)
|
|
QuerySpeed();
|
|
QuerySpeed();
|
|
}
|
|
}
|
|
if (!_connection.IsBusy)
|
|
if (!_connection.IsBusy)
|
|
{
|
|
{
|
|
HandlerBase handler = null;
|
|
HandlerBase handler = null;
|
|
lock (_locker)
|
|
lock (_locker)
|
|
- {
|
|
|
|
|
|
+ {
|
|
|
|
|
|
if (_lstHandler.Count > 0)
|
|
if (_lstHandler.Count > 0)
|
|
{
|
|
{
|
|
handler = _lstHandler.First.Value;
|
|
handler = _lstHandler.First.Value;
|
|
_lstHandler.RemoveFirst();
|
|
_lstHandler.RemoveFirst();
|
|
- }
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if (handler != null)
|
|
if (handler != null)
|
|
@@ -347,14 +346,14 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.FFUs.AAF
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
public void SetSpeed(float speed)
|
|
public void SetSpeed(float speed)
|
|
{
|
|
{
|
|
lock (_locker)
|
|
lock (_locker)
|
|
{
|
|
{
|
|
- _lstHandler.AddFirst(new FfuAAFSetSpeedHandler(this, 0, 1, Convert.ToInt32(speed)));
|
|
|
|
|
|
+ _lstHandler.AddFirst(new FfuAAFSetSpeedHandler(this, 1, 1, Convert.ToInt32(speed)));
|
|
|
|
|
|
//_lstHandler.Clear();
|
|
//_lstHandler.Clear();
|
|
//if (_connection.IsBusy) _connection.ForceClear();
|
|
//if (_connection.IsBusy) _connection.ForceClear();
|
|
@@ -366,19 +365,14 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.FFUs.AAF
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public void SetSpeed(float speed,int ffuAddress)
|
|
|
|
|
|
+ public void SetSpeed(float speed, int ffuAddress)
|
|
{
|
|
{
|
|
lock (_locker)
|
|
lock (_locker)
|
|
{
|
|
{
|
|
_lstHandler.AddFirst(new FfuAAFSetSpeedHandler(this, ffuAddress, 1, Convert.ToInt32(speed)));
|
|
_lstHandler.AddFirst(new FfuAAFSetSpeedHandler(this, ffuAddress, 1, Convert.ToInt32(speed)));
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
//_lstHandler.Clear();
|
|
//_lstHandler.Clear();
|
|
//if (_connection.IsBusy) _connection.ForceClear();
|
|
//if (_connection.IsBusy) _connection.ForceClear();
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
//List<byte> cmddata = new List<byte>() { 0x35, (byte)(0x40+ ffuAddress), 0x01, (byte)(speed * 250 / _nMaxSpeed) };
|
|
//List<byte> cmddata = new List<byte>() { 0x35, (byte)(0x40+ ffuAddress), 0x01, (byte)(speed * 250 / _nMaxSpeed) };
|
|
//byte checksum = ModRTU_CRC(cmddata.ToArray());
|
|
//byte checksum = ModRTU_CRC(cmddata.ToArray());
|
|
//cmddata.Add(checksum);
|
|
//cmddata.Add(checksum);
|