idaes-pse icon indicating copy to clipboard operation
idaes-pse copied to clipboard

Incompatibility between `set_scaling_from_default()` and generic reaction parameter data

Open jasonmbray opened this issue 11 months ago • 1 comments

While experimenting with using the set_scaling_from_default() method to add scaling to a model that includes a reactor, I observed the following AttributeError:

AttributeError: 'ScalarBlock' object has no attribute 'get_default_scaling'

I ran set_scaling_from_default on my entire model, so it descended into every block in turn. Tracing the error back to its source, it appears that the problem is in how the GenericReactionParameterData class instantiates the individual reaction blocks, named "reaction_{idx}". https://github.com/IDAES/idaes-pse/blob/eea1209077b75f7d940d8958362e69d4650c079d/idaes/models/properties/modular_properties/base/generic_reaction.py#L336

These reaction blocks are created as generic Pyomo Block objects, which does not have the get_default_scaling method defined. Instead, they should be created as ProcessBaseBlock objects, or something derived from that.

Looks like an easy 3-line fix: 2 lines to update the imports and 1 line to change the pyomo Block to an idaes ProcessBaseBlock. Happy to submit a PR if needed.

jasonmbray avatar Mar 04 '24 22:03 jasonmbray