Skip to content

Commit

Permalink
Remove 'Model' suffix from BlackBoxModel subclasses (#289)
Browse files Browse the repository at this point in the history
Signed-off-by: lisrte <[email protected]>
  • Loading branch information
Lisrte authored Sep 28, 2023
1 parent dcd8a33 commit 663120c
Show file tree
Hide file tree
Showing 20 changed files with 47 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import com.powsybl.dynamicsimulation.groovy.EventModelGroovyExtension
import com.powsybl.dynawaltz.dsl.AbstractPureDynamicGroovyExtension
import com.powsybl.dynawaltz.dsl.DslEquipment
import com.powsybl.dynawaltz.dsl.builders.AbstractEventModelBuilder
import com.powsybl.dynawaltz.models.events.AbstractEventModel
import com.powsybl.dynawaltz.models.events.AbstractEvent
import com.powsybl.dynawaltz.models.events.EventHvdcDisconnection
import com.powsybl.dynawaltz.models.events.EventQuadripoleDisconnection
import com.powsybl.dynawaltz.models.events.EventInjectionDisconnection
Expand Down Expand Up @@ -106,7 +106,7 @@ class EventDisconnectionGroovyExtension extends AbstractPureDynamicGroovyExtensi
}

@Override
AbstractEventModel build() {
AbstractEvent build() {
if (isInstantiable()) {
switch(disconnectionType) {
case DisconnectionType.INJECTION :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class EventModelsSupplierTest extends AbstractModelSupplierTest {

@ParameterizedTest(name = "{0}")
@MethodSource("provideEventModelData")
void testEventModels(String groovyScriptName, Class<? extends AbstractEventModel> modelClass, Network network, String equipmentStaticId, String dynamicId, String lib, double startTime) {
void testEventModels(String groovyScriptName, Class<? extends AbstractEvent> modelClass, Network network, String equipmentStaticId, String dynamicId, String lib, double startTime) {
EventModelsSupplier supplier = new GroovyEventModelsSupplier(getResourceAsStream(groovyScriptName), EXTENSIONS);
List<EventModel> eventModels = supplier.get(network);
assertEquals(1, eventModels.size());
Expand All @@ -51,7 +51,7 @@ void testDslWarnings(String groovyScriptName, Network network) {
assertTrue(supplier.get(network).isEmpty());
}

void assertEventModel(AbstractEventModel em, String dynamicId, String equipmentStaticId, String lib, double startTime) {
void assertEventModel(AbstractEvent em, String dynamicId, String equipmentStaticId, String lib, double startTime) {
assertEquals(dynamicId, em.getDynamicModelId());
assertEquals(equipmentStaticId, em.getEquipment().getId());
assertEquals(dynamicId, em.getParameterSetId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
/**
* @author Florian Dupuy <florian.dupuy at rte-france.com>
*/
public class DefaultBusModel extends AbstractDefaultModel implements BusModel {
public DefaultBusModel(String staticId) {
public class DefaultBus extends AbstractDefaultModel implements BusModel {
public DefaultBus(String staticId) {
super(staticId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
import com.powsybl.commons.PowsyblException;
import com.powsybl.dynawaltz.models.Model;
import com.powsybl.dynawaltz.models.buses.BusModel;
import com.powsybl.dynawaltz.models.buses.DefaultBusModel;
import com.powsybl.dynawaltz.models.buses.DefaultBus;
import com.powsybl.dynawaltz.models.generators.GeneratorModel;
import com.powsybl.dynawaltz.models.generators.DefaultGeneratorModel;
import com.powsybl.dynawaltz.models.hvdc.DefaultHvdcModel;
import com.powsybl.dynawaltz.models.generators.DefaultGenerator;
import com.powsybl.dynawaltz.models.hvdc.DefaultHvdc;
import com.powsybl.dynawaltz.models.hvdc.HvdcModel;
import com.powsybl.dynawaltz.models.lines.DefaultLineModel;
import com.powsybl.dynawaltz.models.lines.DefaultLine;
import com.powsybl.dynawaltz.models.lines.LineModel;
import com.powsybl.dynawaltz.models.loads.DefaultLoadModel;
import com.powsybl.dynawaltz.models.loads.DefaultLoad;
import com.powsybl.dynawaltz.models.loads.LoadModel;
import com.powsybl.dynawaltz.models.shunts.DefaultShuntModel;
import com.powsybl.dynawaltz.models.shunts.DefaultShunt;
import com.powsybl.dynawaltz.models.shunts.ShuntModel;
import com.powsybl.dynawaltz.models.svarcs.DefaultStaticVarCompensatorModel;
import com.powsybl.dynawaltz.models.svarcs.DefaultStaticVarCompensator;
import com.powsybl.dynawaltz.models.svarcs.StaticVarCompensatorModel;
import com.powsybl.dynawaltz.models.transformers.DefaultTransformerModel;
import com.powsybl.dynawaltz.models.transformers.DefaultTransformer;
import com.powsybl.dynawaltz.models.transformers.TransformerModel;
import com.powsybl.iidm.network.Identifiable;
import com.powsybl.iidm.network.IdentifiableType;
Expand All @@ -44,14 +44,14 @@ public class DefaultModelsHandler {
private final Map<Class<? extends Model>, DefaultModelFactory<? extends Model>> factoryMap;

public DefaultModelsHandler() {
factoryMap = Map.of(BusModel.class, new DefaultModelFactory<BusModel>(DefaultBusModel::new),
GeneratorModel.class, new DefaultModelFactory<GeneratorModel>(DefaultGeneratorModel::new),
HvdcModel.class, new DefaultModelFactory<HvdcModel>(DefaultHvdcModel::new),
LineModel.class, new DefaultModelFactory<LineModel>(DefaultLineModel::new),
LoadModel.class, new DefaultModelFactory<LoadModel>(DefaultLoadModel::new),
ShuntModel.class, new DefaultModelFactory<ShuntModel>(DefaultShuntModel::new),
StaticVarCompensatorModel.class, new DefaultModelFactory<StaticVarCompensatorModel>(DefaultStaticVarCompensatorModel::new),
TransformerModel.class, new DefaultModelFactory<TransformerModel>(DefaultTransformerModel::new));
factoryMap = Map.of(BusModel.class, new DefaultModelFactory<BusModel>(DefaultBus::new),
GeneratorModel.class, new DefaultModelFactory<GeneratorModel>(DefaultGenerator::new),
HvdcModel.class, new DefaultModelFactory<HvdcModel>(DefaultHvdc::new),
LineModel.class, new DefaultModelFactory<LineModel>(DefaultLine::new),
LoadModel.class, new DefaultModelFactory<LoadModel>(DefaultLoad::new),
ShuntModel.class, new DefaultModelFactory<ShuntModel>(DefaultShunt::new),
StaticVarCompensatorModel.class, new DefaultModelFactory<StaticVarCompensatorModel>(DefaultStaticVarCompensator::new),
TransformerModel.class, new DefaultModelFactory<TransformerModel>(DefaultTransformer::new));

powSyBlTypeToModel.put(IdentifiableType.BUS, BusModel.class);
powSyBlTypeToModel.put(IdentifiableType.GENERATOR, GeneratorModel.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* @author Laurent Issertial <laurent.issertial at rte-france.com>
*/
public abstract class AbstractDynamicLibEventDisconnection extends AbstractEventModel {
public abstract class AbstractDynamicLibEventDisconnection extends AbstractEvent {

private static final String EVENT_PREFIX = "Disconnect_";
private static final String DYNAMIC_MODEL_LIB = "EventSetPointBoolean";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
* @author Florian Dupuy <florian.dupuy at rte-france.com>
* @author Laurent Issertial <laurent.issertial at rte-france.com>
*/
public abstract class AbstractEventModel extends AbstractPureDynamicBlackBoxModel implements EventModel {
public abstract class AbstractEvent extends AbstractPureDynamicBlackBoxModel implements EventModel {

private final Identifiable<?> equipment;
private final double startTime;

protected AbstractEventModel(Identifiable<?> equipment, double startTime, String eventPrefix) {
protected AbstractEvent(Identifiable<?> equipment, double startTime, String eventPrefix) {
super(generateEventId(equipment.getId(), eventPrefix));
this.equipment = equipment;
this.startTime = startTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/**
* @author Laurent Issertial <laurent.issertial at rte-france.com>
*/
public class EventActivePowerVariation extends AbstractEventModel {
public class EventActivePowerVariation extends AbstractEvent {

private static final EnumSet<IdentifiableType> CONNECTABLE_EQUIPMENTS = EnumSet.of(IdentifiableType.GENERATOR, IdentifiableType.LOAD);
private static final String EVENT_PREFIX = "Step_";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* @author Marcos de Miguel <demiguelm at aia.es>
* @author Laurent Issertial <laurent.issertial at rte-france.com>
*/
public class EventQuadripoleDisconnection extends AbstractEventModel {
public class EventQuadripoleDisconnection extends AbstractEvent {

private static final String EVENT_PREFIX = "Disconnect_";
private final boolean disconnectOrigin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* @author Laurent Issertial <laurent.issertial at rte-france.com>
*/
public class NodeFaultEvent extends AbstractEventModel {
public class NodeFaultEvent extends AbstractEvent {

private static final String EVENT_PREFIX = "Node_Fault_";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
* @author Marcos de Miguel <demiguelm at aia.es>
* @author Laurent Issertial <laurent.issertial at rte-france.com>
*/
public abstract class AbstractGeneratorModel extends AbstractEquipmentBlackBoxModel<Generator> implements GeneratorModel {
public abstract class AbstractGenerator extends AbstractEquipmentBlackBoxModel<Generator> implements GeneratorModel {

protected static final List<VarMapping> VAR_MAPPING = Arrays.asList(
new VarMapping("generator_PGenPu", "p"),
new VarMapping("generator_QGenPu", "q"),
new VarMapping("generator_state", "state"));

protected AbstractGeneratorModel(String dynamicModelId, Generator generator, String parameterSetId, String lib) {
protected AbstractGenerator(String dynamicModelId, Generator generator, String parameterSetId, String lib) {
super(dynamicModelId, parameterSetId, generator, lib);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
/**
* @author Laurent Issertial <laurent.issertial at rte-france.com>
*/
public class DefaultGeneratorModel extends AbstractInjectionDefaultModel implements GeneratorModel, ControllableEquipment {
public class DefaultGenerator extends AbstractInjectionDefaultModel implements GeneratorModel, ControllableEquipment {

public DefaultGeneratorModel(String staticId) {
public DefaultGenerator(String staticId) {
super(staticId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @author Dimitri Baudrier <dimitri.baudrier at rte-france.com>
* @author Laurent Issertial <laurent.issertial at rte-france.com>
*/
public class GeneratorFictitious extends AbstractGeneratorModel {
public class GeneratorFictitious extends AbstractGenerator {

public GeneratorFictitious(String dynamicModelId, Generator generator, String parameterSetId) {
super(dynamicModelId, generator, parameterSetId, "GeneratorFictitious");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @author Dimitri Baudrier <dimitri.baudrier at rte-france.com>
* @author Laurent Issertial <laurent.issertial at rte-france.com>
*/
public class SynchronizedGenerator extends AbstractGeneratorModel implements FrequencySynchronizedModel {
public class SynchronizedGenerator extends AbstractGenerator implements FrequencySynchronizedModel {

public SynchronizedGenerator(String dynamicModelId, Generator generator, String parameterSetId, String generatorLib) {
super(dynamicModelId, generator, parameterSetId, generatorLib);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
/**
* @author Laurent Issertial <laurent.issertial at rte-france.com>
*/
public class DefaultHvdcModel extends AbstractDefaultModel implements HvdcModel {
public class DefaultHvdc extends AbstractDefaultModel implements HvdcModel {

public DefaultHvdcModel(String staticId) {
public DefaultHvdc(String staticId) {
super(staticId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
/**
* @author Florian Dupuy <florian.dupuy at rte-france.com>
*/
public class DefaultLineModel extends AbstractDefaultModel implements LineModel {
public class DefaultLine extends AbstractDefaultModel implements LineModel {

public DefaultLineModel(String staticId) {
public DefaultLine(String staticId) {
super(staticId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
/**
* @author Laurent Issertial <laurent.issertial at rte-france.com>
*/
public class DefaultLoadModel extends AbstractInjectionDefaultModel implements LoadModel, ControllableEquipment {
public class DefaultLoad extends AbstractInjectionDefaultModel implements LoadModel, ControllableEquipment {

public DefaultLoadModel(String staticId) {
public DefaultLoad(String staticId) {
super(staticId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
/**
* @author Laurent Issertial <laurent.issertial at rte-france.com>
*/
public class DefaultShuntModel extends AbstractInjectionDefaultModel implements ShuntModel {
public class DefaultShunt extends AbstractInjectionDefaultModel implements ShuntModel {

public DefaultShuntModel(String staticId) {
public DefaultShunt(String staticId) {
super(staticId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
/**
* @author Laurent Issertial <laurent.issertial at rte-france.com>
*/
public class DefaultStaticVarCompensatorModel extends AbstractInjectionDefaultModel implements StaticVarCompensatorModel {
public class DefaultStaticVarCompensator extends AbstractInjectionDefaultModel implements StaticVarCompensatorModel {

public DefaultStaticVarCompensatorModel(String staticId) {
public DefaultStaticVarCompensator(String staticId) {
super(staticId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
/**
* @author Laurent Issertial <laurent.issertial at rte-france.com>
*/
public class DefaultTransformerModel extends AbstractDefaultModel implements TransformerModel, TapChangerModel {
public class DefaultTransformer extends AbstractDefaultModel implements TransformerModel, TapChangerModel {

public DefaultTransformerModel(String staticId) {
public DefaultTransformer(String staticId) {
super(staticId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@ void testDynamicModelGetterFromIdentifiableTypeException() {
// requested interface not implemented
Identifiable<?> transformer = network.getIdentifiable("NGEN_NHV1");
e = assertThrows(PowsyblException.class, () -> dc.getDynamicModel(transformer, InjectionModel.class));
assertEquals("Default model DefaultTransformerModel does not implement InjectionModel interface", e.getMessage());
assertEquals("Default model DefaultTransformer does not implement InjectionModel interface", e.getMessage());
}
}

0 comments on commit 663120c

Please sign in to comment.