open-simulation-platform / libcosim

OSP C++ co-simulation library
https://open-simulation-platform.github.io/libcosim
Mozilla Public License 2.0
54 stars 10 forks source link

Improve LogConfig.xml #666

Open ljamt opened 2 years ago

ljamt commented 2 years ago

LogConfig is for listing variables to log.

<simulators>
    <simulator name="sim1">
        <variable name="var1"/>
        <variable name="var2"/>
    </simulator>
    <simulator name="sim2">
        <variable name="var1"/>
        <variable name="var2"/>
    </simulator>
</simulators>

A common use case is to omit all variables with causality parameter. Using LogConfig.xml for this you would have to add all variables that is not paramters.

What would be the best format to allow for this functionality?

<simulators>
    <simulator name="sim1">
        <omit>
            <causality name="parameter"/>
            <variable name="var3"/>
        </omit>
    </simulator>
</simulators>
<simulators>
    <simulator name="sim1" omit-causalities="parameter">
        <variable name="var1"/>
    </simulator>
</simulators>
kyllingstad commented 2 years ago

I agree that this would be a nice feature. Of the two suggested schemas, I prefer the first one. But just to complicate matters, let me throw a third one into the mix. ;)

<simulators>
    <!-- Selection mode "include" works like today; it includes only the specified
        variables and categories. It is also the default, for backwards compatibility. -->
    <simulator name="sim1" selection-mode="include">
        <variable name="var1"/>
        <variable name="var2"/>
        <causality name="output"/>
    </simulator>
    <!-- Selection mode "exclude" is the opposite; it includes everything *except*
        the specified variables and categories. -->
    <simulator name="sim2" selection-mode="exclude">
        <variable name="var3"/>
        <causality name="parameter"/>
    </simulator>
</simulators>
ljamt commented 2 years ago

Actually you are not complicating matters. I realized that we either have to include or exclude variables, but couldn't find a suitable format for this. Your suggestion looks great!