NREL / SOEP-QSS-Test

0 stars 1 forks source link

Dependencies refinements #23

Open DeadParrot opened 2 years ago

DeadParrot commented 2 years ago

QSS is using the new <Dependencies> section of the modelDescription.xml files to obtain the dependency graph it needs for correct simulation because some dependency short circuiting modifications in the <ModelStructure> dependencies turned out to be removing information that QSS needs. The <Dependencies> section does not do any short-circuiting so QSS applies the short circuiting it wants for efficient and correct simulations. We note these here with the idea that in the future we may decide that it makes sense for OCT to do some of these or we may find some dependency issue that QSS doesn't have enough information to make desired/necessary dependency changes.

DeadParrot commented 2 years ago

With OCT development version OCT-dev-cw-5212-18478f3488ff1272c52222a29d72215983eadeec I get some surprising extra dependencies from the DepTest model:

            <Dependencies>
                <Element index="11" dependencies="11 12 46 47 48 50"/>
                <Element index="12" dependencies="11 12 46 47 48 50"/>
                <Element index="46" dependencies="11 12 46 47 48 50"/>
                <Element index="47" dependencies="11 12 46 47 48 50"/>
            </Dependencies>

where I expect:

            <Dependencies>
                <Element index="11" dependencies="46 48 50"/>
                <Element index="12" dependencies="47 48 50"/>
                <Element index="46" dependencies="11 46"/>
                <Element index="47" dependencies="12 47"/>
            </Dependencies>

where the variable indexes correspond as follows:

Note on the areas of concern:

Edit: These issues were addressed by moving the when blocks to the equation section, which doesn't generate the extra dependencies.

DeadParrot commented 2 years ago

With OCT development version OCT-master-7245bce03ab2ebdfdaaf0805d75209efaa009c67 the DepTest5 model has the dependencies:

            <Dependencies>
                <Element index="11" dependencies="45 46 48" />
                <Element index="45" dependencies="11 46 48" />
            </Dependencies>

that has the extra (indirect) dependencies of the event indicator on s and r on time. Changing the dependencies to:

            <Dependencies>
                <Element index="11" dependencies="45 48"/>
                <Element index="45" dependencies="11 46"/>
            </Dependencies>

still provides a correct QSS simulation but eliminating extra dependencies is beneficial for performance.

Edit: Made a separate Issue #26 for this.

DeadParrot commented 1 year ago

With OCT development version OCT-master-7245bce03ab2ebdfdaaf0805d75209efaa009c67 the DepTest4 model has the dependencies:

            <Dependencies>
                <Element index="11" dependencies="11 12 47" />
                <Element index="12" dependencies="11 12 47" />
                <Element index="46" dependencies="11 12 47" />
            </Dependencies>

that are missing the event indicators' dependencies on d. This runs correctly as is with the current QSS revision but makes d a passive variable. Changing the dependencies to:

            <Dependencies>
                <Element index="11" dependencies="11 12 46 47" />
                <Element index="12" dependencies="11 12 46 47" />
                <Element index="46" dependencies="11 12 47" />
            </Dependencies>

makes d an active variable, which means that it can act an an update firewall and that it updates with the events rather than requiring sampled output times to see its trajectory.

Edit: On further consideration, the event indicators generated by the d = integer(time); equation don't have a dependency on d so the OCT-generated dependencies are fine as is.