Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ResStockArguments: convert args to double, integer#1269

Merged
joseph-robertson merged 17 commits into
developfrom
res-args-convert-types
Jul 15, 2024
Merged

ResStockArguments: convert args to double, integer#1269
joseph-robertson merged 17 commits into
developfrom
res-args-convert-types

Conversation

@joseph-robertson

@joseph-robertson joseph-robertson commented Jul 11, 2024

Copy link
Copy Markdown
Contributor

Pull Request Description

Avoids a bug that would be introduced by making air_leakage_value optional in NatLabRockies/OpenStudio-HPXML#1760.
Per suggestion by @shorowit, create a method for automatically converting ResStockArguments argument data types based on original argument type.

Checklist

Not all may apply:

@joseph-robertson joseph-robertson added this to the ResStock v3.3.0 milestone Jul 11, 2024
@joseph-robertson joseph-robertson self-assigned this Jul 11, 2024
Comment thread measures/ResStockArguments/measure.rb Outdated
Comment thread measures/ResStockArguments/measure.rb Outdated
@shorowit

Copy link
Copy Markdown
Contributor

Also, would it make sense to go one step further? Just read in all arguments as string, which will significantly simplify the code here and then also handle choice arguments in your new method.

@joseph-robertson

Copy link
Copy Markdown
Contributor Author

Also, would it make sense to go one step further? Just read in all arguments as string, which will significantly simplify the code here and then also handle choice arguments in your new method.

I suspect this would conflict with how we automatically build our RTD based on measure.xml. Thoughts here @afontani?

@joseph-robertson

Copy link
Copy Markdown
Contributor Author

Oh boy; I think this change explodes runtime for ResStockArguments. See the measure-tests CI job...

@joseph-robertson joseph-robertson marked this pull request as ready for review July 12, 2024 14:43
Comment thread measures/ResStockArguments/tests/resstock_arguments_test.rb Outdated
@shorowit

Copy link
Copy Markdown
Contributor

Oh boy; I think this change explodes runtime for ResStockArguments. See the measure-tests CI job...

Seems like you are calling get_measure_instance multiple times on the same measures from different methods. Why not just call it once for each measure and store it as a class instance variable?

@shorowit

shorowit commented Jul 12, 2024

Copy link
Copy Markdown
Contributor

One additional thought. There are places in the measure where we are getting a string from an optional value (e.g., using .to_s here). But doesn't ResStock now require all arguments to be provided? Seems like you could remove the need to use .to_s by changing all of these arguments to be required instead of optional?

In the docs we're generally using Required=false to mean that a choice of auto is available, not that you can leave the argument out of the lookup.

@shorowit

shorowit commented Jul 12, 2024

Copy link
Copy Markdown
Contributor

And why are some of the ResStockArguments arguments optional? Like this one?

EDIT: Maybe they should all be required and use "auto" if they are to be defaulted, so that all arguments are consistent.

@joseph-robertson

joseph-robertson commented Jul 12, 2024

Copy link
Copy Markdown
Contributor Author

Oh boy; I think this change explodes runtime for ResStockArguments. See the measure-tests CI job...

Seems like you are calling get_measure_instance multiple times on the same measures from different methods. Why not just call it once for each measure and store it as a class instance variable?

You mean introduce a new initialize method to the ResStockArguments class? Edit: seems like I can just use the arguments method.

@joseph-robertson

Copy link
Copy Markdown
Contributor Author

And why are some of the ResStockArguments arguments optional? Like this one?

EDIT: Maybe they should all be required and use "auto" if they are to be defaulted, so that all arguments are consistent.

That one is optional because it's not required for SFD. When MF, it's sampled as either Bottom, Middle, or Top.

…tock into res-args-convert-types

# Conflicts:
#	measures/ResStockArguments/measure.xml

@shorowit shorowit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks good to me (assuming the CI is happy with my last commit). Though I do have a couple minor comments.

Comment thread docs/read_the_docs/source/changelog/changelog_dev.rst Outdated
Comment thread docs/read_the_docs/source/workflow_inputs/characteristics.rst
@joseph-robertson joseph-robertson merged commit fb7dc3f into develop Jul 15, 2024
@joseph-robertson joseph-robertson deleted the res-args-convert-types branch July 15, 2024 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants