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

Macro dependencies are not properly solved #449

Open
enekomartinmartinez opened this issue Jul 9, 2024 · 0 comments
Open

Macro dependencies are not properly solved #449

enekomartinmartinez opened this issue Jul 9, 2024 · 0 comments

Comments

@enekomartinmartinez
Copy link
Collaborator

Macro objects have all the parameters as initial and step dependencies. This could lead to some circular initialization error when it shouldn't. For example, model below

:MACRO: MYMACRO(A, B)
 
mymacro = INTEG(A, B) ~~|
 
:END OF MACRO:


my_var = MYMACRO(var1, var2) ~~|

var1 = INITIAL(my_var) ~~|

var2 = 0 ~~|

dependencies for my_var are translated as

@component.add(
    name="my_var",
    comp_type="Auxiliary",
    comp_subtype="Normal",
    depends_on={"_macro_mymacro_my_var": 1},
    other_deps={
        "_macro_mymacro_my_var": {
            "initial": {"var1": 1, "var2": 1},
            "step": {"var1": 1, "var2": 1},
        }
    },
)

which leads to a circular initialization error, when they should be translated as

@component.add(
    name="my_var",
    comp_type="Auxiliary",
    comp_subtype="Normal",
    depends_on={"_macro_mymacro_my_var": 1},
    other_deps={
        "_macro_mymacro_my_var": {
            "initial": {"var2": 1},
            "step": {"var1": 1},
        }
    },
)

This requires building first the macros and resolving the dependencies in the SectionBuilder level, so they can be properly accessed by the macro call builder.

FYI @mak63-dev

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

1 participant