Skip to content

Commit d33d044

Browse files
committed
Added genparam() function to replace @parameters
Similar for genvar, but with no second argument. ::Symbol comes in, ::Num comes out (as a usable parameter).
1 parent ac993bb commit d33d044

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/transform/utilities.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,13 @@ function genvar(a::Symbol, b::Vector{Symbol})
3838
push!(ex.args, rhs)
3939
eval(ex)
4040
end
41+
function genparam(a::Symbol)
42+
params = Symbol[]
43+
ex = Expr(:block)
44+
var_name, expr = Symbolics.construct_vars(:parameters, a, Real, nothing, nothing, nothing, ModelingToolkit.toparam, false)
45+
push!(params, var_name)
46+
push!(ex.args, expr)
47+
rhs = Symbolics.build_expr(:vect, params)
48+
push!(ex.args, rhs)
49+
eval(ex)
50+
end

0 commit comments

Comments
 (0)