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

ConfigurationError for ControlVolumes regarding time units #1464

Open
adam-a-a opened this issue Aug 7, 2024 · 3 comments
Open

ConfigurationError for ControlVolumes regarding time units #1464

adam-a-a opened this issue Aug 7, 2024 · 3 comments
Assignees
Labels
bug Something isn't working Priority:Normal Normal Priority Issue or PR WaterTAP

Comments

@adam-a-a
Copy link
Contributor

adam-a-a commented Aug 7, 2024

It appears that the following configuration error in ControlVolume0D (and similarly for 1D) will not be called when time_units is set to None while instantiating a Flowsheet:

if self.config.dynamic:
    f_time_units = self.flowsheet().time_units
    if (f_time_units is None) ^ (units("time") is None):
        raise ConfigurationError(
            "{} incompatible time unit specification between "
            "flowsheet and property package. Either both must use "
            "units, or neither.".format(self.name)
        )

Instead, the ConfigurationError from FlowsheetBlockData will be raised:

elif self.config.time_units is None and self.config.dynamic:
    raise ConfigurationError(
        f"{self.name} - no units were specified for the time domain. "
        f"Units must be be specified for dynamic models."

So it seems the first ConfigurationError that I mentioned will only be raised if time_units are set appropriately and no units are specified for the property model. Notably, there seems to be no testing to ensure the config error occurs.

Additionally, there is no safeguard in the case where the user might provide dimensionless units for the flowsheet and units for the property model. For example, setting time_units to dimensionless for the Flowsheet while using units in the property package will result in a InconsistentUnitsError for material_balances:
InconsistentUnitsError: Error in convert: units not compatible.: mole not compatible with mole / second.

@adam-a-a adam-a-a added bug Something isn't working Priority:Normal Normal Priority Issue or PR labels Aug 7, 2024
@adam-a-a
Copy link
Contributor Author

adam-a-a commented Aug 7, 2024

For clarity, this is something that I can fix, but it is not at the top of my list of things to do yet. So I am posting this issue here for awareness and in case someone else has time to address it before I can (or in case the team votes that it is low enough priority not to pursue).

@ksbeattie
Copy link
Member

Moving this to Nov. @adam-a-a is this something you think you'll get to by then?

@ksbeattie
Copy link
Member

@adam-a-a, says this is mostly just a notice/reminder for the idaes dev team. It's a low priority for him, if someone on the idaes teams wants to tackle this go for it, otherwise he won't get to this by Nov.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Priority:Normal Normal Priority Issue or PR WaterTAP
Projects
None yet
Development

No branches or pull requests

3 participants