Skip to content

Commit

Permalink
feat(ui-thermal): add v8.7 thermals matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
hdinia authored and skamril committed May 3, 2024
1 parent 365ef4d commit 9de4e43
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 74 deletions.
2 changes: 2 additions & 0 deletions webapp/public/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,8 @@
"study.modelization.clusters.matrix.common": "Common",
"study.modelization.clusters.matrix.tsGen": "TS generator",
"study.modelization.clusters.matrix.timeSeries": "Time-Series",
"study.modelization.clusters.matrix.fuelCost": "Fuel Cost",
"study.modelization.clusters.matrix.co2Cost": "CO2 Cost",
"study.modelization.clusters.backClusterList": "Back to cluster list",
"study.modelization.clusters.tsInterpretation": "TS interpretation",
"studies.modelization.clusters.question.delete_one": "Are you sure you want to delete this cluster?",
Expand Down
2 changes: 2 additions & 0 deletions webapp/public/locales/fr/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,8 @@
"study.modelization.clusters.matrix.common": "Common",
"study.modelization.clusters.matrix.tsGen": "TS generator",
"study.modelization.clusters.matrix.timeSeries": "Séries temporelles",
"study.modelization.clusters.matrix.fuelCost": "Fuel Cost",
"study.modelization.clusters.matrix.co2Cost": "CO2 Cost",
"study.modelization.clusters.backClusterList": "Retour à la liste des clusters",
"study.modelization.clusters.tsInterpretation": "TS interpretation",
"studies.modelization.clusters.question.delete_one": "Êtes-vous sûr de vouloir supprimer ce cluster ?",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from "react";
import * as R from "ramda";
import { useState } from "react";
import Tabs from "@mui/material/Tabs";
import Tab from "@mui/material/Tab";
import Box from "@mui/material/Box";
Expand All @@ -10,6 +9,7 @@ import {
StudyMetadata,
} from "../../../../../../../common/types";
import MatrixInput from "../../../../../../common/MatrixInput";
import { COMMON_MATRIX_COLS, TS_GEN_MATRIX_COLS } from "./utils";

interface Props {
study: StudyMetadata;
Expand All @@ -19,93 +19,87 @@ interface Props {

function Matrix({ study, areaId, clusterId }: Props) {
const [t] = useTranslation();
const [value, setValue] = React.useState(0);
const [value, setValue] = useState(0);

const commonNames = [
// TODO COMMON_MATIX_COLS
"Marginal cost modulation",
"Market bid modulation",
"Capacity modulation",
"Min gen modulation",
];

const tsGenNames = [
// TODO TS_GEN_MATRIX_COLS
"FO Duration",
"PO Duration",
"FO Rate",
"PO Rate",
"NPO Min",
"NPO Max",
];
////////////////////////////////////////////////////////////////
// Event Handlers
////////////////////////////////////////////////////////////////

const handleChange = (event: React.SyntheticEvent, newValue: number) => {
setValue(newValue);
};

////////////////////////////////////////////////////////////////
// JSX
////////////////////////////////////////////////////////////////

return (
<Box
width="100%"
height="100%"
display="flex"
flexDirection="column"
justifyContent="flex-start"
alignItems="center"
sx={{
display: "flex",
width: 1,
height: 1,
flexDirection: "column",
justifyContent: "flex-start",
alignItems: "center",
}}
>
<Tabs
sx={{ width: 1 }}
value={value}
onChange={handleChange}
aria-label="basic tabs example"
>
<Tabs sx={{ width: 1 }} value={value} onChange={handleChange}>
<Tab label={t("study.modelization.clusters.matrix.common")} />
<Tab label={t("study.modelization.clusters.matrix.tsGen")} />
<Tab label={t("study.modelization.clusters.matrix.timeSeries")} />
<Tab label={t("study.modelization.clusters.matrix.fuelCost")} />
<Tab label={t("study.modelization.clusters.matrix.co2Cost")} />
</Tabs>
<Box
sx={{
display: "flex",
width: "100%",
height: "100%",
width: 1,
height: 1,
}}
>
{R.cond([
[
() => value === 0,
() => (
<MatrixInput
study={study}
url={`input/thermal/prepro/${areaId}/${clusterId}/modulation`}
computStats={MatrixStats.NOCOL}
title={t("study.modelization.clusters.matrix.common")}
columnsNames={commonNames}
/>
),
],
[
() => value === 1,
() => (
<MatrixInput
study={study}
url={`input/thermal/prepro/${areaId}/${clusterId}/data`}
computStats={MatrixStats.NOCOL}
title={t("study.modelization.clusters.matrix.tsGen")}
columnsNames={tsGenNames}
/>
),
],
[
R.T,
() => (
<MatrixInput
study={study}
url={`input/thermal/series/${areaId}/${clusterId}/series`}
computStats={MatrixStats.NOCOL}
title={t("study.modelization.clusters.matrix.timeSeries")}
/>
),
],
])()}
{value === 0 && (
<MatrixInput
study={study}
url={`input/thermal/prepro/${areaId}/${clusterId}/modulation`}
computStats={MatrixStats.NOCOL}
title={t("study.modelization.clusters.matrix.common")}
columnsNames={COMMON_MATRIX_COLS}
/>
)}
{value === 1 && (
<MatrixInput
study={study}
url={`input/thermal/prepro/${areaId}/${clusterId}/data`}
computStats={MatrixStats.NOCOL}
title={t("study.modelization.clusters.matrix.tsGen")}
columnsNames={TS_GEN_MATRIX_COLS}
/>
)}
{value === 2 && (
<MatrixInput
study={study}
url={`input/thermal/series/${areaId}/${clusterId}/series`}
computStats={MatrixStats.NOCOL}
title={t("study.modelization.clusters.matrix.timeSeries")}
/>
)}
{value === 3 && (
<MatrixInput
study={study}
url={`input/thermal/series/${areaId}/${clusterId}/fuelCost`}
computStats={MatrixStats.NOCOL}
title={t("study.modelization.clusters.matrix.fuelCost")}
/>
)}
{value === 4 && (
<MatrixInput
study={study}
url={`input/thermal/series/${areaId}/${clusterId}/CO2Cost`}
computStats={MatrixStats.NOCOL}
title={t("study.modelization.clusters.matrix.co2Cost")}
/>
)}
</Box>
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@ import type { ClusterWithCapacity } from "../common/clustersUtils";
// Constants
////////////////////////////////////////////////////////////////

export const COMMON_MATRIX_COLS = [
"Marginal cost modulation",
"Market bid modulation",
"Capacity modulation",
"Min gen modulation",
] as const;

export const TS_GEN_MATRIX_COLS = [
"FO Duration",
"PO Duration",
"FO Rate",
"PO Rate",
"NPO Min",
"NPO Max",
] as const;

export const THERMAL_GROUPS = [
"Gas",
"Hard Coal",
Expand All @@ -25,8 +41,8 @@ export const THERMAL_GROUPS = [
] as const;

export const THERMAL_POLLUTANTS = [
// For study versions >= 860
"co2",
// Since v8.6
"so2",
"nh3",
"nox",
Expand Down Expand Up @@ -89,6 +105,7 @@ export interface ThermalCluster extends ThermalPollutants {
volatilityPlanned: number;
lawForced: TimeSeriesLawOption;
lawPlanned: TimeSeriesLawOption;
// Since v8.7
costGeneration: CostGeneration;
efficiency: number;
variableOMCost: number;
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/common/EditableMatrix/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface PropTypes {
matrixTime: boolean;
readOnly: boolean;
onUpdate?: (change: MatrixEditDTO[], source: string) => void;
columnsNames?: string[];
columnsNames?: string[] | readonly string[];
rowNames?: string[];
computStats?: MatrixStats;
isPercentDisplayEnabled?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/common/MatrixInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const logErr = debug("antares:createimportform:error");
interface Props {
study: StudyMetadata;
url: string;
columnsNames?: string[];
columnsNames?: string[] | readonly string[];
rowNames?: string[];
title?: string;
computStats: MatrixStats;
Expand Down

0 comments on commit 9de4e43

Please sign in to comment.