From 197c15d32958e8787fbd082e5fde74184a9f6686 Mon Sep 17 00:00:00 2001 From: Venkateshprasad <32921645+ven-k@users.noreply.github.com> Date: Tue, 5 Dec 2023 12:57:26 +0530 Subject: [PATCH] feat: support `label` for `@mtkmodel` symbolic variables --- src/systems/model_parsing.jl | 1 + test/model_parsing.jl | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/systems/model_parsing.jl b/src/systems/model_parsing.jl index 8426967827..f2f61ac1b1 100644 --- a/src/systems/model_parsing.jl +++ b/src/systems/model_parsing.jl @@ -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), diff --git a/test/model_parsing.jl b/test/model_parsing.jl index fa036e7350..bea07c9f73 100644 --- a/test/model_parsing.jl +++ b/test/model_parsing.jl @@ -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