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

error while defining variables with units and expression #98

Open
CorOscar opened this issue May 17, 2021 · 1 comment
Open

error while defining variables with units and expression #98

CorOscar opened this issue May 17, 2021 · 1 comment

Comments

@CorOscar
Copy link

Hello,
When defining a variable from class BaseVariable with an expression, there is a conflict between the assigned units and the derived one from the expression. See the screenshot attached.
Regards,
Oscar
error_essm

@schymans
Copy link
Collaborator

Thanks for reporting, @CorOscar. I admit that the error message is a bit useless here, we need to clear this up. But your example is a bit convoluted, so I am not sure how to find the underlying problem. We have never envisaged the definition of internal variables within the definition of variables, that was only meant for the definition of equations. The idea of internal variables was to avoid the use of e.g. 1.01 in an expression, as you still do in iv_T above. I would first define T, T_kv and iv_T as variables and then an equation:

class eq_Tkv(Equation):
    """Empirical equation"""
    class c1(Variable):
        """Internal variable""""
        default = 1.01
    expr = Eq(T_kv, c1 * (T + iv_T))

If you still have a problem with this, could you provide a link to your code or a complete code snippet that I could copy and paste to check what is wrong?

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

No branches or pull requests

2 participants