Skip to content

Commit 98471b6

Browse files
committed
docs: use symbolic array with arbitray length in ModelC example
1 parent 6cb3a28 commit 98471b6

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

docs/src/basics/MTKLanguage.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,14 @@ end
6363
@structural_parameters begin
6464
f = sin
6565
N = 2
66+
M = 3
6667
end
6768
begin
6869
v_var = 1.0
6970
end
7071
@variables begin
7172
v(t) = v_var
72-
v_array(t)[1:2, 1:3]
73+
v_array(t)[1:N, 1:M]
7374
v_for_defaults(t)
7475
end
7576
@extend ModelB(; p1)
@@ -310,10 +311,10 @@ end
310311
- `:defaults`: Dictionary of variables and default values specified in the `@defaults`.
311312
- `:extend`: The list of extended unknowns, name given to the base system, and name of the base system.
312313
- `:structural_parameters`: Dictionary of structural parameters mapped to their metadata.
313-
- `:parameters`: Dictionary of symbolic parameters mapped to their metadata. For
314-
parameter arrays, length is added to the metadata as `:size`.
315-
- `:variables`: Dictionary of symbolic variables mapped to their metadata. For
316-
variable arrays, length is added to the metadata as `:size`.
314+
- `:parameters`: Dictionary of symbolic parameters mapped to their metadata. Metadata of
315+
the parameter arrays is, for now, omitted.
316+
- `:variables`: Dictionary of symbolic variables mapped to their metadata. Metadata of
317+
the variable arrays is, for now, omitted.
317318
- `:kwargs`: Dictionary of keyword arguments mapped to their metadata.
318319
- `:independent_variable`: Independent variable, which is added while generating the Model.
319320
- `:equations`: List of equations (represented as strings).
@@ -324,10 +325,10 @@ For example, the structure of `ModelC` is:
324325
julia> ModelC.structure
325326
Dict{Symbol, Any} with 10 entries:
326327
:components => Any[Union{Expr, Symbol}[:model_a, :ModelA], Union{Expr, Symbol}[:model_array_a, :ModelA, :(1:N)], Union{Expr, Symbol}[:model_array_b, :ModelA, :(1:N)]]
327-
:variables => Dict{Symbol, Dict{Symbol, Any}}(:v=>Dict(:default=>:v_var, :type=>Real), :v_array=>Dict(:type=>Real, :size=>(2, 3)), :v_for_defaults=>Dict(:type=>Real))
328+
:variables => Dict{Symbol, Dict{Symbol, Any}}(:v=>Dict(:default=>:v_var, :type=>Real), :v_for_defaults=>Dict(:type=>Real))
328329
:icon => URI("https://github.com/SciML/SciMLDocs/blob/main/docs/src/assets/logo.png")
329-
:kwargs => Dict{Symbol, Dict}(:f=>Dict(:value=>:sin), :N=>Dict(:value=>2), :v=>Dict{Symbol, Any}(:value=>:v_var, :type=>Real), :v_array=>Dict{Symbol, Union{Nothing, UnionAll}}(:value=>nothing, :type=>AbstractArray{Real}), :v_for_defaults=>Dict{Symbol, Union{Nothing, DataType}}(:value=>nothing, :type=>Real), :p1=>Dict(:value=>nothing))
330-
:structural_parameters => Dict{Symbol, Dict}(:f=>Dict(:value=>:sin), :N=>Dict(:value=>2))
330+
:kwargs => Dict{Symbol, Dict}(:f => Dict(:value => :sin), :N => Dict(:value => 2), :M => Dict(:value => 3), :v => Dict{Symbol, Any}(:value => :v_var, :type => Real), :v_for_defaults => Dict{Symbol, Union{Nothing, DataType}}(:value => nothing, :type => Real), :p1 => Dict(:value => nothing)),
331+
:structural_parameters => Dict{Symbol, Dict}(:f => Dict(:value => :sin), :N => Dict(:value => 2), :M => Dict(:value => 3))
331332
:independent_variable => t
332333
:constants => Dict{Symbol, Dict}(:c=>Dict{Symbol, Any}(:value=>1, :type=>Int64, :description=>"Example constant."))
333334
:extend => Any[[:p2, :p1], Symbol("#mtkmodel__anonymous__ModelB"), :ModelB]

0 commit comments

Comments
 (0)