Implement CurrentLimiter and spare power mode
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
string HostAddress { get; set; }
|
||||
int Port { get; set; }
|
||||
|
||||
(double I1, double I2, double I3) GetCurrents();
|
||||
|
||||
void SetLoadingCurrent(double value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using NModbus;
|
||||
using System.ComponentModel.Design.Serialization;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace TestApp.Driver
|
||||
@@ -83,6 +84,21 @@ namespace TestApp.Driver
|
||||
}
|
||||
}
|
||||
|
||||
public (double I1, double I2, double I3) GetCurrents()
|
||||
{
|
||||
if (_Modbus is null)
|
||||
{
|
||||
Connect();
|
||||
}
|
||||
if (_Modbus is null) { return (double.NaN, double.NaN, double.NaN); }
|
||||
|
||||
var i1 = _Modbus.ReadHoldingRegisters(255, 1008, 1)[0];
|
||||
var i2 = _Modbus.ReadHoldingRegisters(255, 1010, 1)[0];
|
||||
var i3 = _Modbus.ReadHoldingRegisters(255, 1012, 1)[0];
|
||||
|
||||
return (0.001 * i1, 0.001 * i2, 0.001 * i3);
|
||||
}
|
||||
|
||||
public void SetLoadingCurrent(double value)
|
||||
{
|
||||
if (!_Running) { return; }
|
||||
|
||||
Reference in New Issue
Block a user