NREL / SOEP-QSS-Test

0 stars 1 forks source link

Dependencies problems #30

Open DeadParrot opened 1 year ago

DeadParrot commented 1 year ago

The Dependencies section does not yet provide the complete dependency graph that is needed for QSS to simulate correctly. An example of this is detailed below.

The Case600 model was found to not be tracking correctly with the latest QSS, which uses the Dependencies section to get the dependency graph. Investigation showed that Dependencies does not contain equivalent information to the Derivatives section. For example for the variable roo.conExt[4].opa.T[2]:

Variable
roo.conExt[4].opa.T[2]  #6225
der(roo.conExt[4].opa.T[2]) #6226

the <Derivatives> section has dependencies on three continuous state variables:

<Derivatives>   #6226   All are states:
 #6225  roo.conExt[4].opa.T[2]          (state) (self)
 #6227  roo.conExt[4].opa.T[3]          (state)
 #6247  roo.conExt[4].opa.lay[1].T[2]   (state)

but the <Dependencies> section has dependencies on three non-state variables for which no dependencies are provided:

<Dependencies>  #6226   None are states or have any dependents:
 #6241  roo.conExt[4].opa.lay[1].Q_flow[3]  "Heat flow rates to each state"
 #6305  roo.conExt[4].opa.lay[2].CInv[1]    "Inverse of heat capacity associated with the temperature state"
 #6307  roo.conExt[4].opa.lay[2].Q_flow[2]  "Heat flow rates to each state"

With no dependency graph out of these variables, that presumably leads to the three states shown in <Derivatives>, QSS cannot get the necessary information from <Dependencies>.

The Dependencies behavior described is based on the OCT update version OCT-master-7245bce03ab2ebdfdaaf0805d75209efaa009c67.

Edit: This issue is still present in OCT-master-8bb4688ea939e98a3f23be67236795ab5f2d3ac4 from June 2023.

DeadParrot commented 1 year ago

The BouncingBall model has this conditional block:

  when h < 0 then
    reinit(v, -e*pre(v));
  end when;

For QSS this means that the FMU value of v must be set just before the FMU event handling occurs so v needs a self-dependency. As of OCT 1.43.4 this dependency is missing and must be added before running QSS for accurate results.

Edit: Created a separate issue for this: #31.

Edit: The reinit + pre issue was resolved by OCT-master-8bb4688ea939e98a3f23be67236795ab5f2d3ac4.