Update SchneiderMeterDriver

This commit is contained in:
atef 2024-06-04 15:28:17 +02:00
parent 6383bd7f4c
commit 1f3d4c74b9
7 changed files with 44 additions and 25 deletions

View File

@ -1,7 +1,7 @@
using System.Reflection; using System.Reflection;
using InnovEnergy.Lib.Victron.VeDBus; using InnovEnergy.Lib.Victron.VeDBus;
namespace InnovEnergy.App.SchniederDriver; namespace InnovEnergy.App.SchneiderDriver;
public static class Config public static class Config
{ {
@ -20,20 +20,20 @@ public static class Config
public static readonly IReadOnlyList<Signal> Signals = new Signal[] public static readonly IReadOnlyList<Signal> Signals = new Signal[]
{ {
new(s => s.Ac.L1.Current, "/Ac/L1/Current", "0.0 A"), // new(s => s..CurrentL1, "/Ac/L1/Current", "0.0 A"),
new(s => s.Ac.L2.Current, "/Ac/L2/Current", "0.0 A"), // new(s => s..CurrentL2, "/Ac/L2/Current", "0.0 A"),
new(s => s.Ac.L3.Current, "/Ac/L3/Current", "0.0 A"), // new(s => s..CurrentL3, "/Ac/L3/Current", "0.0 A"),
new(s => s.Ac.L1.Current + s.Ac.L2.Current + s.Ac.L3.Current, "/Ac/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.L1.Voltage, "/Ac/L1/Voltage", "0.0 A"),
new(s => s.Ac.L2.Voltage, "/Ac/L2/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.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.Ac.L1.Voltage + s.Ac.L2.Voltage + s.Ac.L3.Voltage) / 3.0m, "/Ac/Voltage", "0.0 A"),
new(s => s.Ac.L1.ActivePower, "/Ac/L1/Power", "0 W"), new(s => s.ActivePowerL1, "/Ac/L1/Power", "0 W"),
new(s => s.Ac.L2.ActivePower, "/Ac/L2/Power", "0 W"), new(s => s.ActivePowerL2, "/Ac/L2/Power", "0 W"),
new(s => s.Ac.L3.ActivePower, "/Ac/L3/Power", "0 W"), new(s => s.ActivePowerL3, "/Ac/L3/Power", "0 W"),
new(s => s.Ac.ActivePower, "/Ac/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.EnergyImportL123, "Ac/Energy/Forward", "0.00 kWh"),
// new(s => s.EnergyExportL123, "Ac/Energy/Reverse", "0.00 kWh"), // new(s => s.EnergyExportL123, "Ac/Energy/Reverse", "0.00 kWh"),
@ -51,7 +51,7 @@ public static class Config
public static VeProperties DefaultProperties => new VeProperties public static VeProperties DefaultProperties => new VeProperties
{ {
new("/ProductName" , "Grid meter" ), new("/ProductName" , "Grid meter" ),
new("/CustomName" , "EMU Professional II"), new("/CustomName" , "Schneider Professional II"),
new("/DeviceInstance" , 30), new("/DeviceInstance" , 30),
new("/DeviceType" , 72), new("/DeviceType" , 72),
new("/Mgmt/Connection" , "Modbus TCP"), new("/Mgmt/Connection" , "Modbus TCP"),

View File

@ -1,4 +1,4 @@
using InnovEnergy.App.SchniederDriver; using InnovEnergy.App.SchneiderDriver;
using InnovEnergy.Lib.Protocols.DBus; using InnovEnergy.Lib.Protocols.DBus;
using InnovEnergy.Lib.Utils; using InnovEnergy.Lib.Utils;
using InnovEnergy.Lib.Utils.Net; using InnovEnergy.Lib.Utils.Net;
@ -9,7 +9,7 @@ using InnovEnergy.Lib.Utils.Net;
// ssh root@10.2.1.6 /home/root/emu/EmuMeter // ssh root@10.2.1.6 /home/root/emu/EmuMeter
Console.WriteLine("Starting Schnieder Driver " + Config.Version); Console.WriteLine("Starting Schneider Driver " + Config.Version);
var networkInterfaces = await Nic.GetNetworkInterfaces(); var networkInterfaces = await Nic.GetNetworkInterfaces();
@ -43,9 +43,9 @@ foreach (var nic in candidates)
if (ping) if (ping)
{ {
Console.WriteLine($"Got answer from {Config.PeerAddress}"); Console.WriteLine($"Got answer from {Config.PeerAddress}");
var ex = await SchniederMeterDriver.Run($"{Config.PeerAddress}:{Config.PeerPort}", Bus.System); var ex = await SchneiderMeterDriver.Run($"{Config.PeerAddress}:{Config.PeerPort}", Bus.System);
Console.WriteLine($"{nameof(SchniederMeterDriver)} FAILED with\n{ex}"); Console.WriteLine($"{nameof(SchneiderMeterDriver)} FAILED with\n{ex}");
} }
else else
{ {
@ -57,4 +57,4 @@ foreach (var nic in candidates)
Console.WriteLine(removed ? "done" : "failed"); Console.WriteLine(removed ? "done" : "failed");
} }
Console.WriteLine("Stopping EmuMeter Driver"); Console.WriteLine("Stopping SchneiderMeter Driver");

View File

@ -5,9 +5,9 @@ using InnovEnergy.Lib.Protocols.Modbus.Clients;
using InnovEnergy.Lib.Utils; using InnovEnergy.Lib.Utils;
using InnovEnergy.Lib.Victron.VeDBus; using InnovEnergy.Lib.Victron.VeDBus;
namespace InnovEnergy.App.SchniederDriver; namespace InnovEnergy.App.SchneiderDriver;
public static class SchniederMeterDriver public static class SchneiderMeterDriver
{ {
public static Task<Exception> Run(String hostName, Bus dbusAddress) public static Task<Exception> Run(String hostName, Bus dbusAddress)
{ {

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<RootNamespace>InnovEnergy.App.SchniederDriver</RootNamespace> <RootNamespace>InnovEnergy.App.SchneiderDriver</RootNamespace>
<AssemblyName>SchniederDriver</AssemblyName> <AssemblyName>SchniederDriver</AssemblyName>
</PropertyGroup> </PropertyGroup>

View File

@ -1,9 +1,8 @@
using InnovEnergy.Lib.Devices.EmuMeter;
using InnovEnergy.Lib.Devices.IEM3kGridMeter; using InnovEnergy.Lib.Devices.IEM3kGridMeter;
using InnovEnergy.Lib.Protocols.DBus.Protocol.DataTypes; using InnovEnergy.Lib.Protocols.DBus.Protocol.DataTypes;
using InnovEnergy.Lib.Victron.VeDBus; using InnovEnergy.Lib.Victron.VeDBus;
namespace InnovEnergy.App.SchniederDriver; namespace InnovEnergy.App.SchneiderDriver;
// TODO: Does not compile // TODO: Does not compile

View File

@ -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"

View File

@ -91,7 +91,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sofar", "App\Sofar\Sofar.cs
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SofarInverter", "Lib\Devices\SofarInverter\SofarInverter.csproj", "{2C7F3D89-402B-43CB-988E-8D2D853BEF44}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SofarInverter", "Lib\Devices\SofarInverter\SofarInverter.csproj", "{2C7F3D89-402B-43CB-988E-8D2D853BEF44}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchniederMeterDriver", "App\SchniederMeterDriver\SchniederMeterDriver.csproj", "{2E7E7657-3A53-4B62-8927-FE9A082B81DE}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchneiderMeterDriver", "App\SchneiderMeterDriver\SchneiderMeterDriver.csproj", "{2E7E7657-3A53-4B62-8927-FE9A082B81DE}"
EndProject EndProject
Global Global