Merge branch 'main' of 91.92.155.224:Innovenergy/Innovenergy_trunk
This commit is contained in:
commit
c19db1519d
|
@ -21,6 +21,6 @@ rsync -v \
|
|||
./bin/Release/$dotnet_version/linux-x64/publish/* \
|
||||
$username@"$salimax_ip":~/salimax
|
||||
|
||||
#echo -e "\n============================ Execute ============================\n"
|
||||
echo -e "\n============================ Execute ============================\n"
|
||||
|
||||
#sshpass -p "$root_password" ssh -o StrictHostKeyChecking=no -t "$username"@"$salimax_ip" "echo '$root_password' | sudo -S sh -c 'cd salimax && ./restart'" 2>/dev/null
|
||||
sshpass -p "$root_password" ssh -o StrictHostKeyChecking=no -t "$username"@"$salimax_ip" "echo '$root_password' | sudo -S sh -c 'cd salimax && ./restart'" 2>/dev/null
|
||||
|
|
|
@ -195,9 +195,9 @@ public static class Controller
|
|||
var mustDoCalibrationCharge = calibrationChargeForced == CalibrationChargeType.ChargePermanently ||
|
||||
(calibrationChargeForced == CalibrationChargeType.AdditionallyOnce && additionalCalibrationRequired) ||
|
||||
(calibrationChargeForced == CalibrationChargeType.RepetitivelyEvery && repetitiveCalibrationRequired);
|
||||
|
||||
Console.WriteLine("Next Repetitive calibration charge date is "+statusRecord.Config.DayAndTimeForRepetitiveCalibration);
|
||||
Console.WriteLine("Next Additional calibration charge date is "+statusRecord.Config.DayAndTimeForAdditionalCalibration);
|
||||
//Console.WriteLine("Time now is "+DateTime.Now);
|
||||
|
||||
if (statusRecord.Battery is not null)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define Amax
|
||||
#undef Amax
|
||||
#undef GridLimit
|
||||
|
||||
using System.IO.Compression;
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
using System.Reflection;
|
||||
using InnovEnergy.Lib.Victron.VeDBus;
|
||||
|
||||
namespace InnovEnergy.App.SchneiderDriver;
|
||||
|
||||
public static class Config
|
||||
{
|
||||
public const String Version = "1.0";
|
||||
public const String BusName = "com.victronenergy.grid.Schnieder";
|
||||
public const Byte ModbusNodeId = 1;
|
||||
public const String OwnAddress = "10.0.0.1";
|
||||
public const String PeerAddress = "10.0.0.2";
|
||||
//public const String PeerAddress = "127.0.0.1";
|
||||
public const UInt16 PeerPort = 502;
|
||||
|
||||
public static TimeSpan TcpTimeout { get; } = TimeSpan.FromSeconds(2);
|
||||
|
||||
|
||||
public static readonly TimeSpan UpdatePeriod = TimeSpan.FromSeconds(1);
|
||||
|
||||
public static readonly IReadOnlyList<Signal> Signals = new Signal[]
|
||||
{
|
||||
// new(s => s..CurrentL1, "/Ac/L1/Current", "0.0 A"),
|
||||
// new(s => s..CurrentL2, "/Ac/L2/Current", "0.0 A"),
|
||||
// new(s => s..CurrentL3, "/Ac/L3/Current", "0.0 A"),
|
||||
// new(s => s..CurrentL1 + s.Ac.L2.Current + s.Ac.L3.Current, "/Ac/Current", "0.0 A"),
|
||||
|
||||
// new(s => s.Ac.L1.Voltage, "/Ac/L1/Voltage", "0.0 A"),
|
||||
// new(s => s.Ac.L2.Voltage, "/Ac/L2/Voltage", "0.0 A"),
|
||||
// new(s => s.Ac.L3.Voltage, "/Ac/L3/Voltage", "0.0 A"),
|
||||
// new(s => (s.Ac.L1.Voltage + s.Ac.L2.Voltage + s.Ac.L3.Voltage) / 3.0m, "/Ac/Voltage", "0.0 A"),
|
||||
|
||||
new(s => s.ActivePowerL1, "/Ac/L1/Power", "0 W"),
|
||||
new(s => s.ActivePowerL2, "/Ac/L2/Power", "0 W"),
|
||||
new(s => s.ActivePowerL3, "/Ac/L3/Power", "0 W"),
|
||||
new(s => (s.ActivePowerL1 + s.ActivePowerL2 + s.ActivePowerL3), "/Ac/Power", "0 W"),
|
||||
|
||||
// new(s => s.EnergyImportL123, "Ac/Energy/Forward", "0.00 kWh"),
|
||||
// new(s => s.EnergyExportL123, "Ac/Energy/Reverse", "0.00 kWh"),
|
||||
//
|
||||
// new(s => s.EnergyImportL1, "Ac/L1/Energy/Forward", "0.00 kWh"),
|
||||
// new(s => s.EnergyExportL1, "Ac/L1/Energy/Reverse", "0.00 kWh"),
|
||||
//
|
||||
// new(s => s.EnergyImportL2, "Ac/L2/Energy/Forward", "0.00 kWh"),
|
||||
// new(s => s.EnergyExportL2, "Ac/L2/Energy/Reverse", "0.00 kWh"),
|
||||
//
|
||||
// new(s => s.EnergyImportL3, "Ac/L3/Energy/Forward", "0.00 kWh"),
|
||||
// new(s => s.EnergyExportL3, "Ac/L3/Energy/Reverse", "0.00 kWh"),
|
||||
};
|
||||
|
||||
public static VeProperties DefaultProperties => new VeProperties
|
||||
{
|
||||
new("/ProductName" , "Grid meter" ),
|
||||
new("/CustomName" , "Schneider Professional II"),
|
||||
new("/DeviceInstance" , 30),
|
||||
new("/DeviceType" , 72),
|
||||
new("/Mgmt/Connection" , "Modbus TCP"),
|
||||
new("/Mgmt/ProcessName" , Assembly.GetEntryAssembly()?.Location ?? "unknown"),
|
||||
new("/Mgmt/ProcessVersion", Version),
|
||||
new("/Connected" , 1),
|
||||
new("/ProductId" , 45058, "b002"),
|
||||
new("/Role" , "grid"),
|
||||
};
|
||||
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
using System.Text.Json.Nodes;
|
||||
using CliWrap;
|
||||
using CliWrap.Buffered;
|
||||
|
||||
namespace InnovEnergy.App.SchneiderDriver;
|
||||
|
||||
public readonly struct Nic
|
||||
{
|
||||
private static Command IpCommand { get; } = Cli
|
||||
.Wrap("/sbin/ip")
|
||||
.WithValidation(CommandResultValidation.None);
|
||||
|
||||
private readonly JsonNode _Node;
|
||||
|
||||
private Nic(JsonNode node)
|
||||
{
|
||||
_Node = node;
|
||||
}
|
||||
|
||||
public Boolean IsEthernet
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return _Node["link_type"]!.GetValue<String>() == "ether";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean IsUp
|
||||
{
|
||||
get
|
||||
{
|
||||
// ReSharper disable once StringLiteralTypo
|
||||
try
|
||||
{
|
||||
return _Node["operstate"]!.GetValue<String>() == "UP";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IReadOnlyList<String> Ip4Addresses
|
||||
{
|
||||
get
|
||||
{
|
||||
// ReSharper disable once StringLiteralTypo
|
||||
try
|
||||
{
|
||||
return _Node["addr_info"]!
|
||||
.AsArray()
|
||||
.TryWhere(n => n!["family"]!.GetValue<String>() == "inet")
|
||||
.TrySelect(n => n!["local"]!.GetValue<String>())
|
||||
.ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Array.Empty<String>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String Name
|
||||
{
|
||||
get
|
||||
{
|
||||
// ReSharper disable once StringLiteralTypo
|
||||
try
|
||||
{
|
||||
return _Node["ifname"]!.GetValue<String>();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "<NO_NAME>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task<Boolean> AddPointToPoint(String sourceAddress, String destinationAddress)
|
||||
{
|
||||
var result = await IpCommand
|
||||
.WithArguments($"address add local {sourceAddress} peer {destinationAddress} dev {Name}")
|
||||
.ExecuteAsync();
|
||||
|
||||
return result.ExitCode == 0;
|
||||
}
|
||||
|
||||
public async Task<Boolean> RemoveAddress(String address)
|
||||
{
|
||||
var result = await IpCommand
|
||||
.WithArguments($"address del {address} dev {Name}")
|
||||
.ExecuteBufferedAsync();
|
||||
|
||||
return result.ExitCode == 0;
|
||||
}
|
||||
|
||||
|
||||
public async Task<Boolean> AddRoute(String route)
|
||||
{
|
||||
var result = await IpCommand
|
||||
.WithArguments($"route add {route} dev {Name}")
|
||||
.ExecuteAsync();
|
||||
|
||||
return result.ExitCode == 0;
|
||||
}
|
||||
|
||||
public async Task<Boolean> RemoveRoute(String route)
|
||||
{
|
||||
var result = await IpCommand
|
||||
.WithArguments($"route del {route} dev {Name}")
|
||||
.ExecuteAsync();
|
||||
|
||||
return result.ExitCode == 0;
|
||||
}
|
||||
|
||||
|
||||
public static async Task<IReadOnlyList<Nic>> GetNetworkInterfaces()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
var result = await IpCommand
|
||||
.WithArguments("-details -pretty -json address")
|
||||
.ExecuteBufferedAsync();
|
||||
|
||||
return JsonNode
|
||||
.Parse(result.StandardOutput)!
|
||||
.AsArray()
|
||||
.Where(n => n != null)
|
||||
.Select(n => new Nic(n!))
|
||||
.ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Array.Empty<Nic>();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
using InnovEnergy.App.SchneiderDriver;
|
||||
using InnovEnergy.Lib.Protocols.DBus;
|
||||
using InnovEnergy.Lib.Utils;
|
||||
using InnovEnergy.Lib.Utils.Net;
|
||||
|
||||
|
||||
// dotnet publish EmuMeter.csproj -c Release -r linux-arm -p:PublishSingleFile=true --self-contained true && \
|
||||
// rsync -av bin/Release/net6.0/linux-arm/publish/ root@10.2.1.6:/home/root/emu && clear && \
|
||||
// ssh root@10.2.1.6 /home/root/emu/EmuMeter
|
||||
|
||||
|
||||
Console.WriteLine("Starting Schneider Driver " + Config.Version);
|
||||
|
||||
var networkInterfaces = await Nic.GetNetworkInterfaces();
|
||||
|
||||
var candidates = networkInterfaces.Where(n => n.IsUp &&
|
||||
n.IsEthernet &&
|
||||
(!n.Ip4Addresses.Any() || n.Ip4Addresses.Contains(Config.OwnAddress)));
|
||||
|
||||
foreach (var nic in candidates)
|
||||
{
|
||||
Console.WriteLine($"Found new network interface: {nic.Name}");
|
||||
|
||||
if (!nic.Ip4Addresses.Contains(Config.OwnAddress))
|
||||
{
|
||||
Console.WriteLine($"Configuring Point-to-Point connection on {nic.Name}");
|
||||
Console.WriteLine($" own address: {Config.OwnAddress}");
|
||||
Console.WriteLine($" peer address: {Config.PeerAddress}");
|
||||
|
||||
var success = await nic.AddPointToPoint($"{Config.OwnAddress}/16", $"{Config.PeerAddress}/16");
|
||||
|
||||
if (!success)
|
||||
{
|
||||
Console.WriteLine($"Failed to configure network interface: {nic.Name}");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine($"Pinging peer @ {Config.PeerAddress}");
|
||||
|
||||
var ping = await Config.PeerAddress.Ping();
|
||||
|
||||
if (ping)
|
||||
{
|
||||
Console.WriteLine($"Got answer from {Config.PeerAddress}");
|
||||
var ex = await SchneiderMeterDriver.Run($"{Config.PeerAddress}:{Config.PeerPort}", Bus.System);
|
||||
|
||||
Console.WriteLine($"{nameof(SchneiderMeterDriver)} FAILED with\n{ex}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"No answer from {Config.PeerAddress}");
|
||||
}
|
||||
|
||||
Console.Write($"Removing Point-to-Point connection on {nic.Name} ...");
|
||||
var removed = await nic.RemoveAddress($"{Config.OwnAddress}/16");
|
||||
Console.WriteLine(removed ? "done" : "failed");
|
||||
}
|
||||
|
||||
Console.WriteLine("Stopping SchneiderMeter Driver");
|
|
@ -0,0 +1,66 @@
|
|||
using System.Reactive.Linq;
|
||||
using InnovEnergy.Lib.Devices.IEM3kGridMeter;
|
||||
using InnovEnergy.Lib.Protocols.DBus;
|
||||
using InnovEnergy.Lib.Protocols.Modbus.Clients;
|
||||
using InnovEnergy.Lib.Utils;
|
||||
using InnovEnergy.Lib.Victron.VeDBus;
|
||||
|
||||
namespace InnovEnergy.App.SchneiderDriver;
|
||||
|
||||
public static class SchneiderMeterDriver
|
||||
{
|
||||
public static Task<Exception> Run(String hostName, Bus dbusAddress)
|
||||
{
|
||||
return Run(hostName, ModbusTcpClient.DefaultPort, dbusAddress);
|
||||
}
|
||||
|
||||
public static async Task<Exception> Run(String hostName, UInt16 port, Bus dbusAddress)
|
||||
{
|
||||
// var ep = new UnixDomainSocketEndPoint("/home/eef/graber_dbus.sock");
|
||||
// var auth = AuthenticationMethod.ExternalAsRoot();
|
||||
// dbusAddress = new Bus(ep, auth);
|
||||
|
||||
var schnieder = new Iem3KGridMeterDevice(hostName, port, Config.ModbusNodeId);
|
||||
|
||||
|
||||
var schniederStatus = Observable
|
||||
.Interval(Config.UpdatePeriod)
|
||||
.Select(_ => schnieder.Read())
|
||||
.Publish();
|
||||
|
||||
var poller = schniederStatus.Connect();
|
||||
|
||||
var properties = Config.DefaultProperties;
|
||||
|
||||
var signals = Config
|
||||
.Signals
|
||||
.Select(signal => schniederStatus.Select(signal.ToVeProperty))
|
||||
.Merge()
|
||||
.Do(p => properties.Set(p));
|
||||
|
||||
// TODO: remove when possible
|
||||
// Apparently some VE services need to be periodically reminded that
|
||||
// this service is /Connected
|
||||
schniederStatus.Subscribe(_ => properties.Set("/Connected", 1));
|
||||
|
||||
// Wait until status is read once to make sure all
|
||||
// properties are set when we go onto the bus.
|
||||
var dbus = schniederStatus
|
||||
.Skip(1)
|
||||
.Take(1)
|
||||
.SelectMany(_ => PublishPropertiesOnDBus(properties, dbusAddress));
|
||||
|
||||
return await signals
|
||||
.MergeErrors(dbus)
|
||||
.Finally(poller.Dispose)
|
||||
.SelectErrors();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static Task<Exception> PublishPropertiesOnDBus(VeProperties properties, Bus bus)
|
||||
{
|
||||
Console.WriteLine($"Connecting to DBus {bus}");
|
||||
return properties.PublishOnDBus(bus, Config.BusName);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>InnovEnergy.App.SchneiderDriver</RootNamespace>
|
||||
<AssemblyName>SchniederDriver</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="../InnovEnergy.App.props" />
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../../Lib/Devices/EmuMeter/EmuMeter.csproj" />
|
||||
<ProjectReference Include="../../Lib/Protocols/DBus/DBus.csproj" />
|
||||
<ProjectReference Include="../../Lib/Protocols/Modbus/Modbus.csproj" />
|
||||
<ProjectReference Include="../../Lib/Utils/Utils.csproj" />
|
||||
<ProjectReference Include="../../Lib/Victron/VeDBus/VeDBus.csproj" />
|
||||
<ProjectReference Include="..\..\Lib\Devices\IEM3kGridMeter\IEM3kGridMeter.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CliWrap" Version="3.6.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,16 @@
|
|||
using InnovEnergy.Lib.Devices.IEM3kGridMeter;
|
||||
using InnovEnergy.Lib.Protocols.DBus.Protocol.DataTypes;
|
||||
using InnovEnergy.Lib.Victron.VeDBus;
|
||||
|
||||
namespace InnovEnergy.App.SchneiderDriver;
|
||||
|
||||
|
||||
// TODO: Does not compile
|
||||
public record Signal(Func<Iem3KGridMeterRegisters, Object> Source, ObjectPath Path, String Format = "")
|
||||
{
|
||||
public VeProperty ToVeProperty(Iem3KGridMeterRegisters status)
|
||||
{
|
||||
var value = Source(status);
|
||||
return new VeProperty(Path, value, String.Format($"{{0:{Format}}}", value));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
namespace InnovEnergy.App.SchneiderDriver;
|
||||
|
||||
public static class Utils
|
||||
{
|
||||
public static IEnumerable<T> TryWhere<T>(this IEnumerable<T> src, Func<T, Boolean> predicate)
|
||||
{
|
||||
foreach (var e in src)
|
||||
{
|
||||
var ok = false;
|
||||
|
||||
try
|
||||
{
|
||||
ok = predicate(e);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
if (ok)
|
||||
yield return e;
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<R> TrySelect<T,R>(this IEnumerable<T> src, Func<T, R> map)
|
||||
{
|
||||
foreach (var e in src)
|
||||
{
|
||||
var ok = false;
|
||||
var result = default(R);
|
||||
|
||||
try
|
||||
{
|
||||
result = map(e);
|
||||
ok = true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
if (ok)
|
||||
yield return result!;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
csproj="SchneiderMeterDriver.csproj"
|
||||
exe="SchneiderMeterDriver"
|
||||
#remote="10.2.1.6"
|
||||
remote="10.2.4.155"
|
||||
|
||||
netVersion="net6.0"
|
||||
platform="linux-arm"
|
||||
config="Release"
|
||||
host="root@$remote"
|
||||
dir="/opt/victronenergy/$exe"
|
||||
|
||||
set -e
|
||||
|
||||
dotnet publish "$csproj" -c $config -r $platform -p:SuppressTrimmAnalysisWarnings=true -p:PublishSingleFile=true -p:PublishTrimmed=true -p:DebugType=None -p:DebugSymbols=false --self-contained true
|
||||
rsync -av "bin/$config/$netVersion/$platform/publish/" "$host:$dir"
|
||||
#clear
|
||||
#ssh "$host" "$dir/$exe"
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
namespace InnovEnergy.App.SchniederDriver;
|
||||
|
||||
public static class Utils
|
||||
{
|
||||
public static IEnumerable<T> TryWhere<T>(this IEnumerable<T> src, Func<T, Boolean> predicate)
|
||||
{
|
||||
foreach (var e in src)
|
||||
{
|
||||
var ok = false;
|
||||
|
||||
try
|
||||
{
|
||||
ok = predicate(e);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
if (ok)
|
||||
yield return e;
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<R> TrySelect<T,R>(this IEnumerable<T> src, Func<T, R> map)
|
||||
{
|
||||
foreach (var e in src)
|
||||
{
|
||||
var ok = false;
|
||||
var result = default(R);
|
||||
|
||||
try
|
||||
{
|
||||
result = map(e);
|
||||
ok = true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
if (ok)
|
||||
yield return result!;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
exec 2>&1
|
||||
exec multilog t s25000 n4 /var/log/EmuMeter
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
exec 2>&1
|
||||
exec softlimit -d 100000000 -s 1000000 -a 100000000 /opt/innovenergy/EmuMeter/EmuMeter
|
|
@ -87,6 +87,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Doepke", "Lib\Devices\Doepk
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Amax5070", "Lib\Devices\Amax5070\Amax5070.csproj", "{09E280B0-43D3-47BD-AF15-CF4FCDD24FE6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sofar", "App\Sofar\Sofar.csproj", "{6B98449D-BF75-415A-8893-E49518F9307D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SofarInverter", "Lib\Devices\SofarInverter\SofarInverter.csproj", "{2C7F3D89-402B-43CB-988E-8D2D853BEF44}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchneiderMeterDriver", "App\SchneiderMeterDriver\SchneiderMeterDriver.csproj", "{2E7E7657-3A53-4B62-8927-FE9A082B81DE}"
|
||||
EndProject
|
||||
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -226,6 +232,18 @@ Global
|
|||
{09E280B0-43D3-47BD-AF15-CF4FCDD24FE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{09E280B0-43D3-47BD-AF15-CF4FCDD24FE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{09E280B0-43D3-47BD-AF15-CF4FCDD24FE6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6B98449D-BF75-415A-8893-E49518F9307D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6B98449D-BF75-415A-8893-E49518F9307D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6B98449D-BF75-415A-8893-E49518F9307D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6B98449D-BF75-415A-8893-E49518F9307D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2C7F3D89-402B-43CB-988E-8D2D853BEF44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2C7F3D89-402B-43CB-988E-8D2D853BEF44}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2C7F3D89-402B-43CB-988E-8D2D853BEF44}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2C7F3D89-402B-43CB-988E-8D2D853BEF44}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2E7E7657-3A53-4B62-8927-FE9A082B81DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2E7E7657-3A53-4B62-8927-FE9A082B81DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2E7E7657-3A53-4B62-8927-FE9A082B81DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2E7E7657-3A53-4B62-8927-FE9A082B81DE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{CF4834CB-91B7-4172-AC13-ECDA8613CD17} = {145597B4-3E30-45E6-9F72-4DD43194539A}
|
||||
|
@ -265,5 +283,8 @@ Global
|
|||
{73B97F6E-2BDC-40DA-84A7-7FB0264387D6} = {AD5B98A8-AB7F-4DA2-B66D-5B4E63E7D854}
|
||||
{C2B14CD4-1BCA-4933-96D9-92F40EACD2B9} = {4931A385-24DC-4E78-BFF4-356F8D6D5183}
|
||||
{09E280B0-43D3-47BD-AF15-CF4FCDD24FE6} = {4931A385-24DC-4E78-BFF4-356F8D6D5183}
|
||||
{6B98449D-BF75-415A-8893-E49518F9307D} = {145597B4-3E30-45E6-9F72-4DD43194539A}
|
||||
{2C7F3D89-402B-43CB-988E-8D2D853BEF44} = {4931A385-24DC-4E78-BFF4-356F8D6D5183}
|
||||
{2E7E7657-3A53-4B62-8927-FE9A082B81DE} = {145597B4-3E30-45E6-9F72-4DD43194539A}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -10,8 +10,8 @@ public class Iem3KGridMeterDevice: ModbusDevice<Iem3KGridMeterRegisters>
|
|||
public Iem3KGridMeterDevice(String hostname, UInt16 port = 502, Byte slaveId = 1) : this(new TcpChannel(hostname, port), slaveId)
|
||||
{
|
||||
}
|
||||
|
||||
public Iem3KGridMeterDevice(Channel channel, Byte slaveId = 1) : base(new ModbusTcpClient(channel, slaveId))
|
||||
|
||||
private Iem3KGridMeterDevice(Channel channel, Byte slaveId = 1) : base(new ModbusTcpClient(channel, slaveId))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -47,4 +47,6 @@ public class Iem3KGridMeterDevice: ModbusDevice<Iem3KGridMeterRegisters>
|
|||
$"Failed to write data to {nameof(Iem3KGridMeterDevice)}".WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -12,25 +12,25 @@ using Float32 = Single;
|
|||
|
||||
|
||||
[AddressOffset(-2)] // why?
|
||||
public class Iem3KGridMeterRegisters : IAc3Meter
|
||||
public class Iem3KGridMeterRegisters //: IAc3Meter
|
||||
{
|
||||
private const Float32 ZeroBecauseReactivePowerNotSupported = 0;
|
||||
|
||||
// TODO
|
||||
|
||||
[HoldingRegister<Float32>(3054)] private Float32 _ActivePowerL1;
|
||||
[HoldingRegister<Float32>(3056)] private Float32 _ActivePowerL2;
|
||||
[HoldingRegister<Float32>(3058)] private Float32 _ActivePowerL3;
|
||||
[HoldingRegister<Float32>(3054)] public Float32 ActivePowerL1;
|
||||
[HoldingRegister<Float32>(3056)] public Float32 ActivePowerL2;
|
||||
[HoldingRegister<Float32>(3058)] public Float32 ActivePowerL3;
|
||||
|
||||
[HoldingRegister<Float32>(3000)] private Float32 _CurrentL1;
|
||||
[HoldingRegister<Float32>(3002)] private Float32 _CurrentL2;
|
||||
[HoldingRegister<Float32>(3004)] private Float32 _CurrentL3;
|
||||
|
||||
[HoldingRegister<Float32>(3028)] private Float32 _VoltageL1N;
|
||||
[HoldingRegister<Float32>(3030)] private Float32 _VoltageL2N;
|
||||
[HoldingRegister<Float32>(3032)] private Float32 _VoltageL3N;
|
||||
|
||||
[HoldingRegister<Float32>(3110)] private Float32 _Frequency;
|
||||
//[HoldingRegister<Float32>(3000)] private Float32 _CurrentL1;
|
||||
//[HoldingRegister<Float32>(3002)] private Float32 _CurrentL2;
|
||||
//[HoldingRegister<Float32>(3004)] private Float32 _CurrentL3;
|
||||
//
|
||||
//[HoldingRegister<Float32>(3028)] private Float32 _VoltageL1N;
|
||||
//[HoldingRegister<Float32>(3030)] private Float32 _VoltageL2N;
|
||||
//[HoldingRegister<Float32>(3032)] private Float32 _VoltageL3N;
|
||||
//
|
||||
//[HoldingRegister<Float32>(3110)] private Float32 _Frequency;
|
||||
|
||||
//[HoldingRegister<Float32>(9012)] private Float32 _ReactivePowerL1;
|
||||
//[HoldingRegister<Float32>(9014)] private Float32 _ReactivePowerL2;
|
||||
|
@ -45,7 +45,7 @@ public class Iem3KGridMeterRegisters : IAc3Meter
|
|||
//[HoldingRegister<Float32>(9026)] private Float32 _ApparentPowerL3;
|
||||
|
||||
|
||||
public Ac3Bus Ac => new Ac3Bus
|
||||
/*public Ac3Bus Ac => new Ac3Bus
|
||||
{
|
||||
L1 = new ()
|
||||
{
|
||||
|
@ -66,7 +66,9 @@ public class Iem3KGridMeterRegisters : IAc3Meter
|
|||
Phi = Atan2(ZeroBecauseReactivePowerNotSupported, _ActivePowerL3)
|
||||
},
|
||||
Frequency = _Frequency
|
||||
};
|
||||
};*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -162,10 +162,10 @@ function Configuration(props: ConfigurationProps) {
|
|||
const handleConfirm = (newDate) => {
|
||||
//console.log('non adapted day is ', newDate);
|
||||
//console.log('adapted day is ', dayjs.utc(newDate).toDate());
|
||||
// setFormValues({
|
||||
// ...formValues,
|
||||
// ['calibrationChargeDate']: dayjs(newDate).toDate()
|
||||
// });
|
||||
setFormValues({
|
||||
...formValues,
|
||||
['calibrationChargeDate']: dayjs(newDate).toDate()
|
||||
});
|
||||
};
|
||||
|
||||
const handleSelectedCalibrationChargeDay = (event) => {
|
||||
|
|
|
@ -167,7 +167,7 @@ export const getChartOptions = (
|
|||
style: {
|
||||
fontSize: '12px'
|
||||
},
|
||||
offsetY: -185,
|
||||
offsetY: -190,
|
||||
offsetX: 25,
|
||||
rotate: 0
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue