fix merge conflict

This commit is contained in:
Sina Blattmann 2023-07-03 14:36:44 +02:00
commit 5dd93ee868
30 changed files with 20763 additions and 99 deletions

Binary file not shown.

View File

@ -1,8 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configurations>Debug;Release;Release-Server</Configurations>
<Platforms>AnyCPU;linux-arm</Platforms>
</PropertyGroup>
<Import Project="../InnovEnergy.App.props" />
<ItemGroup>
@ -26,4 +22,4 @@
<ProjectReference Include="../../Lib/Utils/Utils.csproj" />
</ItemGroup>
</Project>
</Project>

View File

@ -2,7 +2,7 @@
dotnet_version='net6.0'
salimax_ip= '10.2.3.104'
username='ie-entwicklung@'
username='ie-entwicklung'
set -e
@ -11,7 +11,7 @@ echo -e "\n============================ Build ============================\n"
dotnet publish \
./SaliMax.csproj \
-c Release \
-r linux-x64
-r linux-x64
echo -e "\n============================ Deploy ============================\n"

View File

@ -0,0 +1,34 @@
#!/bin/bash
dotnet_version='net6.0'
salimax_ip='10.2.4.33'
username='ie-entwicklung'
set -e
echo -e "\n============================ Build ============================\n"
dotnet publish \
./SaliMax.csproj \
-p:PublishTrimmed=false \
-c Release \
-r linux-x64
echo -e "\n============================ Deploy ============================\n"
rsync -v \
./bin/Release/$dotnet_version/linux-x64/publish/* \
ie-entwicklung@10.2.4.33:~/salimax
echo -e "\n============================ Restart Salimax sevice ============================\n"
ssh -tt \
ie-entwicklung@10.2.4.33 \
sudo systemctl restart salimax.service
echo -e "\n============================ Print service output ============================\n"
ssh -tt \
ie-entwicklung@10.2.4.33 \
journalctl -f -u salimax.service

View File

@ -1,9 +1,8 @@
#!/bin/bash
dotnet_version='net6.0'
salimax_ip= '10.2.3.115'
username='ie-entwicklung@'
salimax_ip='10.2.3.115'
username='ie-entwicklung'
set -e
@ -13,23 +12,23 @@ dotnet publish \
./SaliMax.csproj \
-p:PublishTrimmed=false \
-c Release \
-r linux-x64
-r linux-x64
echo -e "\n============================ Deploy ============================\n"
rsync -v \
./bin/Release/$dotnet_version/linux-x64/publish/* \
ie-entwicklung@10.2.3.115:~/salimax
$username@$salimax_ip:~/salimax
echo -e "\n============================ Restart Salimax sevice ============================\n"
ssh -tt \
ie-entwicklung@10.2.3.115 \
$username@$salimax_ip \
sudo systemctl restart salimax.service
echo -e "\n============================ Print service output ============================\n"
ssh -tt \
ie-entwicklung@10.2.3.115 \
$username@$salimax_ip \
journalctl -f -u salimax.service

View File

@ -187,7 +187,7 @@ public static class Controller
if (statusRecord.Battery.Eoc)
{
"Batteries have reached EOC".Log();
"Batteries have reached EOC".LogInfo();
config.LastEoc = UnixTime.Now;
return false;
}

View File

@ -10,11 +10,30 @@ public static class Logger
private const Int32 MaxLogFileCount = 1000; // TODO: move to settings
private const String LogFilePath = "LogDirectory/log.txt"; // TODO: move to settings
// ReSharper disable once InconsistentNaming
private static readonly ILogger _logger = new CustomLogger(LogFilePath, MaxFileSizeBytes, MaxLogFileCount);
public static T Log<T>(this T t) where T : notnull
public static T LogInfo<T>(this T t) where T : notnull
{
// _logger.LogInformation(t.ToString()); // TODO: check warning
_logger.LogInformation(t.ToString()); // TODO: check warning
return t;
}
public static T LogDebug<T>(this T t) where T : notnull
{
_logger.LogDebug(t.ToString()); // TODO: check warning
return t;
}
public static T LogError<T>(this T t) where T : notnull
{
_logger.LogError(t.ToString()); // TODO: check warning
return t;
}
public static T LogWarning<T>(this T t) where T : notnull
{
_logger.LogWarning(t.ToString()); // TODO: check warning
return t;
}
}

View File

@ -36,20 +36,23 @@ internal static class Program
private static readonly Byte[] BatteryNodes = { 2, 3, 4, 5, 6 };
private const String BatteryTty = "/dev/ttyUSB0";
#if DEBUG
private static readonly TcpChannel TruConvertAcChannel = new TcpChannel("localhost", 5001);
private static readonly TcpChannel TruConvertDcChannel = new TcpChannel("localhost", 5002);
private static readonly TcpChannel GridMeterChannel = new TcpChannel("localhost", 5003);
private static readonly TcpChannel AcOutLoadChannel = new TcpChannel("localhost", 5004);
private static readonly TcpChannel AmptChannel = new TcpChannel("localhost", 5005);
private static readonly TcpChannel RelaysChannel = new TcpChannel("localhost", 5006);
private static readonly TcpChannel BatteriesChannel = new TcpChannel("localhost", 5007);
#else
private static readonly TcpChannel RelaysChannel = new TcpChannel("10.0.1.1", 502); // "192.168.1.242";
private static readonly TcpChannel TruConvertAcChannel = new TcpChannel("10.0.2.1", 502); // "192.168.1.2";
private static readonly TcpChannel TruConvertDcChannel = new TcpChannel("10.0.3.1", 502); // "192.168.1.3";
private static readonly TcpChannel GridMeterChannel = new TcpChannel("10.0.4.1", 502); // "192.168.1.241";
private static readonly TcpChannel AcOutLoadChannel = new TcpChannel("10.0.4.2", 502); // "192.168.1.241";
private static readonly TcpChannel AmptChannel = new TcpChannel("10.0.5.1", 502); // "192.168.1.249";
//private static readonly TcpChannel TruConvertAcChannel = new TcpChannel("localhost", 5001);
//private static readonly TcpChannel TruConvertDcChannel = new TcpChannel("localhost", 5002);
//private static readonly TcpChannel GridMeterChannel = new TcpChannel("localhost", 5003);
//private static readonly TcpChannel AcOutLoadChannel = new TcpChannel("localhost", 5004);
//private static readonly TcpChannel AmptChannel = new TcpChannel("localhost", 5005);
//private static readonly TcpChannel RelaysChannel = new TcpChannel("localhost", 5006);
//private static readonly TcpChannel BatteriesChannel = new TcpChannel("localhost", 5007);
private static readonly TcpChannel BatteriesChannel = new TcpChannel("localhost", 5007);
#endif
private static readonly S3Config S3Config = new S3Config
@ -165,7 +168,6 @@ internal static class Program
Console.WriteLine("press ctrl-C to stop");
while (true)
{
sd_notify(0, "WATCHDOG=1");
@ -180,16 +182,7 @@ internal static class Program
if (record.Relays is not null)
record.Relays.ToCsv().WriteLine();
var emuMeterRegisters = record.GridMeter;
if (emuMeterRegisters is not null)
{
emuMeterRegisters.Ac.Power.Active.WriteLine("Grid Active");
//emuMeterRegisters.Ac.Power.Reactive.WriteLine("Grid Reactive");
}
record.ControlConstants();
record.ControlSystemState();
@ -256,11 +249,11 @@ internal static class Program
// Voltage Measurement Values
//var inverterVoltage = new Voltage [(Int32)s.AcDc.Ac.L1.Voltage, (Int32)s.AcDc.Ac.L2.Voltage, (Int32)s.AcDc.Ac.L3.Voltage];
//var dcLinkVoltage = s.DcDc.Dc.Link.Voltage;
var dc48Voltage = s.DcDc.Dc.Battery.Voltage;
var batteryVoltage = s.Battery.Dc.Voltage;
var batterySoc = s.Battery.Soc;
var batteryCurrent = s.Battery.Dc.Current;
var batteryTemp = s.Battery.Temperature;
var dc48Voltage = s.DcDc.Dc.Battery.Voltage.ToDisplayString();
var batteryVoltage = s.Battery.Dc.Voltage.ToDisplayString;
var batterySoc = s.Battery.Soc.ToDisplayString();
var batteryCurrent = s.Battery.Dc.Current.ToDisplayString();
var batteryTemp = s.Battery.Temperature.ToDisplayString();
var gridBusColumn = ColumnBox("Pv", "Grid Bus", "Load" , gridVoltageByPhase , gridLoadPower);
var islandBusColumn = ColumnBox("Pv", "Island Bus", "Load" , inverterPowerByPhase, islandLoadPower);
@ -272,12 +265,25 @@ internal static class Program
var flowDcBusToDcDc = Flow.Horizontal(dcdcPower);
var flowDcDcToBattery = Flow.Horizontal(dcBatteryPower);
var gridBox = TextBlock.AlignLeft(gridPowerByPhase).TitleBox("Grid");
var inverterBox = TextBlock.AlignLeft(inverterPowerByAcDc).TitleBox("Inverter");
var dcDcBox = TextBlock.AlignLeft(dc48Voltage).TitleBox("DC/DC");
var batteryBox = TextBlock.AlignLeft(batteryVoltage.ToDisplayString(), batterySoc.ToDisplayString(), batteryCurrent.ToDisplayString(), batteryTemp.ToDisplayString()).TitleBox("Battery");
var gridBox = TextBlock.AlignLeft(gridPowerByPhase).TitleBox("Grid");
var inverterBox = TextBlock.AlignLeft(inverterPowerByAcDc).TitleBox("Inverter");
var dcDcBox = TextBlock.AlignLeft(dc48Voltage).TitleBox("DC/DC");
var batteryAvgBox = TextBlock.AlignLeft(batteryVoltage,
batterySoc,
batteryCurrent,
batteryTemp)
.TitleBox("Battery");
//////////////////// Batteries /////////////////////////
var batteryBoxes = s.Battery
.Devices
.Select(CreateIndividualBattery)
.ToArray(s.Battery.Devices.Count);
var individualBatteries = TextBlock.AlignLeft(batteryBoxes);
var totalBoxes = TextBlock.CenterVertical(gridBox,
gridBusFlow,
@ -291,11 +297,28 @@ internal static class Program
flowDcBusToDcDc,
dcDcBox,
flowDcDcToBattery,
batteryBox);
batteryAvgBox,
individualBatteries);
totalBoxes.WriteLine();
}
private static TextBlock CreateIndividualBattery(Battery48TlRecord battery, Int32 i)
{
var content = TextBlock.AlignLeft(battery.Dc.Voltage.ToDisplayString(),
battery.Soc.ToDisplayString(),
battery.Dc.Current.ToDisplayString(),
battery.Temperatures.Cells.Average.ToDisplayString(),
battery.BusCurrent.ToDisplayString(),
battery.HeatingCurrent.ToDisplayString());
var box = content.TitleBox($"Battery {i + 1}");
var flow = Flow.Horizontal(battery.Dc.Power);
return TextBlock.CenterVertical(flow, box);
}
private static TextBlock ColumnBox(String pvTitle, String busTitle, String loadTitle, TextBlock dataBox)
{
return ColumnBox(pvTitle, busTitle, loadTitle, dataBox, 0);
@ -414,6 +437,5 @@ internal static class Program
Console.WriteLine(error);
}
}
}

View File

@ -18,7 +18,7 @@ public class RelaysDevice
}
catch (Exception e)
{
$"Failed to read from {nameof(RelaysDevice)}\n{e}".Log();
$"Failed to read from {nameof(RelaysDevice)}\n{e}".LogInfo();
// TODO: log
return null;
@ -33,7 +33,7 @@ public class RelaysDevice
}
catch (Exception e)
{
$"Failed to write to {nameof(RelaysDevice)}\n{e}".Log();
$"Failed to write to {nameof(RelaysDevice)}\n{e}".LogInfo();
}
}
}

View File

@ -31,11 +31,11 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
LastEoc = UnixTime.Epoch,
PConstant = .5,
GridSetPoint = 0,
BatterySelfDischargePower = 200, // TODO: multiple batteries
BatterySelfDischargePower = 200, // TODO: multiple batteries // no need as we multiplied by the number of the batteries
HoldSocZone = 1, // TODO: find better name,
MinDcBusVoltage = 730,
MinDcBusVoltage = 690,
ReferenceDcBusVoltage = 750,
MaxDcBusVoltage = 770,
MaxDcBusVoltage = 810,
};
@ -50,7 +50,7 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
}
catch (Exception e)
{
$"Failed to write config file {configFilePath}\n{e}".Log();
$"Failed to write config file {configFilePath}\n{e}".LogInfo();
throw;
}
}
@ -66,7 +66,7 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
}
catch (Exception e)
{
$"Failed to read config file {configFilePath}, using default config\n{e}".Log();
$"Failed to read config file {configFilePath}, using default config\n{e}".LogInfo();
return Default;
}
}

View File

@ -1,4 +1,4 @@
j#!/bin/bash
#!/bin/bash
host=ie-entwicklung@10.2.3.104

View File

@ -6,15 +6,15 @@
<LangVersion>preview</LangVersion>
<IsTrimmable>true</IsTrimmable>
<ImplicitUsings>enable</ImplicitUsings>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<InvariantGlobalization>true</InvariantGlobalization>
<SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings>
<RootNamespace>Please.reload.the.project.Rider.is.stupid</RootNamespace>
<!-- <RootNamespace>Please.reload.the.project.Rider.is.stupid</RootNamespace>-->
<Authors>$(Company) Team</Authors>
</PropertyGroup>
<PropertyGroup Condition="'$(SolutionDir)' != ''">
<RootNamespace>$(Company).$(MSBuildProjectDirectory.Replace($(SolutionDir), "").Replace("/",".").Replace("\","."))</RootNamespace>
</PropertyGroup>
<!-- <PropertyGroup Condition="'$(SolutionDir)' != ''">-->
<!-- <RootNamespace>$(Company).$(MSBuildProjectDirectory.Replace($(SolutionDir), "").Replace("/",".").Replace("\","."))</RootNamespace>-->
<!-- </PropertyGroup>-->
</Project>

View File

@ -1,8 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<!-- <Import Project="../../InnovEnergy.Lib.props"/>-->
<Import Project="../../InnovEnergy.Lib.props"/>
<Import Project="../../../App/InnovEnergy.App.props" />
<ItemGroup>
<ProjectReference Include="../../Protocols/Modbus/Modbus.csproj" />
<ProjectReference Include="../../Utils/Utils.csproj" />

View File

@ -1,8 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configurations>Debug;Release;Release-Server</Configurations>
<Platforms>AnyCPU;linux-arm</Platforms>
</PropertyGroup>
<Import Project="../../InnovEnergy.Lib.props" />
<ItemGroup>

View File

@ -1,8 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<!-- <Import Project="../../InnovEnergy.Lib.props" />-->
<Import Project="../../InnovEnergy.Lib.props" />
<Import Project="../../../App/InnovEnergy.App.props" />
<ItemGroup>
<ProjectReference Include="../../Protocols/Modbus/Modbus.csproj" />
<ProjectReference Include="../../Units/Units.csproj" />

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<!-- <Import Project="../../InnovEnergy.Lib.props" />-->
<Import Project="../../../App/InnovEnergy.App.props" />
<Import Project="../../InnovEnergy.Lib.props" />
<ItemGroup>
<ProjectReference Include="../../Protocols/Modbus/Modbus.csproj" />
<ProjectReference Include="../../StatusApi/StatusApi.csproj" />

View File

@ -23,6 +23,10 @@ public partial class Battery48TlRecord
public Strings Alarms => ParseAlarms() .OrderBy(w => w).ToList();
public Percent Soc => _Soc;
public Current BusCurrent => _BusCurrent;
public Current HeatingCurrent => _BusCurrent - _CellsCurrent;
public readonly struct Leds_
{
@ -65,9 +69,9 @@ public partial class Battery48TlRecord
public readonly struct Dc_
{
public Voltage Voltage => Self._DcVoltage;
public Current Current => Self._DcCurrent;
public ActivePower Power => Self._DcVoltage * Self._DcCurrent;
public Voltage Voltage => Self._CellsVoltage;
public Current Current => Self._CellsCurrent;
public ActivePower Power => Self._CellsVoltage * Self._CellsCurrent;
internal Dc_(Battery48TlRecord self) => Self = self;
private Battery48TlRecord Self { get; }

View File

@ -1,7 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using InnovEnergy.Lib.Devices.Battery48TL.DataTypes;
using InnovEnergy.Lib.Protocols.Modbus.Reflection.Attributes;
using InnovEnergy.Lib.SrcGen.Attributes;
namespace InnovEnergy.Lib.Devices.Battery48TL;
#pragma warning disable CS0169, CS0649
@ -18,8 +17,10 @@ public partial class Battery48TlRecord
[InputRegister<UInt64>(1009)] private UInt64 _AlarmFlags;
[InputRegister(1013)] private UInt16 _IoStates;
[InputRegister(999, Scale = 0.01)] private Double _DcVoltage;
[InputRegister(1000, Scale = 0.01, Offset = -10000)] private Double _DcCurrent;
[InputRegister(999, Scale = 0.01)] private Double _CellsVoltage;
[InputRegister(1001, Scale = 0.01)] private Double _BusVoltage;
[InputRegister(1000, Scale = 0.01, Offset = -10000)] private Double _CellsCurrent;
[InputRegister(1062, Scale = 0.01, Offset = -10000)] private Double _BusCurrent;
[InputRegister(1053, Scale = 0.1)] private Double _Soc;

View File

@ -1,8 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<!-- <Import Project="../../InnovEnergy.Lib.props" />-->
<Import Project="../../../App/InnovEnergy.App.props" />
<Import Project="../../InnovEnergy.Lib.props" />
<ItemGroup>
<ProjectReference Include="../../Utils/Utils.csproj" />
<ProjectReference Include="../../Protocols/Modbus/Modbus.csproj" />

View File

@ -1,14 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configurations>Debug;Release;Release-Server</Configurations>
<Platforms>AnyCPU;linux-arm</Platforms>
</PropertyGroup>
<Import Project="../InnovEnergy.Lib.props" />
<ItemGroup>
<ProjectReference Include="../Utils/Utils.csproj" />
<ProjectReference Include="../Time/Time.csproj" />
<ProjectReference Include="../SrcGen/SrcGen.csproj" />
</ItemGroup>
<!-- <Target Name="PreBuild" BeforeTargets="PreBuildEvent">-->

View File

@ -0,0 +1,15 @@
// TODO remove for .Net 7
namespace System.Runtime.CompilerServices
{
public class RequiredMemberAttribute : Attribute { }
public class CompilerFeatureRequiredAttribute : Attribute
{
public CompilerFeatureRequiredAttribute(string name) { }
}
}
namespace System.Diagnostics.CodeAnalysis
{
public class SetsRequiredMembersAttribute : Attribute { }
}

View File

@ -112,7 +112,7 @@ public class TextBlock
return new TextBlock(alignedLines);
}
public static TextBlock CenterHorizontal(params Object[] things)
public static TextBlock CenterHorizontal(IReadOnlyList<Object> things)
{
var lines = things
.SelectMany(GetLines)
@ -127,6 +127,10 @@ public class TextBlock
return new TextBlock(alignedLines);
}
public static TextBlock CenterHorizontal(params Object[] things)
{
return CenterHorizontal((IReadOnlyList<Object>)things);
}
public static TextBlock AlignTop(params Object[] things)
{

View File

@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.0",
"version": "7.0.0",
"rollForward": "latestMajor",
"allowPrerelease": true
}

View File

@ -15,7 +15,7 @@ import NavigationButtons from "./components/Layout/NavigationButtons";
import InstallationPage from "./components/Installations/InstallationPage";
import { UserContext } from "./components/Context/UserContextProvider";
import ResetPassword from "./ResetPassword";
import innovenergyLogo from "./resources/innovenergy_Logo_onOrange-2.png(1).png";
import innovenergyLogo from "./resources/test.gif";
import { Background } from "reactflow";
const App = () => {

View File

@ -88,6 +88,7 @@ const InstallationList = (props: InstallationListProps) => {
<ListItemButton
id={"installation-list-button-" + installation.id}
selected={installation.id === Number(routeMatch?.params.id)}
disableRipple
sx={{
mr: "1px",
borderStyle: "solid",

View File

@ -66,6 +66,7 @@ const CheckboxTree = () => {
<Checkbox
checked={!!checked}
onClick={(e) => handleClick(e, element, checked)}
color="info"
/>
)}
{splitName[splitName.length - 1]}
@ -89,19 +90,21 @@ const CheckboxTree = () => {
<>
{toggles !== null && routeMatch !== null && (
<>
<Divider sx={{ mt: 2 }} />
<TreeView
defaultCollapseIcon={<ExpandMoreIcon />}
defaultExpandIcon={<ChevronRightIcon />}
sx={{
marginTop: 2,
flexGrow: 100,
overflow: "auto",
overflowX: "hidden",
position: ["sticky", "-webkit-sticky"],
top: 1,
maxHeight: "90vh",
borderBottomLeftRadius: 5,
borderBottomRightRadius: 5,
borderBottomLeftRadius: 7,
borderBottomRightRadius: 7,
borderTopLeftRadius: 7,
borderTopRightRadius: 7,
}}
>
{renderTree(toggles)}

View File

@ -13,7 +13,6 @@ interface DateRangePickerProps {
range: Date[];
getCacheSeries: (xaxisRange0: Date, xaxisRange1: Date) => void;
}
const DateRangePicker = (props: DateRangePickerProps) => {
const { setRange, range, getCacheSeries } = props;
@ -46,19 +45,19 @@ const DateRangePicker = (props: DateRangePickerProps) => {
}
}}
/>
<DatePicker
disableFuture
minDate={dayjs(range[0])}
label="To date"
value={dayjs(range[1])}
sx={{
".MuiInputLabel-root": {
color: "#2b3e54",
},
".Mui-disabled": {
color: "red",
},
".MuiPickersDay-root .Mui-selected": {
backgroundColor: "red",
},
}}
onChange={(newValue) => {
if (newValue) {

View File

@ -11,6 +11,13 @@ const root = ReactDOM.createRoot(
);
const theme = createTheme({
components: {
MuiButtonBase: {
defaultProps: {
disableRipple: true,
},
},
},
palette: {
text: {
primary: "#2b3e54",
@ -28,6 +35,7 @@ const theme = createTheme({
main: "#90a7c5",
},
},
typography: {
fontFamily: `"Ubuntu", sans-serif`,
fontWeightRegular: 300,

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

20572
typescript/Web/db_v1139.json Normal file

File diff suppressed because it is too large Load Diff