Skip to content

Commit

Permalink
Review fix
Browse files Browse the repository at this point in the history
Signed-off-by: lisrte <[email protected]>
  • Loading branch information
Lisrte committed Jan 26, 2024
1 parent 83c87e2 commit a724afd
Show file tree
Hide file tree
Showing 29 changed files with 57 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import com.powsybl.dynamicsimulation.groovy.DynamicModelGroovyExtension
import com.powsybl.dynawaltz.DynaWaltzProvider
import com.powsybl.dynawaltz.builders.BuilderConfig
import com.powsybl.dynawaltz.builders.ModelBuilder
import com.powsybl.dynawaltz.builders.ModelConfigsSingleton
import com.powsybl.dynawaltz.builders.ModelConfigs
import com.powsybl.iidm.network.Network

import java.util.function.Consumer
Expand All @@ -27,7 +27,7 @@ class DynaWaltzDynamicModelGroovyExtension implements DynamicModelGroovyExtensio
private final List<BuilderConfig> builderConfigs

DynaWaltzDynamicModelGroovyExtension() {
builderConfigs = ModelConfigsSingleton.getInstance().getBuilderConfigs()
builderConfigs = ModelConfigs.getInstance().getBuilderConfigs()
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import com.powsybl.dynamicsimulation.groovy.EventModelGroovyExtension
import com.powsybl.dynawaltz.DynaWaltzProvider
import com.powsybl.dynawaltz.builders.EventBuilderConfig
import com.powsybl.dynawaltz.builders.ModelBuilder
import com.powsybl.dynawaltz.builders.ModelConfigsSingleton
import com.powsybl.dynawaltz.builders.ModelConfigs
import com.powsybl.iidm.network.Network

import java.util.function.Consumer
Expand All @@ -27,7 +27,7 @@ class DynaWaltzEventModelGroovyExtension implements EventModelGroovyExtension {
private final List<EventBuilderConfig> builderConfigs

DynaWaltzEventModelGroovyExtension() {
builderConfigs = ModelConfigsSingleton.getInstance().getEventBuilderConfigs()
builderConfigs = ModelConfigs.getInstance().getEventBuilderConfigs()
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* @author Marcos de Miguel {@literal <demiguelm at aia.es>}
*/
class Ieee14CurrentLimitAutomatonLimitAutomatonBuilderTest extends AbstractIeeeTest {
class Ieee14CurrentLimitAutomatonTest extends AbstractIeeeTest {

@BeforeEach
void setup() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@
*/
public interface ModelsSimplifier {

//TODO replace with SimplifierContext and restraint direct action on Dynawaltz data
Stream<BlackBoxModel> simplifyModels(Stream<BlackBoxModel> models, Network network, DynaWaltzParameters dynaWaltzParameters, Reporter reporter);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
*/
public final class ModelConfigsSingleton {
public final class ModelConfigs {

private static final ModelConfigsSingleton INSTANCE = new ModelConfigsSingleton();
private static final ModelConfigs INSTANCE = new ModelConfigs();

private final List<ModelConfigLoader> modelConfigLoaders;
private final Map<String, Map<String, ModelConfig>> modelConfigs = new HashMap<>();
Expand All @@ -32,7 +32,7 @@ public final class ModelConfigsSingleton {
new EventBuilderConfig(EventDisconnectionBuilder::of, EventDisconnectionBuilder.TAG),
new EventBuilderConfig(NodeFaultEventBuilder::of, NodeFaultEventBuilder.TAG));

private ModelConfigsSingleton() {
private ModelConfigs() {
modelConfigLoaders = Lists.newArrayList(ServiceLoader.load(ModelConfigLoader.class));
modelConfigLoaders.forEach(l -> l.loadModelConfigs().forEach(
(cat, modelsMap) -> modelConfigs.merge(cat, modelsMap, (map1, map2) -> {
Expand All @@ -43,7 +43,7 @@ private ModelConfigsSingleton() {
builderConfigs = modelConfigLoaders.stream().flatMap(ModelConfigLoader::loadBuilderConfigs).toList();
}

public static ModelConfigsSingleton getInstance() {
public static ModelConfigs getInstance() {
return INSTANCE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.powsybl.commons.reporter.Reporter;
import com.powsybl.dynawaltz.builders.BuilderEquipment;
import com.powsybl.dynawaltz.builders.ModelConfig;
import com.powsybl.dynawaltz.builders.ModelConfigsSingleton;
import com.powsybl.dynawaltz.builders.ModelConfigs;
import com.powsybl.dynawaltz.builders.Reporters;
import com.powsybl.dynawaltz.models.TransformerSide;
import com.powsybl.iidm.network.IdentifiableType;
Expand All @@ -26,7 +26,7 @@
public class TapChangerAutomatonBuilder extends AbstractAutomatonModelBuilder<TapChangerAutomatonBuilder> {

private static final String CATEGORY = "tapChangers";
private static final Map<String, ModelConfig> LIBS = ModelConfigsSingleton.getInstance().getModelConfigs(CATEGORY);
private static final Map<String, ModelConfig> LIBS = ModelConfigs.getInstance().getModelConfigs(CATEGORY);

protected final BuilderEquipment<Load> load;
protected TransformerSide side = TransformerSide.NONE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.powsybl.commons.reporter.Reporter;
import com.powsybl.dynawaltz.builders.BuildersUtil;
import com.powsybl.dynawaltz.builders.ModelConfig;
import com.powsybl.dynawaltz.builders.ModelConfigsSingleton;
import com.powsybl.dynawaltz.builders.ModelConfigs;
import com.powsybl.dynawaltz.builders.Reporters;
import com.powsybl.iidm.network.Identifiable;
import com.powsybl.iidm.network.Load;
Expand All @@ -25,7 +25,7 @@
public class TapChangerBlockingAutomatonBuilder extends AbstractAutomatonModelBuilder<TapChangerBlockingAutomatonBuilder> {

private static final String CATEGORY = "tcbs";
private static final Map<String, ModelConfig> LIBS = ModelConfigsSingleton.getInstance().getModelConfigs(CATEGORY);
private static final Map<String, ModelConfig> LIBS = ModelConfigs.getInstance().getModelConfigs(CATEGORY);
private static final String U_MEASUREMENTS_FIELD = "uMeasurements";

private final List<Load> loads = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.powsybl.commons.reporter.Reporter;
import com.powsybl.dynawaltz.builders.BuilderEquipment;
import com.powsybl.dynawaltz.builders.ModelConfig;
import com.powsybl.dynawaltz.builders.ModelConfigsSingleton;
import com.powsybl.dynawaltz.builders.ModelConfigs;
import com.powsybl.dynawaltz.builders.Reporters;
import com.powsybl.iidm.network.Generator;
import com.powsybl.iidm.network.IdentifiableType;
Expand All @@ -25,7 +25,7 @@
public class UnderVoltageAutomatonBuilder extends AbstractAutomatonModelBuilder<UnderVoltageAutomatonBuilder> {

private static final String CATEGORY = "underVoltages";
private static final Map<String, ModelConfig> LIBS = ModelConfigsSingleton.getInstance().getModelConfigs(CATEGORY);
private static final Map<String, ModelConfig> LIBS = ModelConfigs.getInstance().getModelConfigs(CATEGORY);

protected final BuilderEquipment<Generator> generator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.powsybl.commons.reporter.Reporter;
import com.powsybl.dynawaltz.builders.BuilderEquipment;
import com.powsybl.dynawaltz.builders.ModelConfig;
import com.powsybl.dynawaltz.builders.ModelConfigsSingleton;
import com.powsybl.dynawaltz.builders.ModelConfigs;
import com.powsybl.dynawaltz.builders.Reporters;
import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.TwoSides;
Expand All @@ -24,7 +24,7 @@
public class CurrentLimitAutomatonBuilder extends AbstractCurrentLimitAutomatonBuilder<CurrentLimitAutomatonBuilder> {

private static final String CATEGORY = "clas";
private static final Map<String, ModelConfig> LIBS = ModelConfigsSingleton.getInstance().getModelConfigs(CATEGORY);
private static final Map<String, ModelConfig> LIBS = ModelConfigs.getInstance().getModelConfigs(CATEGORY);

public static CurrentLimitAutomatonBuilder of(Network network) {
return of(network, Reporter.NO_OP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.powsybl.commons.reporter.Reporter;
import com.powsybl.dynawaltz.builders.BuilderEquipment;
import com.powsybl.dynawaltz.builders.ModelConfig;
import com.powsybl.dynawaltz.builders.ModelConfigsSingleton;
import com.powsybl.dynawaltz.builders.ModelConfigs;
import com.powsybl.dynawaltz.builders.Reporters;
import com.powsybl.iidm.network.Branch;
import com.powsybl.iidm.network.Network;
Expand All @@ -25,7 +25,7 @@
public class CurrentLimitTwoLevelsAutomatonBuilder extends AbstractCurrentLimitAutomatonBuilder<CurrentLimitTwoLevelsAutomatonBuilder> {

private static final String CATEGORY = "clasTwoLevels";
private static final Map<String, ModelConfig> LIBS = ModelConfigsSingleton.getInstance().getModelConfigs(CATEGORY);
private static final Map<String, ModelConfig> LIBS = ModelConfigs.getInstance().getModelConfigs(CATEGORY);

protected final BuilderEquipment<Branch<?>> iMeasurement2;
protected TwoSides iMeasurement2Side;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import com.powsybl.commons.reporter.Reporter;
import com.powsybl.dynawaltz.builders.ModelConfig;
import com.powsybl.dynawaltz.builders.ModelConfigsSingleton;
import com.powsybl.dynawaltz.builders.ModelConfigs;
import com.powsybl.dynawaltz.builders.Reporters;
import com.powsybl.iidm.network.Network;

Expand All @@ -22,7 +22,7 @@
public class PhaseShifterIAutomatonBuilder extends AbstractPhaseShifterModelBuilder<PhaseShifterIAutomatonBuilder> {

private static final String CATEGORY = "phaseShiftersI";
private static final Map<String, ModelConfig> LIBS = ModelConfigsSingleton.getInstance().getModelConfigs(CATEGORY);
private static final Map<String, ModelConfig> LIBS = ModelConfigs.getInstance().getModelConfigs(CATEGORY);

public static PhaseShifterIAutomatonBuilder of(Network network) {
return of(network, Reporter.NO_OP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import com.powsybl.commons.reporter.Reporter;
import com.powsybl.dynawaltz.builders.ModelConfig;
import com.powsybl.dynawaltz.builders.ModelConfigsSingleton;
import com.powsybl.dynawaltz.builders.ModelConfigs;
import com.powsybl.dynawaltz.builders.Reporters;
import com.powsybl.iidm.network.Network;

Expand All @@ -22,7 +22,7 @@
public class PhaseShifterPAutomatonBuilder extends AbstractPhaseShifterModelBuilder<PhaseShifterPAutomatonBuilder> {

private static final String CATEGORY = "phaseShiftersP";
private static final Map<String, ModelConfig> LIBS = ModelConfigsSingleton.getInstance().getModelConfigs(CATEGORY);
private static final Map<String, ModelConfig> LIBS = ModelConfigs.getInstance().getModelConfigs(CATEGORY);

public static PhaseShifterPAutomatonBuilder of(Network network) {
return of(network, Reporter.NO_OP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import com.powsybl.commons.reporter.Reporter;
import com.powsybl.dynawaltz.builders.ModelConfig;
import com.powsybl.dynawaltz.builders.ModelConfigsSingleton;
import com.powsybl.dynawaltz.builders.ModelConfigs;
import com.powsybl.dynawaltz.builders.Reporters;
import com.powsybl.iidm.network.Network;

Expand All @@ -22,7 +22,7 @@
public class InfiniteBusBuilder extends AbstractBusBuilder<InfiniteBusBuilder> {

private static final String CATEGORY = "infiniteBuses";
private static final Map<String, ModelConfig> LIBS = ModelConfigsSingleton.getInstance().getModelConfigs(CATEGORY);
private static final Map<String, ModelConfig> LIBS = ModelConfigs.getInstance().getModelConfigs(CATEGORY);

public static InfiniteBusBuilder of(Network network) {
return of(network, Reporter.NO_OP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import com.powsybl.commons.reporter.Reporter;
import com.powsybl.dynawaltz.builders.ModelConfig;
import com.powsybl.dynawaltz.builders.ModelConfigsSingleton;
import com.powsybl.dynawaltz.builders.ModelConfigs;
import com.powsybl.dynawaltz.builders.Reporters;
import com.powsybl.iidm.network.Network;

Expand All @@ -22,7 +22,7 @@
public class StandardBusBuilder extends AbstractBusBuilder<StandardBusBuilder> {

private static final String CATEGORY = "baseBuses";
private static final Map<String, ModelConfig> LIBS = ModelConfigsSingleton.getInstance().getModelConfigs(CATEGORY);
private static final Map<String, ModelConfig> LIBS = ModelConfigs.getInstance().getModelConfigs(CATEGORY);

public static StandardBusBuilder of(Network network) {
return of(network, Reporter.NO_OP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import com.powsybl.commons.reporter.Reporter;
import com.powsybl.dynawaltz.builders.ModelConfig;
import com.powsybl.dynawaltz.builders.ModelConfigsSingleton;
import com.powsybl.dynawaltz.builders.ModelConfigs;
import com.powsybl.dynawaltz.builders.Reporters;
import com.powsybl.iidm.network.Network;

Expand All @@ -22,7 +22,7 @@
public class GeneratorFictitiousBuilder extends AbstractGeneratorBuilder<GeneratorFictitiousBuilder> {

private static final String CATEGORY = "baseGenerators";
private static final Map<String, ModelConfig> LIBS = ModelConfigsSingleton.getInstance().getModelConfigs(CATEGORY);
private static final Map<String, ModelConfig> LIBS = ModelConfigs.getInstance().getModelConfigs(CATEGORY);

public static GeneratorFictitiousBuilder of(Network network) {
return of(network, Reporter.NO_OP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import com.powsybl.commons.reporter.Reporter;
import com.powsybl.dynawaltz.builders.ModelConfig;
import com.powsybl.dynawaltz.builders.ModelConfigsSingleton;
import com.powsybl.dynawaltz.builders.ModelConfigs;
import com.powsybl.dynawaltz.builders.Reporters;
import com.powsybl.iidm.network.Network;

Expand All @@ -22,7 +22,7 @@
public class GridFormingConverterBuilder extends AbstractGeneratorBuilder<GridFormingConverterBuilder> {

private static final String CATEGORY = "gridFormingConverters";
private static final Map<String, ModelConfig> LIBS = ModelConfigsSingleton.getInstance().getModelConfigs(CATEGORY);
private static final Map<String, ModelConfig> LIBS = ModelConfigs.getInstance().getModelConfigs(CATEGORY);

public static GridFormingConverterBuilder of(Network network) {
return of(network, Reporter.NO_OP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import com.powsybl.commons.reporter.Reporter;
import com.powsybl.dynawaltz.builders.ModelConfig;
import com.powsybl.dynawaltz.builders.ModelConfigsSingleton;
import com.powsybl.dynawaltz.builders.ModelConfigs;
import com.powsybl.dynawaltz.builders.Reporters;
import com.powsybl.iidm.network.Network;

Expand All @@ -22,7 +22,7 @@
public class SynchronizedGeneratorBuilder extends AbstractGeneratorBuilder<SynchronizedGeneratorBuilder> {

private static final String CATEGORY = "synchronizedGenerators";
private static final Map<String, ModelConfig> LIBS = ModelConfigsSingleton.getInstance().getModelConfigs(CATEGORY);
private static final Map<String, ModelConfig> LIBS = ModelConfigs.getInstance().getModelConfigs(CATEGORY);

public static SynchronizedGeneratorBuilder of(Network network) {
return of(network, Reporter.NO_OP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.powsybl.commons.PowsyblException;
import com.powsybl.commons.reporter.Reporter;
import com.powsybl.dynawaltz.builders.ModelConfig;
import com.powsybl.dynawaltz.builders.ModelConfigsSingleton;
import com.powsybl.dynawaltz.builders.ModelConfigs;
import com.powsybl.dynawaltz.builders.Reporters;
import com.powsybl.iidm.network.Network;

Expand All @@ -23,7 +23,7 @@
public class SynchronousGeneratorBuilder extends AbstractGeneratorBuilder<SynchronousGeneratorBuilder> {

private static final String CATEGORY = "synchronousGenerators";
private static final Map<String, ModelConfig> LIBS = ModelConfigsSingleton.getInstance().getModelConfigs(CATEGORY);
private static final Map<String, ModelConfig> LIBS = ModelConfigs.getInstance().getModelConfigs(CATEGORY);

public static SynchronousGeneratorBuilder of(Network network) {
return of(network, Reporter.NO_OP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import com.powsybl.commons.reporter.Reporter;
import com.powsybl.dynawaltz.builders.ModelConfig;
import com.powsybl.dynawaltz.builders.ModelConfigsSingleton;
import com.powsybl.dynawaltz.builders.ModelConfigs;
import com.powsybl.dynawaltz.builders.Reporters;
import com.powsybl.iidm.network.Network;

Expand All @@ -22,7 +22,7 @@
public class WeccBuilder extends AbstractGeneratorBuilder<WeccBuilder> {

private static final String CATEGORY = "wecc";
private static final Map<String, ModelConfig> LIBS = ModelConfigsSingleton.getInstance().getModelConfigs(CATEGORY);
private static final Map<String, ModelConfig> LIBS = ModelConfigs.getInstance().getModelConfigs(CATEGORY);

public static WeccBuilder of(Network network) {
return of(network, Reporter.NO_OP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import com.powsybl.commons.reporter.Reporter;
import com.powsybl.dynawaltz.builders.ModelConfig;
import com.powsybl.dynawaltz.builders.ModelConfigsSingleton;
import com.powsybl.dynawaltz.builders.ModelConfigs;
import com.powsybl.dynawaltz.builders.Reporters;
import com.powsybl.iidm.network.Network;

Expand All @@ -22,7 +22,7 @@
public class HvdcPBuilder extends AbstractHvdcBuilder<HvdcPBuilder> {

private static final String CATEGORY = "hvdcP";
private static final Map<String, ModelConfig> LIBS = ModelConfigsSingleton.getInstance().getModelConfigs(CATEGORY);
private static final Map<String, ModelConfig> LIBS = ModelConfigs.getInstance().getModelConfigs(CATEGORY);

public static HvdcPBuilder of(Network network) {
return of(network, Reporter.NO_OP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import com.powsybl.commons.reporter.Reporter;
import com.powsybl.dynawaltz.builders.ModelConfig;
import com.powsybl.dynawaltz.builders.ModelConfigsSingleton;
import com.powsybl.dynawaltz.builders.ModelConfigs;
import com.powsybl.dynawaltz.builders.Reporters;
import com.powsybl.iidm.network.Network;

Expand All @@ -22,7 +22,7 @@
public class HvdcVscBuilder extends AbstractHvdcBuilder<HvdcVscBuilder> {

private static final String CATEGORY = "hvdcVsc";
private static final Map<String, ModelConfig> LIBS = ModelConfigsSingleton.getInstance().getModelConfigs(CATEGORY);
private static final Map<String, ModelConfig> LIBS = ModelConfigs.getInstance().getModelConfigs(CATEGORY);

public static HvdcVscBuilder of(Network network) {
return of(network, Reporter.NO_OP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.powsybl.commons.reporter.Reporter;
import com.powsybl.dynawaltz.builders.AbstractEquipmentModelBuilder;
import com.powsybl.dynawaltz.builders.ModelConfig;
import com.powsybl.dynawaltz.builders.ModelConfigsSingleton;
import com.powsybl.dynawaltz.builders.ModelConfigs;
import com.powsybl.dynawaltz.builders.Reporters;
import com.powsybl.iidm.network.IdentifiableType;
import com.powsybl.iidm.network.Line;
Expand All @@ -25,7 +25,7 @@
public class LineBuilder extends AbstractEquipmentModelBuilder<Line, LineBuilder> {

private static final String CATEGORY = "baseLines";
private static final Map<String, ModelConfig> LIBS = ModelConfigsSingleton.getInstance().getModelConfigs(CATEGORY);
private static final Map<String, ModelConfig> LIBS = ModelConfigs.getInstance().getModelConfigs(CATEGORY);

public static LineBuilder of(Network network) {
return of(network, Reporter.NO_OP);
Expand Down
Loading

0 comments on commit a724afd

Please sign in to comment.