Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force ascending order of independant variables in Table:IndendependentVariable #4976

Open
jmarrec opened this issue Sep 20, 2023 · 1 comment

Comments

@jmarrec
Copy link
Collaborator

jmarrec commented Sep 20, 2023

Issue overview

I had noted it here as a question: #4652 (comment)

Current Behavior

We get a bunch of errors on the SDD ReverseTranslator tests of openstudio-resources due to this

   ** Severe  ** Table:IndependentVariable \"{172A710A-926C-44EC-9AC3-1E694B8332A0}\": axis is not sorted.",
   **  Fatal  ** Btwxt: Errors discovered, program terminates.

Expected Behavior

Worked as 3.4.0, stopped working at 3.5.0 when we moved from Table:MultiVariableLookup

https://github.com/NREL/OpenStudio-resources/blob/46a3246cd12026af71fc7db11d990697bf002b9b/test/010112_SchSml_PSZ16.xml_3.4.0_out.osw#L2

https://github.com/NREL/OpenStudio-resources/blob/46a3246cd12026af71fc7db11d990697bf002b9b/test/010112_SchSml_PSZ16.xml_3.5.0_out.osw#L1-L7

Steps to Reproduce

make a non sorted one. try to run in E+.

Possible Solution

Force ascending order. Determine if should be done in Model or at ForwardTranslation time.

Details

Environment

Some additional details about your environment for this issue (if relevant):

  • Platform (Operating system, version): all
  • Version of OpenStudio (if using an intermediate build, include SHA): 3.5.0+

Context

Noticed this today when I ran the OpenStudio-resources testing with 3.6.1 official.

@jmarrec
Copy link
Collaborator Author

jmarrec commented Sep 20, 2023

The API for this object is really bad, having to add the independent variables first, then the output values.
And figuring out how to set the TableLookup outputValues if you have more than one independent variable... cf https://github.com/NREL/OpenStudio-resources/blob/46a3246cd12026af71fc7db11d990697bf002b9b/model/simulationtests/tablelookup.rb#L40-L71

We should probably provide some kind of TableLookup::fromTable that could take an array of [X1, ..., Xn, Y] doubles or something. In there it'd be easy to check for ascending order and fix it automagically if not

Quick "fix"

The quick way to address this issue is to have the TableIndependentVariable::setValues throw a loud Warn and return false if the passed values aren't sorted. We can't automatically "fix" the order since the independent variables and dependent output values aren't passed in tandem.

SDD ReverseTranslator

Probably need some work in the SDD ReverseTranslator to sort the values taken from the xml.

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

No branches or pull requests

1 participant