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

Add support for parameters, equations... for @connectors #2246

Merged
merged 2 commits into from
Aug 31, 2023

Conversation

ven-k
Copy link
Member

@ven-k ven-k commented Aug 31, 2023

  • @connector now supports @parameters, @equations, @extend, @variables, @components and a begin...end block along with variables specified without a begin block.
  • This is useful for connectors like HydraulicFluid1
  • Replaces internal functions connect_macro and mtkmodel_macro with _model_macro, which handles both based on the isconnector flag
  • Adds "Connector with parameters, equations..." for testing the enhancement.

Footnotes

  1. https://github.com/SciML/ModelingToolkitStandardLibrary.jl/blob/main/src/Hydraulic/IsothermalCompressible/utils.jl#L53-L75

`@variables`, `@components` and a `begin...end` block along with
variables specified without a begin block
@YingboMa YingboMa merged commit bc0033a into SciML:master Aug 31, 2023
29 of 33 checks passed
@ven-k
Copy link
Member Author

ven-k commented Sep 1, 2023

Additionally, generated function <Model>.f will have an identifiable name __<Model>__. This will make it easier to identify the components in the stack trace.

julia> @mtkmodel A begin
       end
ModelingToolkit.Model{typeof(__A__), Dict{Symbol, Any}}(__A__, Dict{Symbol, Any}(:kwargs => Dict{Symbol, Any}(), :independent_variable => t), false)

julia> A.f
__A__ (generic function with 1 method)

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

Successfully merging this pull request may close these issues.

2 participants