Skip to content

CIM: Implement mapDisconnector and mapBreaker using std::dynamic_pointer_cast #561

Description

@pipeacosta

Dynamic casting from CPS::Base::Ph1::Switch to TopologicalPowerComp is currently not possible. This is the preferred strategy to implement mapDisconnector and mapBreaker. We need to check if it is possible to fix this, by verifying the inheritance of the involved classes.

As a workaround, these functions were implemented in #556 using an intermediate shared pointer to a CPS::TopologicalPowerComp.

Activity

  1. leonardocarreras commented on Jul 10, 2026

    @leonardocarreras
    Contributor

    Probable fix: add function virtual ~Switch() = default then they could become polymorphic.

    If this is proves to be the fix, other components also would benefit from virtual ~ClassName() = default:
    dpsim-models/include/dpsim-models/Base/Base_AvVoltageSourceInverterDQ.h
    dpsim-models/include/dpsim-models/Base/Base_AvVoltageSourceInverterDQWithStateSpace.h
    dpsim-models/include/dpsim-models/Base/Base_Ph1_Capacitor.h
    dpsim-models/include/dpsim-models/Base/Base_Ph1_CurrentSource.h
    dpsim-models/include/dpsim-models/Base/Base_Ph1_Inductor.h
    dpsim-models/include/dpsim-models/Base/Base_Ph1_PiLine.h
    dpsim-models/include/dpsim-models/Base/Base_Ph1_Resistor.h
    dpsim-models/include/dpsim-models/Base/Base_Ph1_SVC.h
    dpsim-models/include/dpsim-models/Base/Base_Ph1_Switch.h
    dpsim-models/include/dpsim-models/Base/Base_Ph1_Transformer.h
    dpsim-models/include/dpsim-models/Base/Base_Ph1_VoltageSource.h
    dpsim-models/include/dpsim-models/Base/Base_Ph3_VoltageSource.h
    dpsim-models/include/dpsim-models/Base/Base_Ph3_Capacitor.h
    dpsim-models/include/dpsim-models/Base/Base_Ph3_Inductor.h
    dpsim-models/include/dpsim-models/Base/Base_Ph3_PiLine.h
    dpsim-models/include/dpsim-models/Base/Base_Ph3_Resistor.h
    dpsim-models/include/dpsim-models/Base/Base_Ph3_Switch.h
    dpsim-models/include/dpsim-models/Base/Base_Ph3_Transformer.h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions