78 lines
2.5 KiB
C#
78 lines
2.5 KiB
C#
// using System.Collections.Immutable;
|
|
// using InnovEnergy.WireFormat.VictronV1;
|
|
// using VeDBus;
|
|
//
|
|
// namespace InnovEnergy.VenusLogger.Parsers;
|
|
//
|
|
//
|
|
// using Props = ImmutableDictionary<String, VeProperty>;
|
|
//
|
|
// public static class VeBus
|
|
// {
|
|
// private static Device NullInverter { get; } = new Device
|
|
// {
|
|
// ProsumerType = ProsumerType.UnknownProsumerType,
|
|
// Devices = { new[]
|
|
// {
|
|
// new Device { ProsumerType = ProsumerType.AcBus, Phases = { new Phase { Power = 0, Current = 0 } } },
|
|
// new Device { ProsumerType = ProsumerType.DcBus, Phases = { new Phase { Power = 0, Current = 0 } } },
|
|
// } }
|
|
// };
|
|
//
|
|
// public static Device GetInverter(this IReadOnlyList<ServiceProperties> inverterSv)
|
|
// {
|
|
// return inverterSv.Any()
|
|
// ? inverterSv[0].Properties.GetInverter()
|
|
// : NullInverter;
|
|
// }
|
|
//
|
|
// public static Inverter GetInverter(this Props props)
|
|
// {
|
|
// var current = props.TryGetProperty<Single>("/Dc/0/Current");
|
|
// var voltage = props.TryGetProperty<Single>("/Dc/0/Voltage");
|
|
// var power = props.TryGetProperty<Single>("/Dc/0/Power");
|
|
//
|
|
// var dc = new DcDevice
|
|
// {
|
|
// Current = current,
|
|
// Voltage = voltage,
|
|
// Power = power,
|
|
// };
|
|
//
|
|
// var ac = new AcDevice
|
|
// {
|
|
// Phases = { Enumerable.Range(1, 3).Select(GetAcPhase) }
|
|
// };
|
|
//
|
|
// return new Inverter
|
|
// {
|
|
// Ac = ac,
|
|
// Dc = dc,
|
|
// };
|
|
//
|
|
// AcPhase GetAcPhase(Int32 phase) => new()
|
|
// {
|
|
// Current = GetAcValue(phase, "I"),
|
|
// Voltage = GetAcValue(phase, "V"),
|
|
// Power = GetAcValue(phase, "P"),
|
|
// };
|
|
//
|
|
// Single GetAcValue(Int32 phase, String value) => props.TryGetProperty<Single>($"/Ac/ActiveIn/L{phase}/{value}");
|
|
// }
|
|
//
|
|
// // 'Ac/State/HighDcCurrent': 0,
|
|
// // 'Ac/State/HighDcVoltage': 0,
|
|
// // 'Alarms/HighDcCurrent': 0,
|
|
// // 'Alarms/HighDcVoltage': 0,
|
|
// // 'Dc/0/Current': 25.899999618530273,
|
|
// // 'Dc/0/MaxChargeCurrent': 105.0,
|
|
// // 'Dc/0/Power': 1521,
|
|
// // 'Dc/0/Temperature': [],
|
|
// // 'Dc/0/Voltage': 54.119998931884766,
|
|
// // 'Devices/1/ExtendStatus/HighDcCurrent': 0,
|
|
// // 'Devices/1/ExtendStatus/HighDcVoltage': 0,
|
|
// // 'Devices/2/ExtendStatus/HighDcCurrent': 0,
|
|
// // 'Devices/2/ExtendStatus/HighDcVoltage': 0,
|
|
// // 'FirmwareFeatures/IBatSOCBroadcast': 1,
|
|
// //
|
|
// } |