remove Meiringen.csproj

This commit is contained in:
ig 2023-02-23 16:00:21 +01:00
parent e010c4ff54
commit 45bd531206
26 changed files with 0 additions and 3218 deletions

View File

@ -1,6 +0,0 @@
namespace InnovEnergy.Meiringen;
public record Bus
{
}

View File

@ -1,40 +0,0 @@
using System.Diagnostics.CodeAnalysis;
namespace InnovEnergy.Meiringen.DataTypes;
[Flags]
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "IdentifierTypo")]
public enum Alarms : UInt64
{
Tam = 1L << 0,
TaM2 = 1L << 2,
Tbm = 1L << 3,
TbM2 = 1L << 5,
VBm2 = 1L << 7,
VBM2 = 1L << 9,
IDM2 = 1L << 11,
ISOB = 1L << 12,
MSWE = 1L << 13,
FUSE = 1L << 14,
HTRE = 1L << 15,
TCPE = 1L << 16,
STRE = 1L << 17,
CME = 1L << 18,
HWFL = 1L << 19,
HWEM = 1L << 20,
ThM = 1L << 21,
vsm1 = 1L << 22,
vsm2 = 1L << 23,
vsM2 = 1L << 25,
iCM2 = 1L << 27,
iDM2 = 1L << 29,
MID2 = 1L << 31,
CCBF = 1L << 33,
AhFL = 1L << 34,
TbCM = 1L << 36,
BRNF = 1L << 37,
HTFS = 1L << 42,
DATA = 1L << 43,
CELL2 = 1L << 45,
}

View File

@ -1,10 +0,0 @@
namespace InnovEnergy.Meiringen.DataTypes;
public enum BatteryState : UInt16
{
EocReached ,
Cold ,
Heating ,
Charging ,
Discharging ,
}

View File

@ -1,19 +0,0 @@
//using InnovEnergy.S3.Records.Fields;
namespace InnovEnergy.Meiringen.DataTypes;
public record BatteryStatus
{
public MainStats MainStats { get; init; }
public Leds Leds { get; init; }
public Warnings Warnings { get; init; }
public Alarms Alarms { get; init; }
public IoStatus IoStatus { get; init; }
public Temperatures TemperatureManagement { get; init; }
public BmsInfo BmsInfo { get; init; }
//public BatteryState BatteryState { get; init; }
//public Limits OperationalLimits { get; init; }
}

View File

@ -1,10 +0,0 @@
namespace InnovEnergy.Meiringen.DataTypes;
public record BmsInfo
{
public String FirmwareVersion { get; init; }
public String HardwareVersion { get; init; }
public String BmsVersion { get; init; }
public UInt32 RtcCounter { get; init; }
public String SlaveId { get; init; }
}

View File

@ -1,17 +0,0 @@
using System.Diagnostics.CodeAnalysis;
namespace InnovEnergy.Meiringen.DataTypes;
[Flags]
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "IdentifierTypo")]
public enum IoStatus : UInt16
{
MainSwitchClosed = 1 << 0,
AlarmOutActive = 1 << 1,
InternalFanActive = 1 << 2,
VoltMeasurementAllowed = 1 << 3,
AuxRelay = 1 << 4,
RemoteState = 1 << 5,
HeaterOn = 1 << 6,
}

View File

@ -1,9 +0,0 @@
namespace InnovEnergy.Meiringen.DataTypes;
public enum LedState : Byte
{
Off = 0,
On = 1,
BlinkingSlow = 2,
BlinkingFast = 3,
}

View File

@ -1,9 +0,0 @@
namespace InnovEnergy.Meiringen.DataTypes;
public record Leds
{
public LedState Red { get; init; }
public LedState Green { get; init; }
public LedState Blue { get; init; }
public LedState Amber { get; init; }
}

View File

@ -1,14 +0,0 @@
using InnovEnergy.S3.Records.Fields;
namespace InnovEnergy.Meiringen.DataTypes;
public record Limits
{
[Unit("A")] public Double MaxDischargeCurrent { get; init; }
[Unit("A")] public Double MaxChargeCurrent { get; init; }
[Unit("V")] public Double MaxChargeVoltage { get; init; }
[Unit("V")] public Double MinDischargeVoltage { get; init; }
[Unit("W")] public Double MaxChargePower { get; init; }
[Unit("W")] public Double MaxDischargePower { get; init; }
}

View File

@ -1,14 +0,0 @@
using InnovEnergy.S3.Records.Fields;
namespace InnovEnergy.Meiringen.DataTypes;
public record MainStats
{
[Unit("V")] public Double BusVoltage { get; init; }
[Unit("V")] public Double StringsVoltage { get; init; }
[Unit("A")] public Double Current { get; init; }
[Unit("%")] public Double Soc { get; init; }
[Unit("°C")] public Double Temperature { get; init; }
[Unit("Wh")] public Double Capacity { get; init; }
[Unit("W")] public Double Power => Current * StringsVoltage;
}

View File

@ -1,14 +0,0 @@
using InnovEnergy.S3.Records.Fields;
namespace InnovEnergy.Meiringen.DataTypes;
public record Temperatures
{
[Unit("°C")] public Double Battery { get; init; }
[Unit("°C")] public Double Board { get; init; }
[Unit("°C")] public Double Center { get; init; }
[Unit("°C")] public Double Lateral1 { get; init; }
[Unit("°C")] public Double Lateral2 { get; init; }
[Unit("%")] public Double CenterHeaterPwm { get; init; }
[Unit("%")] public Double LateralHeaterPwm { get; init; }
}

View File

@ -1,26 +0,0 @@
using System.Diagnostics.CodeAnalysis;
namespace InnovEnergy.Meiringen.DataTypes;
[Flags]
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "IdentifierTypo")]
public enum Warnings : UInt64
{
TaM1 = 1L << 1,
TbM1 = 1L << 4,
VBm1 = 1L << 6,
VBM1 = 1L << 8,
IDM1 = 1L << 10,
vsM1 = 1L << 24,
iCM1 = 1L << 26,
iDM1 = 1L << 28,
MID1 = 1L << 30,
BLPW = 1L << 32,
Ah_W = 1L << 35,
MPMM = 1L << 38,
TCMM = 1L << 39,
TCdi = 1L << 40,
WMTO = 1L << 41,
CELL1 = 1L << 46,
}

View File

@ -1,19 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../InnovEnergy.app.props" />
<PropertyGroup>
<RootNamespace>InnovEnergy.Meiringen</RootNamespace>
<InvariantGlobalization>true</InvariantGlobalization>
<PackageId>Meiringen</PackageId>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../../lib/S3/S3.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Flurl.Http" Version="3.2.0" />
<PackageReference Include="Google.Protobuf" Version="3.19.4" />
</ItemGroup>
</Project>

View File

@ -1,140 +0,0 @@
using System.Reactive.Linq;
using System.Text.Json;
using Flurl.Http;
using InnovEnergy.S3.Drivers;
using InnovEnergy.Lib.Utils;
using static System.StringSplitOptions;
namespace InnovEnergy.Meiringen;
/*
dotnet publish Meiringen.csproj -c Release -r linux-arm -p:PublishSingleFile=true --self-contained false && \
rsync -av bin/Release/net5.0/linux-arm/publish/ debian@10.2.1.87:/home/debian/Monitor && \
ssh debian@10.2.1.87 /home/debian/Monitor/Meiringen /home/debian/trumpf/csvData
*/
class Program
{
//private static UdpClient _incomingSocket = new UdpClient(Settings.IncomingEndPoint);
private static readonly S3Config S3Config = new S3Config
{
Bucket = "meiringen",
Region = "sos-ch-dk-2",
Provider = "exo.io",
ContentType = "text/plain; charset=utf-8",
//Key = "EXO821fc7a9a3ea6d7365b0c6b8",
//Secret = "xiCpn5f9sFeyXL81CG7iTqDGkTekNsrJ-_bJRiyRp9Q"
Key = "EXO36c6c169fbe39800742f4f56",
Secret = "MA5svEdwwNF9XaLO-8PKj_P325Ovog5aeihPAc88R1w"
};
public static void Main(String[] args)
{
var path = args.FirstOrDefault() ?? ".";
Console.WriteLine("Starting");
Observable.Interval(TimeSpan.FromSeconds(2))
.SelectMany(_ => TryUploadData(path))
.Subscribe(Console.WriteLine);
Console.ReadLine();
}
private static async Task<String> TryUploadData(String path)
{
try
{
return await UploadData(path);
}
catch (Exception e)
{
return e.ToString();
}
}
private static async Task<String> UploadData(String path)
{
// var pv = ReadFile(path, "PV.csv").FirstOrDefault();
// var grid = ReadFile(path, "gridPower.csv").FirstOrDefault();
// var inverter = -ReadFile(path, "inverterPower.csv").FirstOrDefault();
// var acLoad = ReadFile(path, "loadPower.csv").FirstOrDefault();
// var socBattery = ReadFile(path, "battery.csv");
//
// var soc = socBattery.ElementAtOrDefault(0);
// var battery = -socBattery.ElementAtOrDefault(1);
var battery = 0;
var soc = 1;
var pv = 2;
var grid = 3;
var inverter = 4;
var acLoad = 5;
var data = new
{
battery,
soc,
pv,
grid,
inverter,
acLoad,
};
var json = JsonSerializer.Serialize(data);
var unixTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds() / 2 * 2;
var s3Path = "/" + unixTime;
var request = S3Config.CreatePutRequest(s3Path);
var response = await request.PutAsync(new StringContent(json));
if (response.StatusCode == 200)
return "PUT " + s3Path;
var error = await response.GetStringAsync();
return "ERROR: " + error;
}
private static IReadOnlyList<Double> ReadFile(String path, String file)
{
var fullPath = Path.Combine(path, file);
return File
.ReadAllText(fullPath)
.Trim()
.Split(',', TrimEntries | RemoveEmptyEntries)
.Select(ParseDouble)
.ToList();
Double ParseDouble(String s) => Double.TryParse(s, out var value) ? value : 0;
}
private static IEnumerable<Double> FakeDataSource(Double min, Double max)
{
var amplitude = (max - min)/2;
return EnumerableUtils
.InfinitelyMany(0)
.Select(_ => Random.Shared.NextDouble() * 2 - 1)
.IntegrateNormalize()
.Select(x => x * .5) // those constants have been drawn out of thin air to make it look good
.IntegrateNormalize()
.Select(x => x * .1)
.IntegrateNormalize()
.Select(x => (x + 1) * amplitude + min);
}
}

