From 7d0dd2569608ec07991cdaa2c9484c87f4d6a771 Mon Sep 17 00:00:00 2001 From: atef Date: Mon, 3 Jul 2023 14:21:00 +0200 Subject: [PATCH 1/6] add heating and total current value to battery records --- .../Lib/Devices/Battery48TL/Battery48TlRecord.Api.cs | 10 +++++++--- .../Devices/Battery48TL/Battery48TlRecord.Modbus.cs | 6 ++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/csharp/Lib/Devices/Battery48TL/Battery48TlRecord.Api.cs b/csharp/Lib/Devices/Battery48TL/Battery48TlRecord.Api.cs index 40d925310..9f99e104c 100644 --- a/csharp/Lib/Devices/Battery48TL/Battery48TlRecord.Api.cs +++ b/csharp/Lib/Devices/Battery48TL/Battery48TlRecord.Api.cs @@ -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; } diff --git a/csharp/Lib/Devices/Battery48TL/Battery48TlRecord.Modbus.cs b/csharp/Lib/Devices/Battery48TL/Battery48TlRecord.Modbus.cs index 45e41f8a5..e2bf89a13 100644 --- a/csharp/Lib/Devices/Battery48TL/Battery48TlRecord.Modbus.cs +++ b/csharp/Lib/Devices/Battery48TL/Battery48TlRecord.Modbus.cs @@ -17,8 +17,10 @@ public partial class Battery48TlRecord [InputRegister(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; From c0c65c2bb8153520fc25c7520bb7e3b17195e0e9 Mon Sep 17 00:00:00 2001 From: atef Date: Mon, 3 Jul 2023 14:21:18 +0200 Subject: [PATCH 2/6] Add Log Error and log Warning --- csharp/App/SaliMax/src/Logger.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/csharp/App/SaliMax/src/Logger.cs b/csharp/App/SaliMax/src/Logger.cs index f89ecb653..666cad058 100644 --- a/csharp/App/SaliMax/src/Logger.cs +++ b/csharp/App/SaliMax/src/Logger.cs @@ -24,4 +24,16 @@ public static class Logger _logger.LogDebug(t.ToString()); // TODO: check warning return t; } + + public static T LogError(this T t) where T : notnull + { + _logger.LogError(t.ToString()); // TODO: check warning + return t; + } + + public static T LogWarning(this T t) where T : notnull + { + _logger.LogWarning(t.ToString()); // TODO: check warning + return t; + } } \ No newline at end of file From 1c4e2dee2ee3a090e1a1af462b1c15952858efff Mon Sep 17 00:00:00 2001 From: atef Date: Mon, 3 Jul 2023 14:23:05 +0200 Subject: [PATCH 3/6] Add to display string --- csharp/App/SaliMax/src/Program.cs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/csharp/App/SaliMax/src/Program.cs b/csharp/App/SaliMax/src/Program.cs index 010d2a447..0de19fc93 100644 --- a/csharp/App/SaliMax/src/Program.cs +++ b/csharp/App/SaliMax/src/Program.cs @@ -249,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); @@ -268,16 +268,16 @@ internal static class Program 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.ToDisplayString(), - batterySoc.ToDisplayString(), - batteryCurrent.ToDisplayString(), - batteryTemp.ToDisplayString()) + var batteryAvgBox = TextBlock.AlignLeft(batteryVoltage, + batterySoc, + batteryCurrent, + batteryTemp) .TitleBox("Battery"); //////////////////// Batteries ///////////////////////// - IReadOnlyList batteryBoxes = s.Battery + var batteryBoxes = s.Battery .Devices .Select(CreateIndividualBattery) .ToArray(s.Battery.Devices.Count); @@ -304,10 +304,13 @@ internal static class Program 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.Heating); + battery.Temperatures.Cells.Average.ToDisplayString(), + battery.BusCurrent.ToDisplayString(), + battery.HeatingCurrent.ToDisplayString()); var box = content.TitleBox($"Battery {i + 1}"); @@ -434,6 +437,5 @@ internal static class Program Console.WriteLine(error); } } - } From 932fab50f78cd79e01bef8b204184189537a3a32 Mon Sep 17 00:00:00 2001 From: atef Date: Mon, 3 Jul 2023 14:23:19 +0200 Subject: [PATCH 4/6] Add $ to the value name --- csharp/App/SaliMax/run (SalimnaxProto Meiringen).sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/csharp/App/SaliMax/run (SalimnaxProto Meiringen).sh b/csharp/App/SaliMax/run (SalimnaxProto Meiringen).sh index f41f8ee9b..d2ed6e95d 100755 --- a/csharp/App/SaliMax/run (SalimnaxProto Meiringen).sh +++ b/csharp/App/SaliMax/run (SalimnaxProto Meiringen).sh @@ -18,17 +18,17 @@ 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 From 1bd62086ab24a9cab8e86b630268f77643b58fda Mon Sep 17 00:00:00 2001 From: atef Date: Mon, 3 Jul 2023 14:23:58 +0200 Subject: [PATCH 5/6] Comment and delete unused lines --- csharp/App/SaliMax/SaliMax.csproj | 6 +----- csharp/App/SaliMax/tunnelstoSalimax0001.sh | 2 +- csharp/InnovEnergy.props | 8 ++++---- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/csharp/App/SaliMax/SaliMax.csproj b/csharp/App/SaliMax/SaliMax.csproj index 8c66b470f..0360f4ae5 100644 --- a/csharp/App/SaliMax/SaliMax.csproj +++ b/csharp/App/SaliMax/SaliMax.csproj @@ -1,8 +1,4 @@ - - Debug;Release;Release-Server - AnyCPU;linux-arm - @@ -26,4 +22,4 @@ - \ No newline at end of file + diff --git a/csharp/App/SaliMax/tunnelstoSalimax0001.sh b/csharp/App/SaliMax/tunnelstoSalimax0001.sh index 4dd7a96af..f538423bb 100755 --- a/csharp/App/SaliMax/tunnelstoSalimax0001.sh +++ b/csharp/App/SaliMax/tunnelstoSalimax0001.sh @@ -1,4 +1,4 @@ -j#!/bin/bash +#!/bin/bash host=ie-entwicklung@10.2.3.104 diff --git a/csharp/InnovEnergy.props b/csharp/InnovEnergy.props index b1a90c16d..106c6030a 100644 --- a/csharp/InnovEnergy.props +++ b/csharp/InnovEnergy.props @@ -9,12 +9,12 @@ net6.0 true false - Please.reload.the.project.Rider.is.stupid + $(Company) Team - - $(Company).$(MSBuildProjectDirectory.Replace($(SolutionDir), "").Replace("/",".").Replace("\",".")) - + + + \ No newline at end of file From 735c266f0e120ecdba8e353cd077989badbaeb64 Mon Sep 17 00:00:00 2001 From: Sina Blattmann Date: Mon, 3 Jul 2023 14:33:37 +0200 Subject: [PATCH 6/6] change tabs components so they're not redundant anymore, left them in there for now tho so Noe can work on the style --- .../src/components/Groups/GroupTabs.tsx | 24 +++------- .../Installations/InstallationTabs.tsx | 28 ++++-------- .../Installations/Log/CheckboxTree.tsx | 9 ++-- .../Installations/Log/DateRangePicker.tsx | 5 +++ .../Installations/Log/ScalarGraph.tsx | 2 +- .../src/components/Layout/InnovenergyTab.tsx | 41 +++++++++++++++++ .../src/components/Layout/InnovenergyTabs.tsx | 42 +++++++++++++++++ .../src/components/Layout/ModeButtons.tsx | 17 ------- .../components/Layout/NavigationButtons.tsx | 45 +++---------------- .../src/components/Users/UserTabs.tsx | 18 ++++---- typescript/Frontend/src/library.scss | 1 + typescript/Frontend/tsconfig.json | 1 + 12 files changed, 129 insertions(+), 104 deletions(-) create mode 100644 typescript/Frontend/src/components/Layout/InnovenergyTab.tsx create mode 100644 typescript/Frontend/src/components/Layout/InnovenergyTabs.tsx create mode 100644 typescript/Frontend/src/library.scss diff --git a/typescript/Frontend/src/components/Groups/GroupTabs.tsx b/typescript/Frontend/src/components/Groups/GroupTabs.tsx index 7bddabd7a..dd473d39b 100644 --- a/typescript/Frontend/src/components/Groups/GroupTabs.tsx +++ b/typescript/Frontend/src/components/Groups/GroupTabs.tsx @@ -5,11 +5,8 @@ import useRouteMatch from "../../hooks/useRouteMatch"; import { useIntl } from "react-intl"; import { GroupContext } from "../Context/GroupContextProvider"; import { useContext } from "react"; -import { - AntTabs, - StyledTab, - StyledTabBlue, -} from "../../util/installation.util"; +import InnovenergyTab from "../Layout/InnovenergyTab"; +import InnovenergyTabs from "components/Layout/InnovenergyTabs"; const GroupTabs = () => { const routeMatch = useRouteMatch([ @@ -26,16 +23,9 @@ const GroupTabs = () => { return ( - + {currentType === "Folder" ? ( - { to={routes.folder + id} /> ) : ( - { /> )} - { component={Link} to={routes.manageAccess + id} /> - + ); diff --git a/typescript/Frontend/src/components/Installations/InstallationTabs.tsx b/typescript/Frontend/src/components/Installations/InstallationTabs.tsx index 63a57e2b5..39ea23694 100644 --- a/typescript/Frontend/src/components/Installations/InstallationTabs.tsx +++ b/typescript/Frontend/src/components/Installations/InstallationTabs.tsx @@ -4,14 +4,8 @@ import { Link } from "react-router-dom"; import routes from "../../routes.json"; import useRouteMatch from "../../hooks/useRouteMatch"; import { useIntl } from "react-intl"; -import { - AntTabs, - StyledTab, - StyledTabBlue, - StyledTabWhite, -} from "../../util/installation.util"; -import { colors } from "@mui/material"; -import { Background } from "reactflow"; +import InnovenergyTab from "../Layout/InnovenergyTab"; +import InnovenergyTabs from "components/Layout/InnovenergyTabs"; const InstallationTabs = () => { const routeMatch = useRouteMatch([ @@ -27,15 +21,11 @@ const InstallationTabs = () => { return ( - - { component={Link} to={routes.installation + id} /> - { component={Link} to={routes.liveView + id} /> - { component={Link} to={routes.log + id} /> - + ); diff --git a/typescript/Frontend/src/components/Installations/Log/CheckboxTree.tsx b/typescript/Frontend/src/components/Installations/Log/CheckboxTree.tsx index 06a43c33c..615aa40f9 100644 --- a/typescript/Frontend/src/components/Installations/Log/CheckboxTree.tsx +++ b/typescript/Frontend/src/components/Installations/Log/CheckboxTree.tsx @@ -7,7 +7,7 @@ import ChevronRightIcon from "@mui/icons-material/ChevronRight"; import useRouteMatch from "../../../hooks/useRouteMatch"; import routes from "../../../routes.json"; import React from "react"; -import { blueGrey } from "@mui/material/colors"; +import "library.scss"; export interface ToggleElement { [key: string]: boolean; @@ -72,8 +72,11 @@ const CheckboxTree = () => { } sx={{ - ".MuiTreeItem-content": { paddingY: "5px" }, - bgcolor: "#CCD6E4", + ".MuiTreeItem-content": { + paddingY: "5px", + minHeight: "52px", + }, + bgcolor: "$innovenergy-orange", }} > {getNodes(element)} diff --git a/typescript/Frontend/src/components/Installations/Log/DateRangePicker.tsx b/typescript/Frontend/src/components/Installations/Log/DateRangePicker.tsx index e6fe2b1f1..c93da8de2 100644 --- a/typescript/Frontend/src/components/Installations/Log/DateRangePicker.tsx +++ b/typescript/Frontend/src/components/Installations/Log/DateRangePicker.tsx @@ -13,6 +13,7 @@ interface DateRangePickerProps { range: Date[]; getCacheSeries: (xaxisRange0: Date, xaxisRange1: Date) => void; } + const DateRangePicker = (props: DateRangePickerProps) => { const { setRange, range, getCacheSeries } = props; @@ -45,6 +46,7 @@ const DateRangePicker = (props: DateRangePickerProps) => { } }} /> + { ".Mui-disabled": { color: "red", }, + ".MuiPickersDay-root .Mui-selected": { + backgroundColor: "red", + }, }} onChange={(newValue) => { if (newValue) { diff --git a/typescript/Frontend/src/components/Installations/Log/ScalarGraph.tsx b/typescript/Frontend/src/components/Installations/Log/ScalarGraph.tsx index 89a559628..ec9836eb4 100644 --- a/typescript/Frontend/src/components/Installations/Log/ScalarGraph.tsx +++ b/typescript/Frontend/src/components/Installations/Log/ScalarGraph.tsx @@ -60,7 +60,7 @@ export const fetchData = ( const ScalarGraph = () => { const timeRange = createTimes( UnixTime.now() /* .fromTicks(1682085650) */ - .rangeBefore(TimeSpan.fromDays(1)), + .rangeBefore(TimeSpan.fromDays(5)), NUMBER_OF_NODES ); const [timeSeries, setTimeSeries] = useState([]); diff --git a/typescript/Frontend/src/components/Layout/InnovenergyTab.tsx b/typescript/Frontend/src/components/Layout/InnovenergyTab.tsx new file mode 100644 index 000000000..43a04815f --- /dev/null +++ b/typescript/Frontend/src/components/Layout/InnovenergyTab.tsx @@ -0,0 +1,41 @@ +import { styled, SxProps, Tab, Tabs, Theme, useTheme } from "@mui/material"; +import { TabProps } from "@mui/material/Tab/Tab"; + +const InnovenergyTab = (props: any) => { + const theme = useTheme(); + return ( + + ); +}; + +export default InnovenergyTab; diff --git a/typescript/Frontend/src/components/Layout/InnovenergyTabs.tsx b/typescript/Frontend/src/components/Layout/InnovenergyTabs.tsx new file mode 100644 index 000000000..bf98f5510 --- /dev/null +++ b/typescript/Frontend/src/components/Layout/InnovenergyTabs.tsx @@ -0,0 +1,42 @@ +import { SxProps, Tabs, Theme } from "@mui/material"; +import { ReactNode } from "react"; + +interface AntTabsProps { + id: string; + value?: string; + sx?: SxProps; + children: ReactNode; +} + +const InnovenergyTabs = (props: AntTabsProps) => { + return ( + + {props.children} + + ); +}; + +export default InnovenergyTabs; diff --git a/typescript/Frontend/src/components/Layout/ModeButtons.tsx b/typescript/Frontend/src/components/Layout/ModeButtons.tsx index f71e513a2..344f4efb5 100644 --- a/typescript/Frontend/src/components/Layout/ModeButtons.tsx +++ b/typescript/Frontend/src/components/Layout/ModeButtons.tsx @@ -13,23 +13,6 @@ const ModeButtons = () => { return ( <> - {/* - } - value={routes.installations + routes.list + "*"} - component={Link} - to={routes.list} - /> - } - value={routes.installations + routes.tree + "*"} - component={Link} - to={routes.tree} - /> - */} { const routeMatch = useRouteMatch([ @@ -19,37 +14,11 @@ const NavigationButtons = () => { return ( <> - {/* - - - - - - - */} - - { /> } /> - } /> - + ); }; diff --git a/typescript/Frontend/src/components/Users/UserTabs.tsx b/typescript/Frontend/src/components/Users/UserTabs.tsx index 16d84292c..c2d60c5b4 100644 --- a/typescript/Frontend/src/components/Users/UserTabs.tsx +++ b/typescript/Frontend/src/components/Users/UserTabs.tsx @@ -3,11 +3,8 @@ import { Link } from "react-router-dom"; import routes from "../../routes.json"; import useRouteMatch from "../../hooks/useRouteMatch"; import { useIntl } from "react-intl"; -import { - AntTabs, - StyledTab, - StyledTabBlue, -} from "../../util/installation.util"; +import InnovenergyTab from "../Layout/InnovenergyTab"; +import InnovenergyTabs from "components/Layout/InnovenergyTabs"; const UserTabs = () => { const routeMatch = useRouteMatch([routes.users + routes.user + ":id"]); @@ -17,7 +14,7 @@ const UserTabs = () => { if (id) { return ( - { defaultMessage: "user tabs", })} > - { value={routes.users + routes.user + ":id"} component={Link} to={routes.user + id} + sx={{ + "&.Mui-selected": { + backgroundColor: "#CCD6E4", + }, + }} /> - + ); } return null; diff --git a/typescript/Frontend/src/library.scss b/typescript/Frontend/src/library.scss new file mode 100644 index 000000000..27a714e89 --- /dev/null +++ b/typescript/Frontend/src/library.scss @@ -0,0 +1 @@ +$innovenergy-orange: #F59100; diff --git a/typescript/Frontend/tsconfig.json b/typescript/Frontend/tsconfig.json index 423cb75a1..888329764 100644 --- a/typescript/Frontend/tsconfig.json +++ b/typescript/Frontend/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "baseUrl": "src", "target": "es5", "lib": [ "dom",