ModelingToolkit.jl icon indicating copy to clipboard operation
ModelingToolkit.jl copied to clipboard

Improve handling of expression in metadata

Open ven-k opened this issue 1 year ago • 1 comments

Instead of evaluating expression while defining the model, keep it as is and execute while creating an instance of it.

This now works:

@mtkmodel Model begin
    @parameters begin
        ρ₀
        p′
        β
    end
    @variables begin
        r(t), [guess = ρ₀*(1 + p′/β)]
    end
end

Checklist

  • [x] Appropriate tests were added
  • [x] Any code changes were done in a way that does not break public API
  • [x] All documentation related to code changes were updated
  • [x] The new code follows the contributor guidelines, in particular the SciML Style Guide and COLPRAC.
  • [x] Any new documentation only uses public API

ven-k avatar Feb 27 '24 19:02 ven-k

New tests are added to "Model Parsing" and they pass here.

Test failures are unrelated to this PR.

Documentation had passed for the first commit here. The current failure is CI related and not this PR.

ven-k avatar Apr 25 '24 13:04 ven-k

This PR is ready for review.

ven-k avatar Apr 29 '24 07:04 ven-k