NICTA / SmartGridToolbox

Smart Grid Simulation Library (C++14)

Home Page:http://nicta.github.io/SmartGridToolbox

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SimNetworkComponents

dexterurbane opened this issue · comments

Always hard to decide on containment vs inheritance for e.g. SimBus -> Bus.

Containment looks like a good idea, but parallel hierarchies are a problem: SimBusDerived should access BusDerived. This could be done by either storing a new, derived pointer or casting - neither option ideal. Basically, we need to implement a small amount of guff, and deriving SimBus from Bus and SimBusDerived from BusDerived turns out cleaner.

However, (1) some SimComponents will have more than one Network Components as members, (2) in certain cases, we may wish to use containment anyhow and (3) keeping the Network distinct from the SimNetwork, i.e. no Network Components are actually SimComponents, feels like a good idea.

So I think it is still worth revisiting this issue.

I have gone some way toward fixing this up by making SimNetworkComponent use containment for the most part. I have also gotten rid of the interfaces, as they simply complicate the picture without really solving any problems: now I am just using virtual base classes for Component and SimComponent. Inheritance is possible, but e.g. bus() etc. still need to be defined. I'll leave it open for now. For a nasty class diagram, look in particular at SimpleZipInverter. It would be nice to clean this up some more.

More or less closed now, we mainly use containment in the latest version.