Skip to content

Commit

Permalink
Renaming path input constants
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
  • Loading branch information
flo-dup committed Apr 21, 2023
1 parent 6daa261 commit 313f559
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public class DynaWaltzParameters extends AbstractExtension<DynamicSimulationPara
public static final String DEFAULT_NETWORK_PAR_ID = "1";
public static final String DEFAULT_SOLVER_PAR_ID = "1";
public static final boolean DEFAULT_MERGE_LOADS = true;
public static final String DEFAULT_PARAMETERS_FILE = "models.par";
public static final String DEFAULT_NETWORK_PARAMETERS_FILE = "network.par";
public static final String DEFAULT_SOLVER_PARAMETERS_FILE = "solvers.par";
public static final String DEFAULT_INPUT_PARAMETERS_FILE = "models.par";
public static final String DEFAULT_INPUT_NETWORK_PARAMETERS_FILE = "network.par";
public static final String DEFAULT_INPUT_SOLVER_PARAMETERS_FILE = "solvers.par";
public static final String MODELS_OUTPUT_PARAMETERS_FILE = "models.par";
public static final String NETWORK_OUTPUT_PARAMETERS_FILE = "network.par";
public static final String SOLVER_OUTPUT_PARAMETERS_FILE = "solvers.par";
Expand Down Expand Up @@ -66,12 +66,12 @@ public static DynaWaltzParameters load(PlatformConfig platformConfig, FileSystem
Optional<ModuleConfig> config = platformConfig.getOptionalModuleConfig("dynawaltz-default-parameters");

// File with all the dynamic models' parameters for the simulation
String parametersFile = config.map(c -> c.getStringProperty("parametersFile")).orElse(DEFAULT_PARAMETERS_FILE);
String parametersFile = config.map(c -> c.getStringProperty("parametersFile")).orElse(DEFAULT_INPUT_PARAMETERS_FILE);
Path parametersPath = platformConfig.getConfigDir().map(configDir -> configDir.resolve(parametersFile))
.orElse(fileSystem.getPath(parametersFile));

// File with all the network's parameters for the simulation
String networkParametersFile = config.map(c -> c.getStringProperty("network.parametersFile")).orElse(DEFAULT_NETWORK_PARAMETERS_FILE);
String networkParametersFile = config.map(c -> c.getStringProperty("network.parametersFile")).orElse(DEFAULT_INPUT_NETWORK_PARAMETERS_FILE);
Path networkParametersPath = platformConfig.getConfigDir().map(configDir -> configDir.resolve(networkParametersFile))
.orElse(fileSystem.getPath(networkParametersFile));

Expand All @@ -84,7 +84,7 @@ public static DynaWaltzParameters load(PlatformConfig platformConfig, FileSystem
SolverType solverType = config.flatMap(c -> c.getOptionalEnumProperty("solver.type", SolverType.class)).orElse(DEFAULT_SOLVER_TYPE);

// File with all the solvers' parameters for the simulation
String solverParametersFile = config.flatMap(c -> c.getOptionalStringProperty("solver.parametersFile")).orElse(DEFAULT_SOLVER_PARAMETERS_FILE);
String solverParametersFile = config.flatMap(c -> c.getOptionalStringProperty("solver.parametersFile")).orElse(DEFAULT_INPUT_SOLVER_PARAMETERS_FILE);
Path solverParametersPath = platformConfig.getConfigDir().map(configDir -> configDir.resolve(solverParametersFile))
.orElse(fileSystem.getPath(solverParametersFile));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ private void initPlatformConfig(String networkParametersId, SolverType solverTyp
@Test
void checkDefaultParameters() throws IOException {
Files.createDirectories(fileSystem.getPath(USER_HOME));
copyFile("/parametersSet/models.par", DynaWaltzParameters.DEFAULT_PARAMETERS_FILE);
copyFile("/parametersSet/network.par", DynaWaltzParameters.DEFAULT_NETWORK_PARAMETERS_FILE);
copyFile("/parametersSet/solvers.par", DynaWaltzParameters.DEFAULT_SOLVER_PARAMETERS_FILE);
copyFile("/parametersSet/models.par", DynaWaltzParameters.DEFAULT_INPUT_PARAMETERS_FILE);
copyFile("/parametersSet/network.par", DynaWaltzParameters.DEFAULT_INPUT_NETWORK_PARAMETERS_FILE);
copyFile("/parametersSet/solvers.par", DynaWaltzParameters.DEFAULT_INPUT_SOLVER_PARAMETERS_FILE);

DynaWaltzParameters parameters = DynaWaltzParameters.load(platformConfig, fileSystem);
checModelParameters(parameters);
Expand Down

0 comments on commit 313f559

Please sign in to comment.