View File

@ -1,41 +0,0 @@

// ReSharper disable IdentifierTypo
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable InconsistentNaming
namespace InnovEnergy.Meiringen.Records;
public class AlarmsOld : BatteryRecordOld
{
public String Installation { get; set; }
public String BatteryId { get; set; }
public Boolean Tam { get; set; }
public Boolean TaM2 { get; set; }
public Boolean Tbm { get; set; }
public Boolean TbM2 { get; set; }
public Boolean VBm2 { get; set; }
public Boolean VBM2 { get; set; }
public Boolean IDM2 { get; set; }
public Boolean MSWE { get; set; }
public Boolean FUSE { get; set; }
public Boolean HTRE { get; set; }
public Boolean TCPE { get; set; }
public Boolean CME { get; set; }
public Boolean HWFL { get; set; }
public Boolean HWEM { get; set; }
public Boolean ThM { get; set; }
public Boolean vsm1 { get; set; }
public Boolean vsm2 { get; set; }
public Boolean vsM2 { get; set; }
public Boolean iCM2 { get; set; }
public Boolean iDM2 { get; set; }
public Boolean MID2 { get; set; }
public Boolean CCBF { get; set; }
public Boolean AhFL { get; set; }
public Boolean TbCM { get; set; }
public Boolean HTFS { get; set; }
public Boolean DATA { get; set; }
public Boolean ISOB { get; set; }
}

View File

@ -1,4 +0,0 @@
namespace InnovEnergy.Meiringen.Records;
public abstract class BatteryRecordOld
{}

View File

@ -1,32 +0,0 @@

// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable MemberCanBePrivate.Global
namespace InnovEnergy.Meiringen.Records;
public class BatteryStatusOld : BatteryRecordOld
{
public String InstallationName { get; set; }
public String BatteryId { get; set; }
public String HardwareVersion { get; set; }
public String FirmwareVersion { get; set; }
public String BmsVersion { get; set; }
public UInt32 AmpereHours { get; set; }
public UInt32 RtcCounter { get; set; }
public Decimal Voltage { get; set; }
public Decimal Current { get; set; }
public Decimal BusVoltage { get; set; }
public Decimal Soc { get; set; }
public Decimal Temperature { get; set; }
public UInt64 WarningsBitmap { get; set; }
public UInt64 AlarmsBitmap { get; set; }
public DateTime LastSeen { get; set; }
public String IpAddress { get; set; }
public Int32 Port { get; set; }
}

View File

@ -1,11 +0,0 @@
// ReSharper disable UnusedAutoPropertyAccessor.Global
namespace InnovEnergy.Meiringen.Records;
public class Error : BatteryRecordOld
{
public String Message { get; set; }
public String IpAddress { get; set; }
}

View File

