-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdynamic-simulation.type.ts
More file actions
131 lines (117 loc) · 3.34 KB
/
Copy pathdynamic-simulation.type.ts
File metadata and controls
131 lines (117 loc) · 3.34 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/**
* Copyright (c) 2024, 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 type { UUID } from 'node:crypto';
import { EquipmentType } from './equipmentType';
import { IdName } from './types';
export enum SolverType {
IDA = 'IDA',
SIM = 'SIM',
}
type CommonSolverInfos = {
id: UUID;
type: SolverType;
fNormTolAlg: number;
initialAddTolAlg: number;
scStepTolAlg: number;
mxNewTStepAlg: number;
msbsetAlg: number;
mxIterAlg: number;
printFlAlg: number;
fNormTolAlgJ: number;
initialAddTolAlgJ: number;
scStepTolAlgJ: number;
mxNewTStepAlgJ: number;
msbsetAlgJ: number;
mxIterAlgJ: number;
printFlAlgJ: number;
fNormTolAlgInit: number;
initialAddTolAlgInit: number;
scStepTolAlgInit: number;
mxNewTStepAlgInit: number;
msbsetAlgInit: number;
mxIterAlgInit: number;
printFlAlgInit: number;
maximumNumberSlowStepIncrease: number;
minimalAcceptableStep: number;
};
type IdaSolverInfos = CommonSolverInfos & {
type: SolverType.IDA;
order: number;
initStep: number;
minStep: number;
maxStep: number;
absAccuracy: number;
relAccuracy: number;
};
type SimSolverInfos = CommonSolverInfos & {
type: SolverType.SIM;
hMin: number;
hMax: number;
kReduceStep: number;
maxNewtonTry: number;
linearSolverName: string;
fNormTol: number;
initialAddTol: number;
scStepTol: number;
mxNewTStep: number;
msbset: number;
mxIter: number;
printFl: number;
optimizeAlgebraicResidualsEvaluations: boolean;
skipNRIfInitialGuessOK: boolean;
enableSilentZ: boolean;
optimizeReInitAlgebraicResidualsEvaluations: boolean;
minimumModeChangeTypeForAlgebraicRestoration: string;
minimumModeChangeTypeForAlgebraicRestorationInit: string;
};
type NetworkInfos = Record<string, UUID | number | string | boolean>;
type CurveInfos = {
id?: UUID;
equipmentType?: string;
equipmentId: string;
variableId: string;
};
export type SolverInfos = IdaSolverInfos | SimSolverInfos;
export type DynamicSimulationParametersInfos = {
id?: UUID;
provider?: string;
startTime?: number;
stopTime?: number;
mappingId?: UUID;
solver: SolverType;
solvers?: SolverInfos[];
network?: NetworkInfos;
curves?: CurveInfos[] | null;
};
export type DynamicSimulationParametersEnriched = Omit<DynamicSimulationParametersInfos, 'mappingId'> & {
mapping?: IdName;
};
export function mapDynamicSimulationParameters(
parameters: DynamicSimulationParametersEnriched
): DynamicSimulationParametersInfos {
const newParameters = {
...parameters,
mappingId: parameters.mapping?.id,
};
delete newParameters.mapping;
return newParameters;
}
// --- Types related to model/variables --- //
export type ModelVariableDefinitionInfos = {
name: string;
unit: string;
};
export type VariablesSetInfos = {
name: string;
variableDefinitions: ModelVariableDefinitionInfos[];
};
export type DynamicSimulationModelInfos = {
modelName: string;
equipmentType: EquipmentType;
variableDefinitions: ModelVariableDefinitionInfos[];
variablesSets: VariablesSetInfos[];
};