Skip to content

Commit

Permalink
feat: support label for @mtkmodel symbolic variables
Browse files Browse the repository at this point in the history
  • Loading branch information
ven-k committed Dec 5, 2023
1 parent 2114f99 commit 197c15d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/systems/model_parsing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ function parse_variable_def!(dict, mod, arg, varclass, kwargs;
def = nothing, indices::Union{Vector{UnitRange{Int}}, Nothing} = nothing)
metatypes = [(:connection_type, VariableConnectType),
(:description, VariableDescription),
(:label, VariableLabel),
(:unit, VariableUnit),
(:bounds, VariableBounds),
(:noise, VariableNoiseType),
Expand Down
8 changes: 5 additions & 3 deletions test/model_parsing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,15 @@ end
@testset "Metadata in variables" begin
metadata = Dict(:description => "Variable to test metadata in the Model.structure",
:input => true, :bounds => (-1, 1), :connection_type => :Flow, :integer => true,
:binary => false, :tunable => false, :disturbance => true, :dist => Normal(1, 1))
:binary => false, :tunable => false, :disturbance => true, :dist => Normal(1, 1),
:label => "MockVariable")

@connector MockMeta begin
m(t),
[description = "Variable to test metadata in the Model.structure",
input = true, bounds = (-1, 1), connect = Flow, integer = true,
binary = false, tunable = false, disturbance = true, dist = Normal(1, 1)]
label = "MockVariable", input = true, bounds = (-1, 1), connect = Flow,
integer = true, binary = false, tunable = false, disturbance = true,
dist = Normal(1, 1)]
end

for (k, v) in metadata
Expand Down

0 comments on commit 197c15d

Please sign in to comment.