@ -1,63 +0,0 @@
namespace InnovEnergy.Meiringen.Records;
public class InstallationStatus : BatteryRecordOld
{
public String InstallationName { get; set; }
public Decimal Voltage { get; set; }
public Decimal Current { get; set; }
public Decimal BusVoltage { get; set; }
public Decimal Soc { get; set; }
public Decimal Temperature { get; set; }
public Int64 LastSeen { get; set; }
public String IpAddress { get; set; }
public Int32 Port { get; set; }
// Warnings
public Boolean TaM1 { get; set; }
public Boolean TbM1 { get; set; }
public Boolean VBm1 { get; set; }
public Boolean VBM1 { get; set; }
public Boolean IDM1 { get; set; }
public Boolean vsM1 { get; set; }
public Boolean iCM1 { get; set; }
public Boolean iDM1 { get; set; }
public Boolean MID1 { get; set; }
public Boolean BLPW { get; set; }
public Boolean Ah_W { get; set; }
public Boolean MPMM { get; set; }
public Boolean TCMM { get; set; }
public Boolean TCdi { get; set; }
// Alarms
public Boolean Tam { get; set; }
public Boolean TaM2 { get; set; }
public Boolean Tbm { get; set; }
public Boolean TbM2 { get; set; }
public Boolean VBm2 { get; set; }
public Boolean VBM2 { get; set; }
public Boolean IDM2 { get; set; }
public Boolean MSWE { get; set; }
public Boolean FUSE { get; set; }
public Boolean HTRE { get; set; }
public Boolean TCPE { get; set; }
public Boolean CME { get; set; }
public Boolean HWFL { get; set; }
public Boolean HWEM { get; set; }
public Boolean ThM { get; set; }
public Boolean vsm1 { get; set; }
public Boolean vsm2 { get; set; }
public Boolean vsM2 { get; set; }
public Boolean iCM2 { get; set; }
public Boolean iDM2 { get; set; }
public Boolean MID2 { get; set; }
public Boolean CCBF { get; set; }
public Boolean AhFL { get; set; }
public Boolean TbCM { get; set; }
public Boolean HTFS { get; set; }
public Boolean DATA { get; set; }
public Boolean ISOB { get; set; }
}

View File

@ -1,20 +0,0 @@

// ReSharper disable UnusedAutoPropertyAccessor.Global
namespace InnovEnergy.Meiringen.Records;
public class IoStatusOld : BatteryRecordOld
{
public String Installation { get; set; }
public String BatteryId { get; set; }
public Boolean MainSwitchClosed { get; set; }
public Boolean AlarmOutActive { get; set; }
public Boolean InternalFanActive { get; set; }
public Boolean VoltMeasurementAllowed { get; set; }
public Boolean AuxRelay { get; set; }
public Boolean RemoteState { get; set; }
public Boolean HeatingOn { get; set; }
}

View File

@ -1,26 +0,0 @@
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable UnusedMember.Global
namespace InnovEnergy.Meiringen.Records;
public class LedsOld : BatteryRecordOld
{
public String Installation { get; set; }
public String BatteryId { get; set; }
public LedStateOld Green { get; set; }
public LedStateOld Amber { get; set; }
public LedStateOld Blue { get; set; }
public LedStateOld Red { get; set; }
}
public enum LedStateOld : byte
{
Off = 0b00,
On = 0b01,
BlinkingSlow = 0b10,
BlinkingFast = 0b11,
}

View File

@ -1,19 +0,0 @@
// ReSharper disable UnusedAutoPropertyAccessor.Global
namespace InnovEnergy.Meiringen.Records;
public class TemperaturesOld : BatteryRecordOld
{
public String Installation { get; set; }
public String BatteryId { get; set; }
public Decimal Battery { get; set; }
public Decimal Board { get; set; }
public Decimal Center { get; set; }
public Decimal Lateral1 { get; set; }
public Decimal Lateral2 { get; set; }
public Decimal CenterHeaterPwm { get; set; }
public Decimal LateralHeaterPwm { get; set; }
}

View File

@ -1,29 +0,0 @@

// ReSharper disable IdentifierTypo
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable InconsistentNaming
namespace InnovEnergy.Meiringen.Records;
public class WarningsOld : BatteryRecordOld
{
public String Installation { get; set; }
public String BatteryId { get; set; }
public Boolean TaM1 { get; set; }
public Boolean TbM1 { get; set; }
public Boolean VBm1 { get; set; }
public Boolean VBM1 { get; set; }
public Boolean IDM1 { get; set; }
public Boolean vsM1 { get; set; }
public Boolean iCM1 { get; set; }
public Boolean iDM1 { get; set; }
public Boolean MID1 { get; set; }
public Boolean BLPW { get; set; }
public Boolean Ah_W { get; set; }
public Boolean MPMM { get; set; }
public Boolean TCMM { get; set; }
public Boolean TCdi { get; set; }
}

View File

@ -1,10 +0,0 @@
using System.Net;
namespace InnovEnergy.Meiringen;
public static class Settings
{
public const String ProtocolV3 = "48TL200V3";
public static readonly IPEndPoint IncomingEndPoint = IPEndPoint.Parse("127.0.0.1:8134");
}

File diff suppressed because it is too large Load Diff