Skip to content

Incompatibility between set_scaling_from_default() and generic reaction parameter data #1364

Closed
@jasonmbray

Description

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}".

self.add_component("reaction_" + str(r), Block())

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.

Metadata

Assignees

No one assigned

    Labels

    Priority:LowLow Priority Issue or PR

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions