-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtime-delay-parameters.tsx
More file actions
75 lines (70 loc) · 2.27 KB
/
time-delay-parameters.tsx
File metadata and controls
75 lines (70 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/**
* Copyright (c) 2026, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { Grid } from '@mui/material';
import * as yup from 'yup';
import {
LOAD_INCREASE_START_TIME,
LOAD_INCREASE_STOP_TIME,
MARGIN_CALCULATION_START_TIME,
START_TIME,
STOP_TIME,
} from './constants';
import { ParameterType, SpecificParameterInfos } from '../../../utils';
import ParameterField from '../common/parameter-field';
export const formSchema = yup.object().shape({
[START_TIME]: yup.number().required(),
[STOP_TIME]: yup.number().required(),
[MARGIN_CALCULATION_START_TIME]: yup.number().required(),
[LOAD_INCREASE_START_TIME]: yup.number().required(),
[LOAD_INCREASE_STOP_TIME]: yup.number().required(),
});
export const emptyFormData = {
[START_TIME]: 0,
[STOP_TIME]: 0,
[MARGIN_CALCULATION_START_TIME]: 0,
[LOAD_INCREASE_START_TIME]: 0,
[LOAD_INCREASE_STOP_TIME]: 0,
};
const params: SpecificParameterInfos[] = [
{
name: START_TIME,
type: ParameterType.DOUBLE,
label: 'DynamicMarginCalculationStartTime',
},
{
name: STOP_TIME,
type: ParameterType.DOUBLE,
label: 'DynamicMarginCalculationStopTime',
},
{
name: MARGIN_CALCULATION_START_TIME,
type: ParameterType.DOUBLE,
label: 'DynamicMarginCalculationMarginCalculationStartTime',
},
{
name: LOAD_INCREASE_START_TIME,
type: ParameterType.DOUBLE,
label: 'DynamicMarginCalculationLoadIncreaseStartTime',
},
{
name: LOAD_INCREASE_STOP_TIME,
type: ParameterType.DOUBLE,
label: 'DynamicMarginCalculationLoadIncreaseStopTime',
},
];
export default function TimeDelayParameters({ path }: Readonly<{ path: string }>) {
return (
<Grid container>
{params.map((param: SpecificParameterInfos) => {
const { name, type, ...otherParams } = param;
return (
<ParameterField key={param.name} id={path} name={param.name} type={param.type} {...otherParams} />
);
})}
</Grid>
);
}