Fixed bugs regarding aggregated data, updated front-end
This commit is contained in:
parent
37bdd4a338
commit
38a14ca79b
|
@ -206,10 +206,12 @@ public static class Aggregator
|
|||
|
||||
var dMaxSoc = batterySoc.Any() ? batterySoc.Max() : 0.0;
|
||||
var dMinSoc = batterySoc.Any() ? batterySoc.Min() : 0.0;
|
||||
var dSumGridExportPower = gridPowerExport.Any() ? gridPowerExport.Max() : 0.0;
|
||||
var dSumGridImportPower = gridPowerImport.Any() ? gridPowerImport.Max() : 0.0;
|
||||
var dSumGridExportPower = gridPowerExport.Any() ? gridPowerExport.Max()/1000 : 0.0;
|
||||
var dSumGridImportPower = gridPowerImport.Any() ? gridPowerImport.Max()/1000 : 0.0;
|
||||
var dSumPvPower = pvPowerSum.Any() ? pvPowerSum.Max() : 0.0;
|
||||
|
||||
Console.WriteLine("-------------------------------------------------------------------"+dSumPvPower);
|
||||
|
||||
AggregatedData aggregatedData = new AggregatedData
|
||||
{
|
||||
MaxSoc = dMaxSoc,
|
||||
|
@ -254,7 +256,7 @@ public static class Aggregator
|
|||
var heatingPowerAvg = new List<Double>();
|
||||
|
||||
|
||||
Console.WriteLine("-----------------------------------------------------------------------------------------------------------------");
|
||||
|
||||
Console.WriteLine("File timestamp should start after "+ afterTimestamp);
|
||||
|
||||
foreach (var csvFile in csvFiles)
|
||||
|
@ -346,6 +348,8 @@ public static class Aggregator
|
|||
};
|
||||
|
||||
// Print the stored CSV data for verification
|
||||
Console.WriteLine($"Pv Power: {aggregatedData.PvPower}");
|
||||
Console.WriteLine($"Heating Power: {aggregatedData.HeatingPower}");
|
||||
Console.WriteLine($"Max SOC: {aggregatedData.MaxSoc}");
|
||||
Console.WriteLine($"Min SOC: {aggregatedData.MinSoc}");
|
||||
|
||||
|
@ -355,7 +359,6 @@ public static class Aggregator
|
|||
Console.WriteLine($"SumGridExportPower: {aggregatedData.GridExportPower}");
|
||||
Console.WriteLine($"SumGridImportPower: {aggregatedData.GridImportPower}");
|
||||
|
||||
Console.WriteLine($"Min SOC: {aggregatedData.MinSoc}");
|
||||
|
||||
|
||||
Console.WriteLine("CSV data reading and storage completed.");
|
||||
|
|
|
@ -66,7 +66,7 @@ public class AggregatedData
|
|||
if (_S3Config is null)
|
||||
return false;
|
||||
|
||||
var s3Path = DateTime.Now.ToString("yyyy-MM-dd") + ".csv";
|
||||
var s3Path = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + ".csv";
|
||||
var request = _S3Config.CreatePutRequest(s3Path);
|
||||
var response = await request.PutAsync(new StringContent(csv));
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
"list": "list/",
|
||||
"overview": "overview",
|
||||
"manage": "manage",
|
||||
"batteryview": "batteryview",
|
||||
"log": "log",
|
||||
"information": "information",
|
||||
"configuration": "configuration",
|
||||
|
|
|
@ -0,0 +1,176 @@
|
|||
import React from 'react';
|
||||
import {
|
||||
Paper,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableContainer,
|
||||
TableHead,
|
||||
TableRow,
|
||||
useTheme
|
||||
} from '@mui/material';
|
||||
import { TopologyValues } from '../Log/graph.util';
|
||||
|
||||
interface BatteryViewProps {
|
||||
values: TopologyValues;
|
||||
}
|
||||
|
||||
function BatteryView(props: BatteryViewProps) {
|
||||
if (props.values === null) {
|
||||
return null;
|
||||
}
|
||||
const theme = useTheme();
|
||||
|
||||
const numOfBatteries = props.values.batteryView.values[0].value
|
||||
.toString()
|
||||
.split(',').length;
|
||||
|
||||
const batteryData = [];
|
||||
let batteryId = 1;
|
||||
|
||||
// Use a for loop to generate battery data
|
||||
for (let index = 1; index <= numOfBatteries * 7; index += 7) {
|
||||
const battery = {
|
||||
BatteryId: 'Battery ' + batteryId.toString(),
|
||||
FwVersion: props.values.batteryView.values[index].value,
|
||||
Power:
|
||||
Number(props.values.batteryView.values[index + 1].value).toFixed(2) +
|
||||
' ' +
|
||||
props.values.batteryView.values[index + 1].unit,
|
||||
Voltage:
|
||||
Number(props.values.batteryView.values[index + 2].value).toFixed(2) +
|
||||
' ' +
|
||||
props.values.batteryView.values[index + 2].unit,
|
||||
Soc:
|
||||
props.values.batteryView.values[index + 3].value +
|
||||
' ' +
|
||||
props.values.batteryView.values[index + 3].unit,
|
||||
AverageTemperature:
|
||||
props.values.batteryView.values[index + 4].value +
|
||||
' ' +
|
||||
props.values.batteryView.values[index + 4].unit,
|
||||
|
||||
Warnings: props.values.batteryView.values[index + 5].value,
|
||||
Alarms: props.values.batteryView.values[index + 6].value
|
||||
};
|
||||
batteryId++;
|
||||
batteryData.push(battery);
|
||||
}
|
||||
|
||||
return (
|
||||
<TableContainer component={Paper}>
|
||||
<Table sx={{ minWidth: 650 }} aria-label="simple table">
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableCell align="center">Battery</TableCell>
|
||||
<TableCell align="center">Firmware</TableCell>
|
||||
<TableCell align="center">Power</TableCell>
|
||||
<TableCell align="center">Voltage</TableCell>
|
||||
<TableCell align="center">SoC</TableCell>
|
||||
<TableCell align="center">Temperature</TableCell>
|
||||
<TableCell align="center">Warnings</TableCell>
|
||||
<TableCell align="center">Alarms</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{batteryData.map((battery) => (
|
||||
<TableRow
|
||||
key={battery.BatteryId}
|
||||
style={{
|
||||
height: '10px'
|
||||
}}
|
||||
>
|
||||
<TableCell
|
||||
component="th"
|
||||
scope="row"
|
||||
align="center"
|
||||
sx={{ fontWeight: 'bold' }}
|
||||
>
|
||||
{battery.BatteryId}
|
||||
</TableCell>
|
||||
<TableCell
|
||||
sx={{
|
||||
width: '10%',
|
||||
textAlign: 'center'
|
||||
}}
|
||||
>
|
||||
{battery.FwVersion}
|
||||
</TableCell>
|
||||
<TableCell
|
||||
sx={{
|
||||
width: '10%',
|
||||
textAlign: 'center'
|
||||
}}
|
||||
>
|
||||
{battery.Power}
|
||||
</TableCell>
|
||||
<TableCell
|
||||
sx={{
|
||||
width: '10%',
|
||||
textAlign: 'center',
|
||||
|
||||
backgroundColor:
|
||||
battery.Voltage < 44 || battery.Voltage > 57
|
||||
? '#FF033E'
|
||||
: '#32CD32',
|
||||
color: battery.Voltage === '' ? 'white' : 'inherit'
|
||||
}}
|
||||
>
|
||||
{battery.Voltage}
|
||||
</TableCell>
|
||||
<TableCell
|
||||
sx={{
|
||||
width: '10%',
|
||||
textAlign: 'center',
|
||||
backgroundColor:
|
||||
battery.Soc < 20
|
||||
? '#FF033E'
|
||||
: battery.Soc < 50
|
||||
? '#ffbf00 '
|
||||
: '#32CD32',
|
||||
color: battery.Soc === '' ? 'white' : 'inherit'
|
||||
}}
|
||||
>
|
||||
{battery.Soc}
|
||||
</TableCell>
|
||||
<TableCell
|
||||
sx={{
|
||||
width: '10%',
|
||||
textAlign: 'center',
|
||||
backgroundColor:
|
||||
battery.AverageTemperature > 270 ? '#FF033E' : '#32CD32 '
|
||||
}}
|
||||
>
|
||||
{battery.AverageTemperature}
|
||||
</TableCell>
|
||||
|
||||
<TableCell
|
||||
style={{
|
||||
width: '15%',
|
||||
textAlign: 'center',
|
||||
padding: '8px',
|
||||
backgroundColor:
|
||||
battery.Warnings === '' ? 'inherit' : 'FF033E'
|
||||
}}
|
||||
>
|
||||
{battery.Warnings === '' ? 'None' : battery.Warnings}
|
||||
</TableCell>
|
||||
<TableCell
|
||||
sx={{
|
||||
width: '15%',
|
||||
textAlign: 'center',
|
||||
marginLeft: '10px',
|
||||
backgroundColor: battery.Alarms === '' ? 'inherit' : 'FF033E'
|
||||
}}
|
||||
>
|
||||
{battery.Alarms === '' ? 'None' : battery.Alarms}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
);
|
||||
}
|
||||
|
||||
export default BatteryView;
|
|
@ -35,6 +35,7 @@ import Overview from '../Overview/overview';
|
|||
import Configuration from '../Configuration/Configuration';
|
||||
import { fetchData } from 'src/content/dashboards/Installations/fetchData';
|
||||
import CancelIcon from '@mui/icons-material/Cancel';
|
||||
import BatteryView from '../BatteryView/BatteryView';
|
||||
|
||||
interface singleInstallationProps {
|
||||
current_installation?: I_Installation;
|
||||
|
@ -168,13 +169,15 @@ function Installation(props: singleInstallationProps) {
|
|||
useEffect(() => {
|
||||
if (
|
||||
installationId == props.current_installation.id &&
|
||||
(currentTab == 'live' || currentTab == 'configuration')
|
||||
(currentTab == 'live' ||
|
||||
currentTab == 'configuration' ||
|
||||
currentTab == 'batteryview')
|
||||
) {
|
||||
//let isMounted = true;
|
||||
setFormValues(props.current_installation);
|
||||
var interval;
|
||||
|
||||
if (currentTab == 'live') {
|
||||
if (currentTab == 'live' || currentTab == 'batteryview') {
|
||||
interval = setInterval(fetchDataPeriodically, 2000);
|
||||
}
|
||||
if (currentTab == 'configuration') {
|
||||
|
@ -184,7 +187,7 @@ function Installation(props: singleInstallationProps) {
|
|||
// Cleanup function to cancel interval and update isMounted when unmounted
|
||||
return () => {
|
||||
//isMounted = false;
|
||||
if (currentTab == 'live') {
|
||||
if (currentTab == 'live' || currentTab == 'batteryview') {
|
||||
clearInterval(interval);
|
||||
}
|
||||
};
|
||||
|
@ -660,6 +663,9 @@ function Installation(props: singleInstallationProps) {
|
|||
{currentTab === 'overview' && (
|
||||
<Overview s3Credentials={s3Credentials}></Overview>
|
||||
)}
|
||||
{currentTab === 'batteryview' && (
|
||||
<BatteryView values={values}></BatteryView>
|
||||
)}
|
||||
{currentTab === 'configuration' && currentUser.hasWriteAccess && (
|
||||
<Configuration
|
||||
values={values}
|
||||
|
|
|
@ -79,7 +79,6 @@ function InstallationTabs() {
|
|||
) {
|
||||
setCurrentTab('list');
|
||||
}
|
||||
|
||||
if (installationId) {
|
||||
if (currentTab == 'list' || currentTab == 'tree') {
|
||||
navigate(`?installation=${installationId}&tab=live`, {
|
||||
|
@ -105,11 +104,14 @@ function InstallationTabs() {
|
|||
value: 'live',
|
||||
label: <FormattedMessage id="live" defaultMessage="Live" />
|
||||
},
|
||||
|
||||
{
|
||||
value: 'overview',
|
||||
label: <FormattedMessage id="overview" defaultMessage="Overview" />
|
||||
value: 'batteryview',
|
||||
label: (
|
||||
<FormattedMessage id="batteryview" defaultMessage="Battery View" />
|
||||
)
|
||||
},
|
||||
,
|
||||
|
||||
{
|
||||
value: 'manage',
|
||||
label: (
|
||||
|
@ -146,7 +148,12 @@ function InstallationTabs() {
|
|||
value: 'overview',
|
||||
label: <FormattedMessage id="overview" defaultMessage="Overview" />
|
||||
},
|
||||
,
|
||||
{
|
||||
value: 'batteryview',
|
||||
label: (
|
||||
<FormattedMessage id="batteryview" defaultMessage="Battery View" />
|
||||
)
|
||||
},
|
||||
{
|
||||
value: 'log',
|
||||
label: <FormattedMessage id="log" defaultMessage="Log" />
|
||||
|
@ -178,7 +185,15 @@ function InstallationTabs() {
|
|||
value: 'overview',
|
||||
label: <FormattedMessage id="overview" defaultMessage="Overview" />
|
||||
},
|
||||
,
|
||||
{
|
||||
value: 'batteryview',
|
||||
label: (
|
||||
<FormattedMessage
|
||||
id="batteryview"
|
||||
defaultMessage="Battery View"
|
||||
/>
|
||||
)
|
||||
},
|
||||
{
|
||||
value: 'manage',
|
||||
label: (
|
||||
|
@ -227,7 +242,15 @@ function InstallationTabs() {
|
|||
value: 'overview',
|
||||
label: <FormattedMessage id="overview" defaultMessage="Overview" />
|
||||
},
|
||||
,
|
||||
{
|
||||
value: 'batteryview',
|
||||
label: (
|
||||
<FormattedMessage
|
||||
id="batteryview"
|
||||
defaultMessage="Battery View"
|
||||
/>
|
||||
)
|
||||
},
|
||||
{
|
||||
value: 'log',
|
||||
label: <FormattedMessage id="log" defaultMessage="Log" />
|
||||
|
|
|
@ -76,6 +76,8 @@ export type TopologyValues = {
|
|||
DcDcNum: BoxData;
|
||||
calibrationChargeForced: BoxData;
|
||||
mode: BoxData;
|
||||
|
||||
batteryView: BoxData;
|
||||
};
|
||||
|
||||
type TopologyPaths = { [key in keyof TopologyValues]: string[] };
|
||||
|
@ -149,6 +151,89 @@ export const topologyPaths: TopologyPaths = {
|
|||
'/Battery/Devices/10/Dc/Voltage'
|
||||
],
|
||||
|
||||
batteryView: [
|
||||
'/Config/Devices/BatteryNodes',
|
||||
'/Battery/Devices/1/FwVersion',
|
||||
'/Battery/Devices/1/Dc/Power',
|
||||
'/Battery/Devices/1/Dc/Voltage',
|
||||
'/Battery/Devices/1/Soc',
|
||||
'/Battery/Devices/1/Temperatures/Cells/Average',
|
||||
'/Battery/Devices/1/Warnings',
|
||||
'/Battery/Devices/1/Alarms',
|
||||
|
||||
'/Battery/Devices/2/FwVersion',
|
||||
'/Battery/Devices/2/Dc/Power',
|
||||
'/Battery/Devices/2/Dc/Voltage',
|
||||
'/Battery/Devices/2/Soc',
|
||||
'/Battery/Devices/2/Temperatures/Cells/Average',
|
||||
'/Battery/Devices/2/Warnings',
|
||||
'/Battery/Devices/2/Alarms',
|
||||
|
||||
'/Battery/Devices/3/FwVersion',
|
||||
'/Battery/Devices/3/Dc/Power',
|
||||
'/Battery/Devices/3/Dc/Voltage',
|
||||
'/Battery/Devices/3/Soc',
|
||||
'/Battery/Devices/3/Temperatures/Cells/Average',
|
||||
'/Battery/Devices/3/Warnings',
|
||||
'/Battery/Devices/3/Alarms',
|
||||
|
||||
'/Battery/Devices/4/FwVersion',
|
||||
'/Battery/Devices/4/Dc/Power',
|
||||
'/Battery/Devices/4/Dc/Voltage',
|
||||
'/Battery/Devices/4/Soc',
|
||||
'/Battery/Devices/4/Temperatures/Cells/Average',
|
||||
'/Battery/Devices/4/Warnings',
|
||||
'/Battery/Devices/4/Alarms',
|
||||
|
||||
'/Battery/Devices/5/FwVersion',
|
||||
'/Battery/Devices/5/Dc/Power',
|
||||
'/Battery/Devices/5/Dc/Voltage',
|
||||
'/Battery/Devices/5/Soc',
|
||||
'/Battery/Devices/5/Temperatures/Cells/Average',
|
||||
'/Battery/Devices/5/Warnings',
|
||||
'/Battery/Devices/5/Alarms',
|
||||
|
||||
'/Battery/Devices/6/FwVersion',
|
||||
'/Battery/Devices/6/Dc/Power',
|
||||
'/Battery/Devices/6/Dc/Voltage',
|
||||
'/Battery/Devices/6/Soc',
|
||||
'/Battery/Devices/6/Temperatures/Cells/Average',
|
||||
'/Battery/Devices/6/Warnings',
|
||||
'/Battery/Devices/6/Alarms',
|
||||
|
||||
'/Battery/Devices/7/FwVersion',
|
||||
'/Battery/Devices/7/Dc/Power',
|
||||
'/Battery/Devices/7/Dc/Voltage',
|
||||
'/Battery/Devices/7/Soc',
|
||||
'/Battery/Devices/7/Temperatures/Cells/Average',
|
||||
'/Battery/Devices/7/Warnings',
|
||||
'/Battery/Devices/7/Alarms',
|
||||
|
||||
'/Battery/Devices/8/FwVersion',
|
||||
'/Battery/Devices/8/Dc/Power',
|
||||
'/Battery/Devices/8/Dc/Voltage',
|
||||
'/Battery/Devices/8/Soc',
|
||||
'/Battery/Devices/8/Temperatures/Cells/Average',
|
||||
'/Battery/Devices/8/Warnings',
|
||||
'/Battery/Devices/8/Alarms',
|
||||
|
||||
'/Battery/Devices/9/FwVersion',
|
||||
'/Battery/Devices/9/Dc/Power',
|
||||
'/Battery/Devices/9/Dc/Voltage',
|
||||
'/Battery/Devices/9/Soc',
|
||||
'/Battery/Devices/9/Temperatures/Cells/Average',
|
||||
'/Battery/Devices/9/Warnings',
|
||||
'/Battery/Devices/9/Alarms',
|
||||
|
||||
'/Battery/Devices/10/FwVersion',
|
||||
'/Battery/Devices/10/Dc/Power',
|
||||
'/Battery/Devices/10/Dc/Voltage',
|
||||
'/Battery/Devices/10/Soc',
|
||||
'/Battery/Devices/10/Temperatures/Cells/Average',
|
||||
'/Battery/Devices/10/Warnings',
|
||||
'/Battery/Devices/10/Alarms'
|
||||
],
|
||||
|
||||
minimumSoC: ['/Config/MinSoc'],
|
||||
installedDcDcPower: ['/DcDc/SystemControl/NumberOfConnectedSlaves'],
|
||||
gridSetPoint: ['/Config/GridSetPoint'],
|
||||
|
|
|
@ -259,11 +259,9 @@ export const getChartOptions = (
|
|||
? Math.ceil(chartInfo.min / findPower(chartInfo.min).value) *
|
||||
findPower(chartInfo.min).value
|
||||
: Math.abs(chartInfo.min) < 1
|
||||
? -Math.max(
|
||||
? +(
|
||||
Math.ceil(chartInfo.min / findPower(chartInfo.min).value) *
|
||||
findPower(chartInfo.min).value,
|
||||
Math.ceil(chartInfo.max / findPower(chartInfo.max).value) *
|
||||
findPower(chartInfo.max).value
|
||||
findPower(chartInfo.min).value
|
||||
).toFixed(2)
|
||||
: undefined,
|
||||
max:
|
||||
|
@ -275,9 +273,7 @@ export const getChartOptions = (
|
|||
: chartInfo.max <= 0
|
||||
? 0
|
||||
: Math.abs(chartInfo.min) < 1
|
||||
? +Math.max(
|
||||
Math.ceil(chartInfo.min / findPower(chartInfo.min).value) *
|
||||
findPower(chartInfo.min).value,
|
||||
? +(
|
||||
Math.ceil(chartInfo.max / findPower(chartInfo.max).value) *
|
||||
findPower(chartInfo.max).value
|
||||
).toFixed(2)
|
||||
|
|
|
@ -26,10 +26,10 @@ interface OverviewProps {
|
|||
const computeLast7Days = (): string[] => {
|
||||
const currentDate = new Date();
|
||||
const daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
||||
let currentDayIndex = currentDate.getDay() + 1;
|
||||
let currentDayIndex = currentDate.getDay();
|
||||
const last7Days = [];
|
||||
|
||||
for (let i = 0; i <= 7; i++) {
|
||||
for (let i = 0; i < 7; i++) {
|
||||
last7Days.push(daysOfWeek[currentDayIndex]);
|
||||
currentDayIndex++;
|
||||
if (currentDayIndex > 6) {
|
||||
|
@ -420,6 +420,7 @@ function Overview(props: OverviewProps) {
|
|||
<Button
|
||||
variant="contained"
|
||||
onClick={handle24HourData}
|
||||
disabled={loading}
|
||||
sx={{
|
||||
marginTop: '20px',
|
||||
backgroundColor: dailyData ? '#808080' : '#ffc04d',
|
||||
|
@ -432,6 +433,7 @@ function Overview(props: OverviewProps) {
|
|||
<Button
|
||||
variant="contained"
|
||||
onClick={handleWeekData}
|
||||
disabled={loading}
|
||||
sx={{
|
||||
marginTop: '20px',
|
||||
marginLeft: '10px',
|
||||
|
@ -445,6 +447,7 @@ function Overview(props: OverviewProps) {
|
|||
<Button
|
||||
variant="contained"
|
||||
onClick={handleMonthData}
|
||||
disabled={loading}
|
||||
sx={{
|
||||
marginTop: '20px',
|
||||
marginLeft: '10px',
|
||||
|
@ -460,6 +463,7 @@ function Overview(props: OverviewProps) {
|
|||
<Button
|
||||
variant="contained"
|
||||
onClick={handleSetDate}
|
||||
disabled={loading}
|
||||
sx={{
|
||||
marginTop: '20px',
|
||||
marginLeft: '10px',
|
||||
|
@ -789,10 +793,10 @@ function Overview(props: OverviewProps) {
|
|||
series={[
|
||||
{
|
||||
...dailyDataArray[chartState].chartData.soc,
|
||||
color: '#69d2e7'
|
||||
color: '#00ccff'
|
||||
}
|
||||
]}
|
||||
type="area"
|
||||
type="line"
|
||||
height={400}
|
||||
/>
|
||||
)}
|
||||
|
@ -898,10 +902,10 @@ function Overview(props: OverviewProps) {
|
|||
series={[
|
||||
{
|
||||
...dailyDataArray[chartState].chartData.dcPower,
|
||||
color: '#69d2e7'
|
||||
color: '#00ccff'
|
||||
}
|
||||
]}
|
||||
type="area"
|
||||
type="line"
|
||||
height={400}
|
||||
/>
|
||||
)}
|
||||
|
@ -920,6 +924,10 @@ function Overview(props: OverviewProps) {
|
|||
...weeklyDataArray.chartData.dcChargingPower,
|
||||
color: '#69d2e7'
|
||||
},
|
||||
{
|
||||
...weeklyDataArray.chartData.heatingPower,
|
||||
color: '#000000'
|
||||
},
|
||||
{
|
||||
...weeklyDataArray.chartData.dcDischargingPower,
|
||||
color: '#008FFB'
|
||||
|
@ -957,6 +965,132 @@ function Overview(props: OverviewProps) {
|
|||
</Grid>
|
||||
</Grid>
|
||||
|
||||
{dailyData && currentUser.hasWriteAccess && (
|
||||
<Grid
|
||||
container
|
||||
direction="row"
|
||||
justifyContent="center"
|
||||
alignItems="stretch"
|
||||
spacing={3}
|
||||
>
|
||||
<Grid item md={6} xs={12}>
|
||||
<Card
|
||||
sx={{
|
||||
overflow: 'visible',
|
||||
marginTop: '30px',
|
||||
marginBottom: '30px'
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
marginLeft: '20px'
|
||||
}}
|
||||
>
|
||||
<Box display="flex" alignItems="center">
|
||||
<Box>
|
||||
<Typography variant="subtitle1" noWrap>
|
||||
<FormattedMessage
|
||||
id="battery_temperature"
|
||||
defaultMessage="Battery Temperature"
|
||||
/>
|
||||
</Typography>
|
||||
</Box>
|
||||
</Box>
|
||||
<Box
|
||||
sx={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'flex-start',
|
||||
pt: 3
|
||||
}}
|
||||
></Box>
|
||||
</Box>
|
||||
<ReactApexChart
|
||||
options={{
|
||||
...getChartOptions(
|
||||
dailyDataArray[chartState].chartOverview
|
||||
.temperature,
|
||||
'daily',
|
||||
[]
|
||||
),
|
||||
chart: {
|
||||
events: {
|
||||
beforeZoom: handleBeforeZoom
|
||||
}
|
||||
}
|
||||
}}
|
||||
series={[
|
||||
{
|
||||
...dailyDataArray[chartState].chartData.temperature,
|
||||
color: '#00ccff'
|
||||
}
|
||||
]}
|
||||
type="line"
|
||||
height={400}
|
||||
/>
|
||||
</Card>
|
||||
</Grid>
|
||||
<Grid item md={6} xs={12}>
|
||||
<Card
|
||||
sx={{
|
||||
overflow: 'visible',
|
||||
marginTop: '30px',
|
||||
marginBottom: '30px'
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
marginLeft: '20px'
|
||||
}}
|
||||
>
|
||||
<Box display="flex" alignItems="center">
|
||||
<Box>
|
||||
<Typography variant="subtitle1" noWrap>
|
||||
<FormattedMessage
|
||||
id="dc_voltage"
|
||||
defaultMessage="DC Bus Voltage"
|
||||
/>
|
||||
</Typography>
|
||||
</Box>
|
||||
</Box>
|
||||
<Box
|
||||
sx={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'flex-start',
|
||||
pt: 3
|
||||
}}
|
||||
></Box>
|
||||
</Box>
|
||||
<ReactApexChart
|
||||
options={{
|
||||
...getChartOptions(
|
||||
dailyDataArray[chartState].chartOverview
|
||||
.dcBusVoltage,
|
||||
'daily',
|
||||
[]
|
||||
),
|
||||
chart: {
|
||||
events: {
|
||||
beforeZoom: handleBeforeZoom
|
||||
}
|
||||
}
|
||||
}}
|
||||
series={[
|
||||
{
|
||||
...dailyDataArray[chartState].chartData
|
||||
.dcBusVoltage,
|
||||
color: '#00ccff'
|
||||
}
|
||||
]}
|
||||
type="line"
|
||||
height={400}
|
||||
/>
|
||||
</Card>
|
||||
</Grid>
|
||||
</Grid>
|
||||
)}
|
||||
|
||||
{currentUser.hasWriteAccess && (
|
||||
<Grid
|
||||
container
|
||||
|
@ -1020,7 +1154,7 @@ function Overview(props: OverviewProps) {
|
|||
color: '#ff9900'
|
||||
}
|
||||
]}
|
||||
type="area"
|
||||
type="line"
|
||||
height={400}
|
||||
/>
|
||||
)}
|
||||
|
@ -1121,7 +1255,7 @@ function Overview(props: OverviewProps) {
|
|||
color: '#ff3333'
|
||||
}
|
||||
]}
|
||||
type="area"
|
||||
type="line"
|
||||
height={400}
|
||||
/>
|
||||
)}
|
||||
|
@ -1139,6 +1273,7 @@ function Overview(props: OverviewProps) {
|
|||
...weeklyDataArray.chartData.gridImportPower,
|
||||
color: '#b30000'
|
||||
},
|
||||
|
||||
{
|
||||
...weeklyDataArray.chartData.gridExportPower,
|
||||
color: '#ff3333'
|
||||
|
@ -1176,125 +1311,6 @@ function Overview(props: OverviewProps) {
|
|||
</Grid>
|
||||
</Grid>
|
||||
)}
|
||||
|
||||
{/*{dailyData && currentUser.hasWriteAccess && (*/}
|
||||
{/* <Grid*/}
|
||||
{/* container*/}
|
||||
{/* direction="row"*/}
|
||||
{/* justifyContent="center"*/}
|
||||
{/* alignItems="stretch"*/}
|
||||
{/* spacing={3}*/}
|
||||
{/* >*/}
|
||||
{/* <Grid item md={6} xs={12}>*/}
|
||||
{/* <Card*/}
|
||||
{/* sx={{*/}
|
||||
{/* overflow: 'visible',*/}
|
||||
{/* marginTop: '30px',*/}
|
||||
{/* marginBottom: '30px'*/}
|
||||
{/* }}*/}
|
||||
{/* >*/}
|
||||
{/* <Box*/}
|
||||
{/* sx={{*/}
|
||||
{/* marginLeft: '20px'*/}
|
||||
{/* }}*/}
|
||||
{/* >*/}
|
||||
{/* <Box display="flex" alignItems="center">*/}
|
||||
{/* <Box>*/}
|
||||
{/* <Typography variant="subtitle1" noWrap>*/}
|
||||
{/* <FormattedMessage*/}
|
||||
{/* id="battery_temperature"*/}
|
||||
{/* defaultMessage="Battery Temperature"*/}
|
||||
{/* />*/}
|
||||
{/* </Typography>*/}
|
||||
{/* </Box>*/}
|
||||
{/* </Box>*/}
|
||||
{/* <Box*/}
|
||||
{/* sx={{*/}
|
||||
{/* display: 'flex',*/}
|
||||
{/* alignItems: 'center',*/}
|
||||
{/* justifyContent: 'flex-start',*/}
|
||||
{/* pt: 3*/}
|
||||
{/* }}*/}
|
||||
{/* ></Box>*/}
|
||||
{/* </Box>*/}
|
||||
{/* <ReactApexChart*/}
|
||||
{/* options={{*/}
|
||||
{/* ...getChartOptions(*/}
|
||||
{/* dailyDataArray[chartState].chartOverview*/}
|
||||
{/* .temperature,*/}
|
||||
{/* 'daily',*/}
|
||||
{/* []*/}
|
||||
{/* ),*/}
|
||||
{/* chart: {*/}
|
||||
{/* events: {*/}
|
||||
{/* beforeZoom: handleBeforeZoom*/}
|
||||
{/* }*/}
|
||||
{/* }*/}
|
||||
{/* }}*/}
|
||||
{/* series={[*/}
|
||||
{/* dailyDataArray[chartState].chartData.temperature*/}
|
||||
{/* ]}*/}
|
||||
{/* type="area"*/}
|
||||
{/* height={400}*/}
|
||||
{/* />*/}
|
||||
{/* </Card>*/}
|
||||
{/* </Grid>*/}
|
||||
{/* <Grid item md={6} xs={12}>*/}
|
||||
{/* <Card*/}
|
||||
{/* sx={{*/}
|
||||
{/* overflow: 'visible',*/}
|
||||
{/* marginTop: '30px',*/}
|
||||
{/* marginBottom: '30px'*/}
|
||||
{/* }}*/}
|
||||
{/* >*/}
|
||||
{/* <Box*/}
|
||||
{/* sx={{*/}
|
||||
{/* marginLeft: '20px'*/}
|
||||
{/* }}*/}
|
||||
{/* >*/}
|
||||
{/* <Box display="flex" alignItems="center">*/}
|
||||
{/* <Box>*/}
|
||||
{/* <Typography variant="subtitle1" noWrap>*/}
|
||||
{/* <FormattedMessage*/}
|
||||
{/* id="dc_voltage"*/}
|
||||
{/* defaultMessage="DC Bus Voltage"*/}
|
||||
{/* />*/}
|
||||
{/* </Typography>*/}
|
||||
{/* </Box>*/}
|
||||
{/* </Box>*/}
|
||||
{/* <Box*/}
|
||||
{/* sx={{*/}
|
||||
{/* display: 'flex',*/}
|
||||
{/* alignItems: 'center',*/}
|
||||
{/* justifyContent: 'flex-start',*/}
|
||||
{/* pt: 3*/}
|
||||
{/* }}*/}
|
||||
{/* ></Box>*/}
|
||||
{/* </Box>*/}
|
||||
{/* <ReactApexChart*/}
|
||||
{/* options={{*/}
|
||||
{/* ...getChartOptions(*/}
|
||||
{/* dailyDataArray[chartState].chartOverview*/}
|
||||
{/* .dcBusVoltage,*/}
|
||||
{/* 'daily',*/}
|
||||
{/* []*/}
|
||||
{/* ),*/}
|
||||
{/* chart: {*/}
|
||||
{/* events: {*/}
|
||||
{/* beforeZoom: handleBeforeZoom*/}
|
||||
{/* }*/}
|
||||
{/* }*/}
|
||||
{/* }}*/}
|
||||
{/* series={[*/}
|
||||
{/* dailyDataArray[chartState].chartData.dcBusVoltage*/}
|
||||
{/* ]}*/}
|
||||
{/* type="area"*/}
|
||||
{/* height={400}*/}
|
||||
{/* />*/}
|
||||
{/* </Card>*/}
|
||||
{/* </Grid>*/}
|
||||
{/* </Grid>*/}
|
||||
{/*)}*/}
|
||||
</Grid>
|
||||
)}
|
||||
</Grid>
|
||||
|
|
|
@ -32,6 +32,7 @@ export interface chartAggregatedDataInterface {
|
|||
dcDischargingPower: { name: string; data: number[] };
|
||||
gridImportPower: { name: string; data: number[] };
|
||||
gridExportPower: { name: string; data: number[] };
|
||||
heatingPower: { name: string; data: number[] };
|
||||
}
|
||||
|
||||
export interface chartDataInterface {
|
||||
|
@ -257,7 +258,7 @@ export const transformInputToAggregatedData = async (
|
|||
const MAX_NUMBER = 9999999;
|
||||
const dateList = [];
|
||||
|
||||
let currentDate = dayjs().add(1, 'day');
|
||||
let currentDate = dayjs();
|
||||
let currentDay =
|
||||
type === 'weekly'
|
||||
? currentDate.subtract(1, 'week')
|
||||
|
@ -266,11 +267,12 @@ export const transformInputToAggregatedData = async (
|
|||
const pathsToSearch = [
|
||||
'/MinSoc',
|
||||
'/MaxSoc',
|
||||
'/SumPvPower',
|
||||
'/SumDischargingBatteryPower',
|
||||
'/SumChargingBatteryPower',
|
||||
'/SumGridImportPower',
|
||||
'/SumGridExportPower'
|
||||
'/PvPower',
|
||||
'/DischargingBatteryPower',
|
||||
'/ChargingBatteryPower',
|
||||
'/GridImportPower',
|
||||
'/GridExportPower',
|
||||
'/HeatingPower'
|
||||
];
|
||||
|
||||
const chartAggregatedData: chartAggregatedDataInterface = {
|
||||
|
@ -278,6 +280,7 @@ export const transformInputToAggregatedData = async (
|
|||
maxsoc: { name: 'max SOC', data: [] },
|
||||
pvProduction: { name: 'Pv Energy', data: [] },
|
||||
dcChargingPower: { name: 'Charging Battery Energy', data: [] },
|
||||
heatingPower: { name: 'Heating Power', data: [] },
|
||||
dcDischargingPower: { name: 'Discharging Battery Energy', data: [] },
|
||||
gridImportPower: { name: 'Grid Import Energy', data: [] },
|
||||
gridExportPower: { name: 'Grid Export Energy', data: [] }
|
||||
|
@ -313,6 +316,7 @@ export const transformInputToAggregatedData = async (
|
|||
}
|
||||
|
||||
const results = await Promise.all(timestampPromises);
|
||||
currentDay = currentDate.subtract(1, 'month');
|
||||
|
||||
for (let i = 0; i < results.length; i++) {
|
||||
const result = results[i];
|
||||
|
@ -332,13 +336,14 @@ export const transformInputToAggregatedData = async (
|
|||
if (result[path].value > overviewData[path].max) {
|
||||
overviewData[path].max = result[path].value;
|
||||
}
|
||||
if (path === '/SumGridExportPower' && result[path].value < 0.1) {
|
||||
if (path === '/GridExportPower' && result[path].value < 0.1) {
|
||||
result[path].value = 0.3;
|
||||
}
|
||||
data[path].push(result[path].value as number);
|
||||
}
|
||||
});
|
||||
}
|
||||
currentDay = currentDay.add(1, 'day');
|
||||
}
|
||||
|
||||
pathsToSearch.forEach((path) => {
|
||||
|
@ -371,7 +376,7 @@ export const transformInputToAggregatedData = async (
|
|||
max: 100
|
||||
};
|
||||
|
||||
path = '/SumPvPower';
|
||||
path = '/PvPower';
|
||||
chartAggregatedData.pvProduction.data = data[path];
|
||||
|
||||
chartOverview.pvProduction = {
|
||||
|
@ -381,60 +386,60 @@ export const transformInputToAggregatedData = async (
|
|||
max: overviewData[path].max
|
||||
};
|
||||
|
||||
path = '/SumChargingBatteryPower';
|
||||
path = '/ChargingBatteryPower';
|
||||
chartAggregatedData.dcChargingPower.data = data[path];
|
||||
|
||||
path = '/SumDischargingBatteryPower';
|
||||
path = '/DischargingBatteryPower';
|
||||
chartAggregatedData.dcDischargingPower.data = data[path];
|
||||
|
||||
path = '/HeatingPower';
|
||||
chartAggregatedData.heatingPower.data = data[path];
|
||||
|
||||
chartOverview.dcPower = {
|
||||
magnitude: Math.max(
|
||||
overviewData['/SumChargingBatteryPower'].magnitude,
|
||||
overviewData['/SumDischargingBatteryPower'].magnitude
|
||||
overviewData['/ChargingBatteryPower'].magnitude,
|
||||
overviewData['/HeatingPower'].magnitude,
|
||||
overviewData['/DischargingBatteryPower'].magnitude
|
||||
),
|
||||
unit: '(kWh)',
|
||||
min: Math.min(
|
||||
overviewData['/SumChargingBatteryPower'].min,
|
||||
overviewData['/SumDischargingBatteryPower'].min
|
||||
),
|
||||
max: Math.max(
|
||||
overviewData['/SumChargingBatteryPower'].max,
|
||||
overviewData['/SumDischargingBatteryPower'].max
|
||||
)
|
||||
min: overviewData['/DischargingBatteryPower'].min,
|
||||
max:
|
||||
overviewData['/ChargingBatteryPower'].max +
|
||||
overviewData['/HeatingPower'].max
|
||||
};
|
||||
|
||||
path = '/SumGridImportPower';
|
||||
path = '/GridImportPower';
|
||||
chartAggregatedData.gridImportPower.data = data[path];
|
||||
|
||||
path = '/SumGridExportPower';
|
||||
path = '/GridExportPower';
|
||||
chartAggregatedData.gridExportPower.data = data[path];
|
||||
|
||||
chartOverview.gridPower = {
|
||||
magnitude: Math.max(
|
||||
overviewData['/SumGridImportPower'].magnitude,
|
||||
overviewData['/SumGridExportPower'].magnitude
|
||||
overviewData['/GridImportPower'].magnitude,
|
||||
overviewData['/GridExportPower'].magnitude
|
||||
),
|
||||
unit: '(kWh)',
|
||||
min:
|
||||
overviewData['/SumGridImportPower'].min +
|
||||
overviewData['/SumGridExportPower'].min,
|
||||
overviewData['/GridImportPower'].min +
|
||||
overviewData['/GridExportPower'].min,
|
||||
max:
|
||||
overviewData['/SumGridImportPower'].max +
|
||||
overviewData['/SumGridExportPower'].max
|
||||
overviewData['/GridImportPower'].max +
|
||||
overviewData['/GridExportPower'].max
|
||||
};
|
||||
|
||||
chartOverview.overview = {
|
||||
magnitude: 0,
|
||||
unit: '(kWh)',
|
||||
min: Math.min(
|
||||
overviewData['/SumGridImportPower'].min,
|
||||
overviewData['/SumGridExportPower'].min,
|
||||
overviewData['/SumPvPower'].min
|
||||
overviewData['/GridImportPower'].min,
|
||||
overviewData['/GridExportPower'].min,
|
||||
overviewData['/PvPower'].min
|
||||
),
|
||||
max: Math.max(
|
||||
overviewData['/SumGridImportPower'].max,
|
||||
overviewData['/SumGridExportPower'].max,
|
||||
overviewData['/SumPvPower'].max
|
||||
overviewData['/GridImportPower'].max,
|
||||
overviewData['/GridExportPower'].max,
|
||||
overviewData['/PvPower'].max
|
||||
)
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue