@@ -99,26 +99,25 @@ function define_vars(u::NamedTuple, t)
99
99
NamedTuple (x => _defvar (x)(ModelingToolkit. value (t)) for x in keys (u))
100
100
end
101
101
102
- const PARAMETERS_NOT_SUPPORTED_MESSAGE =
103
- """
104
- The chosen parameter type is currently not supported by `modelingtoolkitize`. The
105
- current supported types are:
106
-
107
- - AbstractArrays
108
- - AbstractDicts
109
- - LabelledArrays (SLArray, LArray)
110
- - Flat tuples (tuples of numbers)
111
- - Flat named tuples (namedtuples of numbers)
112
- """
113
-
114
- struct ModelingtoolkitizeParametersNotSupportedError <: Exception
102
+ const PARAMETERS_NOT_SUPPORTED_MESSAGE = """
103
+ The chosen parameter type is currently not supported by `modelingtoolkitize`. The
104
+ current supported types are:
105
+
106
+ - AbstractArrays
107
+ - AbstractDicts
108
+ - LabelledArrays (SLArray, LArray)
109
+ - Flat tuples (tuples of numbers)
110
+ - Flat named tuples (namedtuples of numbers)
111
+ """
112
+
113
+ struct ModelingtoolkitizeParametersNotSupportedError <: Exception
115
114
type:: Any
116
115
end
117
116
118
117
function Base. showerror (io:: IO , e:: ModelingtoolkitizeParametersNotSupportedError )
119
118
println (io, PARAMETERS_NOT_SUPPORTED_MESSAGE)
120
119
print (io, " Parameter type: " )
121
- println (io,e. type)
120
+ println (io, e. type)
122
121
end
123
122
124
123
function define_params (p)
@@ -129,6 +128,10 @@ function define_params(p::AbstractArray)
129
128
[toparam (variable (:α , i)) for i in eachindex (p)]
130
129
end
131
130
131
+ function define_params (p:: Number )
132
+ [:α ]
133
+ end
134
+
132
135
function define_params (p:: AbstractDict )
133
136
OrderedDict (k => toparam (variable (:α , i)) for (i, k) in zip (1 : length (p), keys (p)))
134
137
end
0 commit comments