Compare commits
No commits in common. "4c7bc555269526fba6d38f1797a060a52d41fc5e" and "f77a86c4fc40b85764d003cd745b7c38b559158b" have entirely different histories.
4c7bc55526
...
f77a86c4fc
|
@ -2,15 +2,14 @@ namespace InnovEnergy.App.Backend.DataTypes;
|
|||
|
||||
public class Configuration
|
||||
{
|
||||
public Double MinimumSoC { get; set; }
|
||||
public Double GridSetPoint { get; set; }
|
||||
public CalibrationChargeType ForceCalibrationCharge { get; set; }
|
||||
public DateTime CalibrationChargeDate { get; set; }
|
||||
public Double MinimumSoC { get; set; }
|
||||
public Double GridSetPoint { get; set; }
|
||||
public CalibrationChargeType ForceCalibrationCharge { get; set; }
|
||||
}
|
||||
|
||||
public enum CalibrationChargeType
|
||||
{
|
||||
RepetitivelyEvery,
|
||||
AdditionallyOnce,
|
||||
ChargePermanently
|
||||
No,
|
||||
UntilEoc,
|
||||
Yes
|
||||
}
|
|
@ -4,9 +4,8 @@ namespace InnovEnergy.App.SaliMax.DataTypes;
|
|||
|
||||
public class Configuration
|
||||
{
|
||||
public Double MinimumSoC { get; set; }
|
||||
public Double GridSetPoint { get; set; }
|
||||
public CalibrationChargeType ForceCalibrationCharge { get; set; }
|
||||
public DateTime CalibrationChargeDate { get; set; }
|
||||
public Double MinimumSoC { get; set; }
|
||||
public Double GridSetPoint { get; set; }
|
||||
public CalibrationChargeType ForceCalibrationCharge { get; set; }
|
||||
}
|
||||
|
||||
|
|
|
@ -190,13 +190,13 @@ public static class Controller
|
|||
var calibrationChargeForced = statusRecord.Config.ForceCalibrationCharge;
|
||||
var batteryCalibrationChargeRequested = statusRecord.Battery is { CalibrationChargeRequested: true };//BatteryCalibrationChargeRequested(statusRecord.Battery?.CalibrationChargeRequested?? false) ;
|
||||
|
||||
var mustDoCalibrationCharge = batteryCalibrationChargeRequested || calibrationChargeForced == CalibrationChargeType.ChargePermanently || calibrationChargeForced == CalibrationChargeType.AdditionallyOnce ;
|
||||
var mustDoCalibrationCharge = batteryCalibrationChargeRequested || calibrationChargeForced == CalibrationChargeType.Yes || calibrationChargeForced == CalibrationChargeType.UntilEoc ;
|
||||
|
||||
if (statusRecord.Battery is not null)
|
||||
{
|
||||
if (calibrationChargeForced == CalibrationChargeType.AdditionallyOnce && statusRecord.Battery.Eoc )
|
||||
if (calibrationChargeForced == CalibrationChargeType.UntilEoc && statusRecord.Battery.Eoc )
|
||||
{
|
||||
statusRecord.Config.ForceCalibrationCharge = CalibrationChargeType.RepetitivelyEvery;
|
||||
statusRecord.Config.ForceCalibrationCharge = CalibrationChargeType.No;
|
||||
}
|
||||
}
|
||||
return mustDoCalibrationCharge;
|
||||
|
|
|
@ -64,7 +64,7 @@ public static class MiddlewareAgent
|
|||
|
||||
Configuration? config = JsonSerializer.Deserialize<Configuration>(message);
|
||||
|
||||
Console.WriteLine($"Received a configuration message: GridSetPoint is " + config.GridSetPoint + ", MinimumSoC is " + config.MinimumSoC + " and ForceCalibrationCharge is " + config.ForceCalibrationCharge+ " and CalibrationChargeDate is " + config.CalibrationChargeDate);
|
||||
Console.WriteLine($"Received a configuration message: GridSetPoint is " + config.GridSetPoint + ", MinimumSoC is " + config.MinimumSoC + " and ForceCalibrationCharge is " + config.ForceCalibrationCharge);
|
||||
|
||||
// Send the reply to the sender's endpoint
|
||||
UdpListener.Send(replyData, replyData.Length, serverEndpoint);
|
||||
|
|
|
@ -2,7 +2,7 @@ namespace InnovEnergy.App.SaliMax.SystemConfig;
|
|||
|
||||
public enum CalibrationChargeType
|
||||
{
|
||||
RepetitivelyEvery,
|
||||
AdditionallyOnce,
|
||||
ChargePermanently
|
||||
No,
|
||||
UntilEoc,
|
||||
Yes
|
||||
}
|
|
@ -40,7 +40,7 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
|
|||
public static Config Default => new()
|
||||
{
|
||||
MinSoc = 20,
|
||||
ForceCalibrationCharge = CalibrationChargeType.RepetitivelyEvery,
|
||||
ForceCalibrationCharge = CalibrationChargeType.No,
|
||||
DisplayIndividualBatteries = false,
|
||||
PConstant = .5,
|
||||
GridSetPoint = 0,
|
||||
|
@ -117,7 +117,7 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
|
|||
public static Config Default => new()
|
||||
{
|
||||
MinSoc = 20,
|
||||
ForceCalibrationCharge = CalibrationChargeType.RepetitivelyEvery,
|
||||
ForceCalibrationCharge = CalibrationChargeType.No,
|
||||
DisplayIndividualBatteries = false,
|
||||
PConstant = .5,
|
||||
GridSetPoint = 0,
|
||||
|
|
|
@ -36,22 +36,12 @@ function BatteryView(props: BatteryViewProps) {
|
|||
}
|
||||
const currentLocation = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const sortedBatteryView = [...props.values.batteryView].sort(
|
||||
(a, b) => b.BatteryId - a.BatteryId
|
||||
);
|
||||
const numOfBatteries = props.values.batteryView.length;
|
||||
|
||||
const handleMainStatsButton = () => {
|
||||
navigate(routes.mainstats);
|
||||
};
|
||||
|
||||
const findBatteryData = (batteryId: number) => {
|
||||
for (let i = 0; i < props.values.batteryView.length; i++) {
|
||||
if (props.values.batteryView[i].BatteryId == batteryId) {
|
||||
return props.values.batteryView[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Container maxWidth="xl">
|
||||
|
@ -107,14 +97,14 @@ function BatteryView(props: BatteryViewProps) {
|
|||
<MainStats s3Credentials={props.s3Credentials}></MainStats>
|
||||
}
|
||||
/>
|
||||
{props.values.batteryView.map((battery) => (
|
||||
{Array.from({ length: numOfBatteries }).map((_, i) => (
|
||||
<Route
|
||||
key={routes.detailed_view + battery.BatteryId}
|
||||
path={routes.detailed_view + battery.BatteryId}
|
||||
key={routes.detailed_view + i}
|
||||
path={routes.detailed_view + i}
|
||||
element={
|
||||
<DetailedBatteryView
|
||||
s3Credentials={props.s3Credentials}
|
||||
batteryData={findBatteryData(battery.BatteryId)}
|
||||
batteryData={props.values.batteryView[i]}
|
||||
></DetailedBatteryView>
|
||||
}
|
||||
/>
|
||||
|
@ -148,7 +138,7 @@ function BatteryView(props: BatteryViewProps) {
|
|||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{sortedBatteryView.map((battery) => (
|
||||
{props.values.batteryView.map((battery) => (
|
||||
<TableRow
|
||||
key={battery.BatteryId}
|
||||
style={{
|
||||
|
@ -163,9 +153,12 @@ function BatteryView(props: BatteryViewProps) {
|
|||
>
|
||||
<Link
|
||||
style={{ color: 'black' }}
|
||||
to={routes.detailed_view + battery.BatteryId.toString()}
|
||||
to={
|
||||
routes.detailed_view +
|
||||
(battery.BatteryId - 1).toString()
|
||||
}
|
||||
>
|
||||
{'Node ' + battery.BatteryId}
|
||||
{'Battery ' + battery.BatteryId}
|
||||
</Link>
|
||||
</TableCell>
|
||||
<TableCell
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import React from 'react';
|
||||
import { I_S3Credentials } from '../../../interfaces/S3Types';
|
||||
import {
|
||||
Card,
|
||||
|
@ -8,8 +8,7 @@ import {
|
|||
TableBody,
|
||||
TableCell,
|
||||
TableContainer,
|
||||
TableRow,
|
||||
Typography
|
||||
TableRow
|
||||
} from '@mui/material';
|
||||
import { Battery } from '../Log/graph.util';
|
||||
import Button from '@mui/material/Button';
|
||||
|
@ -39,64 +38,6 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) {
|
|||
);
|
||||
};
|
||||
|
||||
const [GreenisBlinking, setGreenisBlinking] = useState(
|
||||
props.batteryData.GreenLeds.value === 'Blinking'
|
||||
);
|
||||
|
||||
const [AmberisBlinking, setAmberisBlinking] = useState(
|
||||
props.batteryData.AmberLeds.value === 'Blinking'
|
||||
);
|
||||
const [RedisBlinking, setRedisBlinking] = useState(
|
||||
props.batteryData.RedLeds.value === 'Blinking'
|
||||
);
|
||||
|
||||
const [BlueisBlinking, setBlueisBlinking] = useState(
|
||||
props.batteryData.BlueLeds.value === 'Blinking'
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const intervalId = setInterval(() => {
|
||||
if (props.batteryData.AmberLeds.value === 'Blinking') {
|
||||
setAmberisBlinking((prevIsBlinking) => !prevIsBlinking);
|
||||
}
|
||||
|
||||
if (props.batteryData.RedLeds.value === 'Blinking') {
|
||||
setRedisBlinking((prevIsBlinking) => !prevIsBlinking);
|
||||
}
|
||||
|
||||
if (props.batteryData.BlueLeds.value === 'Blinking') {
|
||||
setBlueisBlinking((prevIsBlinking) => !prevIsBlinking);
|
||||
}
|
||||
|
||||
if (props.batteryData.GreenLeds.value === 'Blinking') {
|
||||
setGreenisBlinking((prevIsBlinking) => !prevIsBlinking);
|
||||
}
|
||||
}, 500); // Blink every 500 milliseconds
|
||||
|
||||
// Cleanup the interval on component unmount
|
||||
return () => clearInterval(intervalId);
|
||||
}, []);
|
||||
|
||||
const batteryStyle = {
|
||||
borderRadius: '15px',
|
||||
padding: '10px',
|
||||
backgroundColor: 'lightgray',
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
height: '150px',
|
||||
marginTop: '30px'
|
||||
};
|
||||
|
||||
const batteryStringStyle = {
|
||||
flex: 1,
|
||||
border: '1px solid #000',
|
||||
height: '97%',
|
||||
width: '30px',
|
||||
borderRadius: '7px',
|
||||
backgroundColor: '#bfbfbf'
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Grid container>
|
||||
|
@ -129,149 +70,18 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) {
|
|||
</Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container>
|
||||
<Grid item md={4.9} xs={4.9}></Grid>
|
||||
<Grid item md={2.2} xs={2.2}>
|
||||
<div style={batteryStyle}>
|
||||
<div
|
||||
style={{
|
||||
...batteryStringStyle,
|
||||
backgroundColor:
|
||||
props.batteryData.String1Active.value == 'True'
|
||||
? '#32CD32'
|
||||
: '#FF033E'
|
||||
}}
|
||||
></div>
|
||||
<div
|
||||
style={{
|
||||
...batteryStringStyle,
|
||||
backgroundColor:
|
||||
props.batteryData.String2Active.value == 'True'
|
||||
? '#32CD32'
|
||||
: '#FF033E'
|
||||
}}
|
||||
></div>
|
||||
<div
|
||||
style={{
|
||||
...batteryStringStyle,
|
||||
backgroundColor:
|
||||
props.batteryData.String3Active.value == 'True'
|
||||
? '#32CD32'
|
||||
: '#FF033E'
|
||||
}}
|
||||
></div>
|
||||
<div
|
||||
style={{
|
||||
...batteryStringStyle,
|
||||
backgroundColor:
|
||||
props.batteryData.String4Active.value == 'True'
|
||||
? '#32CD32'
|
||||
: '#FF033E'
|
||||
}}
|
||||
></div>
|
||||
<div
|
||||
style={{
|
||||
...batteryStringStyle,
|
||||
backgroundColor:
|
||||
props.batteryData.String5Active.value == 'True'
|
||||
? '#32CD32'
|
||||
: '#FF033E'
|
||||
}}
|
||||
></div>
|
||||
|
||||
<div>
|
||||
<div
|
||||
style={{
|
||||
width: '20px',
|
||||
height: '20px',
|
||||
marginLeft: '10px',
|
||||
marginTop: '-10px',
|
||||
borderRadius: '50%',
|
||||
backgroundColor:
|
||||
props.batteryData.GreenLeds.value === 'On' ||
|
||||
GreenisBlinking
|
||||
? 'green'
|
||||
: 'transparent'
|
||||
}}
|
||||
/>
|
||||
|
||||
<div
|
||||
style={{
|
||||
width: '20px',
|
||||
height: '20px',
|
||||
marginLeft: '10px',
|
||||
marginTop: '10px',
|
||||
borderRadius: '50%',
|
||||
backgroundColor:
|
||||
props.batteryData.AmberLeds.value === 'On' ||
|
||||
AmberisBlinking
|
||||
? 'orange'
|
||||
: 'transparent'
|
||||
}}
|
||||
/>
|
||||
|
||||
<div
|
||||
style={{
|
||||
width: '20px',
|
||||
height: '20px',
|
||||
marginLeft: '10px',
|
||||
marginTop: '10px',
|
||||
borderRadius: '50%',
|
||||
backgroundColor:
|
||||
props.batteryData.BlueLeds.value === 'On' || BlueisBlinking
|
||||
? '#00ccff'
|
||||
: 'transparent'
|
||||
}}
|
||||
/>
|
||||
|
||||
<div
|
||||
style={{
|
||||
width: '20px',
|
||||
height: '20px',
|
||||
marginLeft: '10px',
|
||||
marginTop: '10px',
|
||||
borderRadius: '50%',
|
||||
backgroundColor:
|
||||
props.batteryData.RedLeds.value === 'On' || RedisBlinking
|
||||
? 'red'
|
||||
: 'transparent'
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Grid>
|
||||
|
||||
<Grid item md={4.9} xs={4.9}></Grid>
|
||||
</Grid>
|
||||
|
||||
<Grid item md={3} xs={3}>
|
||||
<Grid item md={2} xs={2}>
|
||||
<Card
|
||||
sx={{
|
||||
overflow: 'visible',
|
||||
marginTop: '30px',
|
||||
marginBottom: '30px',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
border: '2px solid #ccc',
|
||||
borderRadius: '12px'
|
||||
backgroundColor: 'red'
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
variant="h6"
|
||||
component="div"
|
||||
sx={{
|
||||
marginTop: '10px',
|
||||
borderBottom: '1px solid #ccc',
|
||||
fontWeight: 'bold'
|
||||
}}
|
||||
>
|
||||
Battery Information
|
||||
</Typography>
|
||||
|
||||
<TableContainer
|
||||
component={Paper}
|
||||
sx={{ marginTop: '20px', width: '100%' }}
|
||||
sx={{ marginTop: '20px', marginBottom: '20px', width: '100%' }}
|
||||
>
|
||||
<Table size="medium" aria-label="a dense table">
|
||||
<TableBody>
|
||||
|
@ -407,7 +217,28 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) {
|
|||
props.batteryData.HeatingCurrent.unit}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
<TableCell
|
||||
component="th"
|
||||
scope="row"
|
||||
align="left"
|
||||
sx={{ fontWeight: 'bold' }}
|
||||
>
|
||||
Heating Power
|
||||
</TableCell>
|
||||
<TableCell
|
||||
align="right"
|
||||
sx={{
|
||||
width: '6ch',
|
||||
whiteSpace: 'nowrap',
|
||||
paddingRight: '12px'
|
||||
}}
|
||||
>
|
||||
{props.batteryData.HeatingPower.value +
|
||||
' ' +
|
||||
props.batteryData.HeatingPower.unit}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell
|
||||
component="th"
|
||||
|
@ -430,40 +261,47 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) {
|
|||
props.batteryData.Soc.unit}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell
|
||||
component="th"
|
||||
scope="row"
|
||||
align="left"
|
||||
sx={{ fontWeight: 'bold' }}
|
||||
>
|
||||
SOCAh
|
||||
</TableCell>
|
||||
<TableCell
|
||||
align="right"
|
||||
sx={{
|
||||
width: '6ch',
|
||||
whiteSpace: 'nowrap',
|
||||
paddingRight: '12px'
|
||||
}}
|
||||
>
|
||||
{props.batteryData.SOCAh.value +
|
||||
' ' +
|
||||
props.batteryData.SOCAh.unit}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
</Card>
|
||||
</Grid>
|
||||
{/*----------------------------------------------------------------------------------------------------------------------------------*/}
|
||||
<Grid item md={3} xs={3}>
|
||||
<Grid item md={2.9} xs={2.9}>
|
||||
<Card
|
||||
sx={{
|
||||
overflow: 'visible',
|
||||
marginTop: '30px',
|
||||
marginLeft: '20px',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
border: '2px solid #ccc',
|
||||
borderRadius: '12px'
|
||||
marginBottom: '30px',
|
||||
backgroundColor: 'red'
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
variant="h6"
|
||||
component="div"
|
||||
sx={{
|
||||
marginTop: '10px',
|
||||
borderBottom: '1px solid #ccc',
|
||||
fontWeight: 'bold'
|
||||
}}
|
||||
>
|
||||
Temperature
|
||||
</Typography>
|
||||
|
||||
<TableContainer
|
||||
component={Paper}
|
||||
sx={{ marginTop: '20px', width: '100%' }}
|
||||
sx={{ marginTop: '20px', marginBottom: '20px', width: '100%' }}
|
||||
>
|
||||
<Table size="medium" aria-label="a dense table">
|
||||
<TableBody>
|
||||
|
@ -628,33 +466,19 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) {
|
|||
</Grid>
|
||||
|
||||
{/*----------------------------------------------------------------------------------------------------------------------------------*/}
|
||||
<Grid item md={3} xs={3}>
|
||||
<Grid item md={2.7} xs={2.7}>
|
||||
<Card
|
||||
sx={{
|
||||
overflow: 'visible',
|
||||
marginTop: '30px',
|
||||
marginLeft: '20px',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
border: '2px solid #ccc',
|
||||
borderRadius: '12px'
|
||||
marginBottom: '30px',
|
||||
backgroundColor: 'red'
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
variant="h6"
|
||||
component="div"
|
||||
sx={{
|
||||
marginTop: '10px',
|
||||
borderBottom: '1px solid #ccc',
|
||||
fontWeight: 'bold'
|
||||
}}
|
||||
>
|
||||
Io Status
|
||||
</Typography>
|
||||
<TableContainer
|
||||
component={Paper}
|
||||
sx={{ marginTop: '20px', width: '100%' }}
|
||||
sx={{ marginTop: '20px', marginBottom: '20px', width: '100%' }}
|
||||
>
|
||||
<Table size="medium" aria-label="a dense table">
|
||||
<TableBody>
|
||||
|
@ -819,33 +643,19 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) {
|
|||
</Grid>
|
||||
|
||||
{/*----------------------------------------------------------------------------------------------------------------------------------*/}
|
||||
<Grid item md={3} xs={3}>
|
||||
<Grid item md={2.9} xs={2.9}>
|
||||
<Card
|
||||
sx={{
|
||||
overflow: 'visible',
|
||||
marginTop: '30px',
|
||||
marginLeft: '20px',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
border: '2px solid #ccc',
|
||||
borderRadius: '12px'
|
||||
marginBottom: '30px',
|
||||
backgroundColor: 'red'
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
variant="h6"
|
||||
component="div"
|
||||
sx={{
|
||||
marginTop: '10px',
|
||||
borderBottom: '1px solid #ccc',
|
||||
fontWeight: 'bold'
|
||||
}}
|
||||
>
|
||||
Specification
|
||||
</Typography>
|
||||
<TableContainer
|
||||
component={Paper}
|
||||
sx={{ marginTop: '20px', width: '100%' }}
|
||||
sx={{ marginTop: '20px', marginBottom: '20px', width: '100%' }}
|
||||
>
|
||||
<Table size="medium" aria-label="a dense table">
|
||||
<TableBody>
|
||||
|
@ -1009,109 +819,151 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) {
|
|||
</Card>
|
||||
</Grid>
|
||||
{/*----------------------------------------------------------------------------------------------------------------------------------*/}
|
||||
|
||||
{/*<Grid item md={1.5} xs={1.5}>*/}
|
||||
{/* <Card*/}
|
||||
{/* sx={{*/}
|
||||
{/* overflow: 'visible',*/}
|
||||
{/* marginTop: '30px',*/}
|
||||
{/* marginLeft: '20px',*/}
|
||||
{/* marginBottom: '30px',*/}
|
||||
{/* backgroundColor: 'red'*/}
|
||||
{/* }}*/}
|
||||
{/* >*/}
|
||||
{/* <TableContainer*/}
|
||||
{/* component={Paper}*/}
|
||||
{/* sx={{ marginTop: '20px', marginBottom: '20px', width: '100%' }}*/}
|
||||
{/* >*/}
|
||||
{/* <Table size="medium" aria-label="a dense table">*/}
|
||||
{/* <TableBody>*/}
|
||||
{/* <TableRow>*/}
|
||||
{/* <TableCell*/}
|
||||
{/* component="th"*/}
|
||||
{/* scope="row"*/}
|
||||
{/* align="left"*/}
|
||||
{/* sx={{ fontWeight: 'bold' }}*/}
|
||||
{/* >*/}
|
||||
{/* Green Led*/}
|
||||
{/* </TableCell>*/}
|
||||
{/* <TableCell*/}
|
||||
{/* align="right"*/}
|
||||
{/* sx={{*/}
|
||||
{/* width: '6ch',*/}
|
||||
{/* whiteSpace: 'nowrap',*/}
|
||||
{/* paddingRight: '12px'*/}
|
||||
{/* }}*/}
|
||||
{/* >*/}
|
||||
{/* {props.batteryData.GreenLeds.value}*/}
|
||||
{/* </TableCell>*/}
|
||||
{/* </TableRow>*/}
|
||||
{/* <TableRow>*/}
|
||||
{/* <TableCell*/}
|
||||
{/* component="th"*/}
|
||||
{/* scope="row"*/}
|
||||
{/* align="left"*/}
|
||||
{/* sx={{ fontWeight: 'bold' }}*/}
|
||||
{/* >*/}
|
||||
{/* Amber Led*/}
|
||||
{/* </TableCell>*/}
|
||||
{/* <TableCell*/}
|
||||
{/* align="right"*/}
|
||||
{/* sx={{*/}
|
||||
{/* width: '6ch',*/}
|
||||
{/* whiteSpace: 'nowrap',*/}
|
||||
{/* paddingRight: '12px'*/}
|
||||
{/* }}*/}
|
||||
{/* >*/}
|
||||
{/* {props.batteryData.AmberLeds.value}*/}
|
||||
{/* </TableCell>*/}
|
||||
{/* </TableRow>*/}
|
||||
{/* <TableRow>*/}
|
||||
{/* <TableCell*/}
|
||||
{/* component="th"*/}
|
||||
{/* scope="row"*/}
|
||||
{/* align="left"*/}
|
||||
{/* sx={{ fontWeight: 'bold' }}*/}
|
||||
{/* >*/}
|
||||
{/* Blue Led*/}
|
||||
{/* </TableCell>*/}
|
||||
{/* <TableCell*/}
|
||||
{/* align="right"*/}
|
||||
{/* sx={{*/}
|
||||
{/* width: '6ch',*/}
|
||||
{/* whiteSpace: 'nowrap',*/}
|
||||
{/* paddingRight: '12px'*/}
|
||||
{/* }}*/}
|
||||
{/* >*/}
|
||||
{/* {props.batteryData.BlueLeds.value}*/}
|
||||
{/* </TableCell>*/}
|
||||
{/* </TableRow>*/}
|
||||
|
||||
{/* <TableRow>*/}
|
||||
{/* <TableCell*/}
|
||||
{/* component="th"*/}
|
||||
{/* scope="row"*/}
|
||||
{/* align="left"*/}
|
||||
{/* sx={{ fontWeight: 'bold' }}*/}
|
||||
{/* >*/}
|
||||
{/* Red Led*/}
|
||||
{/* </TableCell>*/}
|
||||
{/* <TableCell*/}
|
||||
{/* align="right"*/}
|
||||
{/* sx={{*/}
|
||||
{/* width: '6ch',*/}
|
||||
{/* whiteSpace: 'nowrap',*/}
|
||||
{/* paddingRight: '12px'*/}
|
||||
{/* }}*/}
|
||||
{/* >*/}
|
||||
{/* {props.batteryData.RedLeds.value}*/}
|
||||
{/* </TableCell>*/}
|
||||
{/* </TableRow>*/}
|
||||
{/* </TableBody>*/}
|
||||
{/* </Table>*/}
|
||||
{/* </TableContainer>*/}
|
||||
{/* </Card>*/}
|
||||
{/*</Grid>*/}
|
||||
<Grid item md={1.5} xs={1.5}>
|
||||
<Card
|
||||
sx={{
|
||||
overflow: 'visible',
|
||||
marginTop: '30px',
|
||||
marginLeft: '20px',
|
||||
marginBottom: '30px',
|
||||
backgroundColor: 'red'
|
||||
}}
|
||||
>
|
||||
<TableContainer
|
||||
component={Paper}
|
||||
sx={{ marginTop: '20px', marginBottom: '20px', width: '100%' }}
|
||||
>
|
||||
<Table size="medium" aria-label="a dense table">
|
||||
<TableBody>
|
||||
<TableRow>
|
||||
<TableCell
|
||||
component="th"
|
||||
scope="row"
|
||||
align="left"
|
||||
sx={{ fontWeight: 'bold' }}
|
||||
>
|
||||
Blue Led
|
||||
</TableCell>
|
||||
<TableCell
|
||||
align="right"
|
||||
sx={{
|
||||
width: '6ch',
|
||||
whiteSpace: 'nowrap',
|
||||
paddingRight: '12px'
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
width: '20px',
|
||||
height: '20px',
|
||||
marginLeft: '2px',
|
||||
borderRadius: '50%',
|
||||
backgroundColor:
|
||||
props.batteryData.BlueLeds.value === 'On'
|
||||
? '#00ccff'
|
||||
: 'transparent'
|
||||
}}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell
|
||||
component="th"
|
||||
scope="row"
|
||||
align="left"
|
||||
sx={{ fontWeight: 'bold' }}
|
||||
>
|
||||
Green Led
|
||||
</TableCell>
|
||||
<TableCell
|
||||
align="right"
|
||||
sx={{
|
||||
width: '6ch',
|
||||
whiteSpace: 'nowrap',
|
||||
paddingRight: '12px'
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
width: '20px',
|
||||
height: '20px',
|
||||
marginLeft: '2px',
|
||||
borderRadius: '50%',
|
||||
backgroundColor:
|
||||
props.batteryData.GreenLeds.value === 'On'
|
||||
? 'green'
|
||||
: 'transparent'
|
||||
}}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell
|
||||
component="th"
|
||||
scope="row"
|
||||
align="left"
|
||||
sx={{ fontWeight: 'bold' }}
|
||||
>
|
||||
Red Led
|
||||
</TableCell>
|
||||
<TableCell
|
||||
align="right"
|
||||
sx={{
|
||||
width: '6ch',
|
||||
whiteSpace: 'nowrap',
|
||||
paddingRight: '12px'
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
width: '20px',
|
||||
height: '20px',
|
||||
marginLeft: '2px',
|
||||
borderRadius: '50%',
|
||||
backgroundColor:
|
||||
props.batteryData.RedLeds.value === 'On'
|
||||
? 'red'
|
||||
: 'transparent'
|
||||
}}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell
|
||||
component="th"
|
||||
scope="row"
|
||||
align="left"
|
||||
sx={{ fontWeight: 'bold' }}
|
||||
>
|
||||
Amber Led
|
||||
</TableCell>
|
||||
<TableCell
|
||||
align="right"
|
||||
sx={{
|
||||
width: '6ch',
|
||||
whiteSpace: 'nowrap',
|
||||
paddingRight: '12px'
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
width: '20px',
|
||||
height: '20px',
|
||||
marginLeft: '2px',
|
||||
borderRadius: '50%',
|
||||
backgroundColor:
|
||||
props.batteryData.AmberLeds.value === 'On'
|
||||
? 'orange'
|
||||
: 'transparent'
|
||||
}}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
</Card>
|
||||
</Grid>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,22 +9,16 @@ import {
|
|||
Grid,
|
||||
IconButton,
|
||||
InputLabel,
|
||||
Modal,
|
||||
Select,
|
||||
TextField,
|
||||
Typography,
|
||||
useTheme
|
||||
} from '@mui/material';
|
||||
import React, { useState } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import Button from '@mui/material/Button';
|
||||
import { DateField } from '@mui/x-date-pickers/DateField';
|
||||
import axiosConfig from '../../../Resources/axiosConfig';
|
||||
import { Close as CloseIcon } from '@mui/icons-material';
|
||||
import MenuItem from '@mui/material/MenuItem';
|
||||
import { DateTimePicker, LocalizationProvider } from '@mui/x-date-pickers';
|
||||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
interface ConfigurationProps {
|
||||
values: TopologyValues;
|
||||
|
@ -36,11 +30,32 @@ function Configuration(props: ConfigurationProps) {
|
|||
return null;
|
||||
}
|
||||
|
||||
const forcedCalibrationChargeOptions = [
|
||||
'RepetitivelyEvery',
|
||||
'AdditionallyOnce',
|
||||
'ChargePermanently'
|
||||
];
|
||||
const forcedCalibrationChargeOptions = ['No', 'UntilEoc', 'Yes'];
|
||||
|
||||
const [formValues, setFormValues] = useState<ConfigurationValues>({
|
||||
minimumSoC: props.values.minimumSoC[0].value,
|
||||
gridSetPoint: (props.values.gridSetPoint[0].value as number) / 1000,
|
||||
forceCalibrationCharge: forcedCalibrationChargeOptions.indexOf(
|
||||
props.values.calibrationChargeForced[0].value.toString()
|
||||
)
|
||||
});
|
||||
|
||||
const handleSubmit = async (e) => {
|
||||
setLoading(true);
|
||||
const res = await axiosConfig
|
||||
.post(`/EditInstallationConfig?installationId=${props.id}`, formValues)
|
||||
.catch((err) => {
|
||||
if (err.response) {
|
||||
setError(true);
|
||||
setLoading(false);
|
||||
}
|
||||
});
|
||||
|
||||
if (res) {
|
||||
setUpdated(true);
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const [errors, setErrors] = useState({
|
||||
minimumSoC: false,
|
||||
|
@ -65,62 +80,9 @@ function Configuration(props: ConfigurationProps) {
|
|||
] = useState<string>(
|
||||
props.values.calibrationChargeForced[0].value.toString()
|
||||
);
|
||||
const [isDateModalOpen, setIsDateModalOpen] = useState(false);
|
||||
const [calibrationChargeDate, setCalibrationChargeDate] = useState();
|
||||
const [isErrorDateModalOpen, setErrorDateModalOpen] = useState(false);
|
||||
const [dateSelectionError, setDateSelectionError] = useState('');
|
||||
const [dateFieldOpen, setDateFieldOpen] = useState(false);
|
||||
|
||||
const [formValues, setFormValues] = useState<ConfigurationValues>({
|
||||
minimumSoC: props.values.minimumSoC[0].value,
|
||||
gridSetPoint: (props.values.gridSetPoint[0].value as number) / 1000,
|
||||
forceCalibrationCharge: forcedCalibrationChargeOptions.indexOf(
|
||||
props.values.calibrationChargeForced[0].value.toString()
|
||||
),
|
||||
calibrationChargeDate: Date(props.values.calibrationChargeDate[0].value)
|
||||
});
|
||||
|
||||
const handleSubmit = async (e) => {
|
||||
setLoading(true);
|
||||
const res = await axiosConfig
|
||||
.post(`/EditInstallationConfig?installationId=${props.id}`, formValues)
|
||||
.catch((err) => {
|
||||
if (err.response) {
|
||||
setError(true);
|
||||
setLoading(false);
|
||||
}
|
||||
});
|
||||
|
||||
if (res) {
|
||||
setUpdated(true);
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
setIsDateModalOpen(false);
|
||||
};
|
||||
const handleOkOnErrorDateModal = () => {
|
||||
setErrorDateModalOpen(false);
|
||||
setIsDateModalOpen(true);
|
||||
};
|
||||
|
||||
const handleConfirm = () => {
|
||||
setIsDateModalOpen(false);
|
||||
|
||||
if (calibrationChargeDate.isBefore(dayjs())) {
|
||||
setDateSelectionError('You must use a future date');
|
||||
setErrorDateModalOpen(true);
|
||||
return;
|
||||
}
|
||||
|
||||
setDateFieldOpen(true);
|
||||
};
|
||||
//const forcedCalibrationChargeOptions = ['No', 'UntilEoc', 'Yes'];
|
||||
|
||||
const handleSelectedCalibrationChargeChange = (event) => {
|
||||
if (event.target.value != 'ChargePermanently') {
|
||||
setIsDateModalOpen(true);
|
||||
}
|
||||
setSelectedForcedCalibrationChargeOption(event.target.value);
|
||||
|
||||
setFormValues({
|
||||
|
@ -237,6 +199,7 @@ function Configuration(props: ConfigurationProps) {
|
|||
open={openForcedCalibrationCharge}
|
||||
onClose={handleCloseForcedCalibrationCharge}
|
||||
onOpen={handleOpenForcedCalibrationCharge}
|
||||
//renderValue={selectedForcedCalibrationChargeOption}
|
||||
>
|
||||
{forcedCalibrationChargeOptions.map((option) => (
|
||||
<MenuItem key={option} value={option}>
|
||||
|
@ -246,127 +209,6 @@ function Configuration(props: ConfigurationProps) {
|
|||
</Select>
|
||||
</FormControl>
|
||||
</div>
|
||||
{(dateFieldOpen || formValues.forceCalibrationCharge != 2) && (
|
||||
<div>
|
||||
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
||||
<DateField
|
||||
label="Calibration Charge Date"
|
||||
value={calibrationChargeDate}
|
||||
/>
|
||||
</LocalizationProvider>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isErrorDateModalOpen && (
|
||||
<Modal open={isErrorDateModalOpen} onClose={() => {}}>
|
||||
<Box
|
||||
sx={{
|
||||
position: 'absolute',
|
||||
top: '50%',
|
||||
left: '50%',
|
||||
transform: 'translate(-50%, -50%)',
|
||||
width: 450,
|
||||
bgcolor: 'background.paper',
|
||||
borderRadius: 4,
|
||||
boxShadow: 24,
|
||||
p: 4,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center'
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
variant="body1"
|
||||
gutterBottom
|
||||
sx={{ fontWeight: 'bold' }}
|
||||
>
|
||||
{dateSelectionError}
|
||||
</Typography>
|
||||
|
||||
<Button
|
||||
sx={{
|
||||
marginTop: 2,
|
||||
textTransform: 'none',
|
||||
bgcolor: '#ffc04d',
|
||||
color: '#111111',
|
||||
'&:hover': { bgcolor: '#f7b34d' }
|
||||
}}
|
||||
onClick={handleOkOnErrorDateModal}
|
||||
>
|
||||
Ok
|
||||
</Button>
|
||||
</Box>
|
||||
</Modal>
|
||||
)}
|
||||
|
||||
{isDateModalOpen && (
|
||||
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
||||
<Modal open={isDateModalOpen} onClose={() => {}}>
|
||||
<Box
|
||||
sx={{
|
||||
position: 'absolute',
|
||||
top: '50%',
|
||||
left: '50%',
|
||||
transform: 'translate(-50%, -50%)',
|
||||
width: 450,
|
||||
bgcolor: 'background.paper',
|
||||
borderRadius: 4,
|
||||
boxShadow: 24,
|
||||
p: 4,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center'
|
||||
}}
|
||||
>
|
||||
<DateTimePicker
|
||||
label="Select Calibration Charge Date"
|
||||
value={calibrationChargeDate}
|
||||
onChange={(newDate) =>
|
||||
setCalibrationChargeDate(newDate)
|
||||
}
|
||||
sx={{
|
||||
marginTop: 2
|
||||
}}
|
||||
/>
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
marginTop: 10
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
sx={{
|
||||
marginTop: 2,
|
||||
textTransform: 'none',
|
||||
bgcolor: '#ffc04d',
|
||||
color: '#111111',
|
||||
'&:hover': { bgcolor: '#f7b34d' }
|
||||
}}
|
||||
onClick={handleConfirm}
|
||||
>
|
||||
Confirm
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
sx={{
|
||||
marginTop: 2,
|
||||
marginLeft: 2,
|
||||
textTransform: 'none',
|
||||
bgcolor: '#ffc04d',
|
||||
color: '#111111',
|
||||
'&:hover': { bgcolor: '#f7b34d' }
|
||||
}}
|
||||
onClick={handleCancel}
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
</div>
|
||||
</Box>
|
||||
</Modal>
|
||||
</LocalizationProvider>
|
||||
)}
|
||||
|
||||
<div style={{ marginBottom: '5px' }}>
|
||||
<TextField
|
||||
|
|
|
@ -32,7 +32,6 @@ export type ConfigurationValues = {
|
|||
minimumSoC: string | number;
|
||||
gridSetPoint: number;
|
||||
forceCalibrationCharge: number;
|
||||
calibrationChargeDate: Date | null;
|
||||
};
|
||||
|
||||
export interface Battery {
|
||||
|
@ -159,7 +158,6 @@ export type TopologyValues = {
|
|||
DcDcNum: I_BoxDataValue[];
|
||||
calibrationChargeForced: I_BoxDataValue[];
|
||||
mode: I_BoxDataValue[];
|
||||
calibrationChargeDate: I_BoxDataValue[];
|
||||
|
||||
batteryView: Battery[];
|
||||
};
|
||||
|
@ -295,8 +293,7 @@ export const topologyPaths: TopologyPaths = {
|
|||
maximumDischargePower: ['/Config/MaxBatteryDischargingCurrent'],
|
||||
DcDcNum: ['/DcDc/SystemControl/NumberOfConnectedSlaves'],
|
||||
calibrationChargeForced: ['/Config/ForceCalibrationCharge'],
|
||||
mode: ['/EssControl/Mode'],
|
||||
calibrationChargeDate: ['/EssControl/Date']
|
||||
mode: ['/EssControl/Mode']
|
||||
};
|
||||
|
||||
export const extractValues = (
|
||||
|
@ -310,19 +307,19 @@ export const extractValues = (
|
|||
|
||||
if (topologyKey === 'batteryView') {
|
||||
extractedValues[topologyKey] = [];
|
||||
const battery_ids_from_csv = timeSeriesData.value[
|
||||
const numOfBatteries = timeSeriesData.value[
|
||||
'/Config/Devices/BatteryNodes'
|
||||
].value
|
||||
.toString()
|
||||
.split(',');
|
||||
.split(',').length;
|
||||
|
||||
let battery_index = 0;
|
||||
let battery_id = 1;
|
||||
let pathIndex = 0;
|
||||
|
||||
while (pathIndex < paths.length) {
|
||||
let battery = {};
|
||||
let existingKeys = 0;
|
||||
battery[BatteryKeys[0]] = battery_ids_from_csv[battery_index];
|
||||
battery[BatteryKeys[0]] = battery_id;
|
||||
for (let i = 1; i < BatteryKeys.length; i++) {
|
||||
const path = paths[pathIndex];
|
||||
if (timeSeriesData.value.hasOwnProperty(path)) {
|
||||
|
@ -340,7 +337,7 @@ export const extractValues = (
|
|||
}
|
||||
pathIndex++;
|
||||
}
|
||||
battery_index++;
|
||||
battery_id++;
|
||||
if (existingKeys > 0) {
|
||||
extractedValues[topologyKey].push(battery as Battery);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue