1
- @connector function RealInput (; name, nin = 1 , u_start = nin > 1 ? zeros (nin) : 0.0 )
1
+ @connector function RealInput (;
2
+ name, nin = 1 , u_start = nothing , guess = nin > 1 ? zeros (nin) : 0.0 )
2
3
nin > 1 && @warn " For inputs greater than one, use `RealInputArray`."
4
+ if u_start != = nothing
5
+ Base. depwarn (
6
+ " The keyword argument `u_start` is deprecated. Use `guess` instead." , :u_start )
7
+ guess = u_start
8
+ end
3
9
if nin == 1
4
10
@variables u (t) [
5
11
input = true ,
10
16
input = true ,
11
17
description = " Inner variable in RealInput $name "
12
18
]
13
- u = collect (u)
14
19
end
15
- ODESystem (Equation[], t, [u... ], []; name = name, guesses = [u => u_start ])
20
+ ODESystem (Equation[], t, [u], []; name = name, guesses = [u => guess ])
16
21
end
17
22
@doc """
18
- RealInput(;name, u_start )
23
+ RealInput(;name, guess )
19
24
20
25
Connector with one input signal of type Real.
21
26
22
27
# Parameters:
23
- - `u_start =0`: Guess value for `u`.
28
+ - `guess =0`: Guess value for `u`.
24
29
25
30
# States:
26
31
- `u`: Value of the connector which is a scalar.
27
32
""" RealInput
28
33
29
- @connector function RealInputArray (; name, nin, u_start = zeros (nin))
34
+ @connector function RealInputArray (; name, nin, u_start = nothing , guess = zeros (nin))
35
+ if u_start != = nothing
36
+ Base. depwarn (
37
+ " The keyword argument `u_start` is deprecated. Use `guess` instead." , :u_start )
38
+ guess = u_start
39
+ end
30
40
@variables u (t)[1 : nin] [
31
41
input = true ,
32
42
description = " Inner variable in RealInputArray $name "
33
43
]
34
- u = collect (u)
35
- ODESystem (Equation[], t, [u... ], []; name = name, guesses = [u => u_start])
44
+ ODESystem (Equation[], t, [u], []; name = name, guesses = [u => guess])
36
45
end
37
46
@doc """
38
- RealInputArray(;name, nin, u_start )
47
+ RealInputArray(;name, nin, guess )
39
48
40
49
Connector with an array of input signals of type Real.
41
50
42
51
# Parameters:
43
52
- `nin`: Number of inputs.
44
- - `u_start =zeros(nin)`: Guess value for `u`.
53
+ - `guess =zeros(nin)`: Guess value for `u`.
45
54
46
55
# States:
47
56
- `u`: Value of the connector which is an array.
48
57
""" RealInputArray
49
58
50
- @connector function RealOutput (; name, nout = 1 , u_start = nout > 1 ? zeros (nout) : 0.0 )
59
+ @connector function RealOutput (;
60
+ name, nout = 1 , u_start = nothing , guess = nout > 1 ? zeros (nout) : 0.0 )
51
61
nout > 1 && @warn " For outputs greater than one, use `RealOutputArray`."
62
+ if u_start != = nothing
63
+ Base. depwarn (
64
+ " The keyword argument `u_start` is deprecated. Use `guess` instead." , :u_start )
65
+ guess = u_start
66
+ end
52
67
if nout == 1
53
68
@variables u (t) [
54
69
output = true ,
@@ -59,38 +74,41 @@ Connector with an array of input signals of type Real.
59
74
output = true ,
60
75
description = " Inner variable in RealOutput $name "
61
76
]
62
- u = collect (u)
63
77
end
64
- ODESystem (Equation[], t, [u... ], []; name = name, guesses = [u => u_start ])
78
+ ODESystem (Equation[], t, [u], []; name = name, guesses = [u => guess ])
65
79
end
66
80
@doc """
67
- RealOutput(;name, u_start )
81
+ RealOutput(;name, guess )
68
82
69
83
Connector with one output signal of type Real.
70
84
71
85
# Parameters:
72
- - `u_start =0`: Guess value for `u`.
86
+ - `guess =0`: Guess value for `u`.
73
87
74
88
# States:
75
89
- `u`: Value of the connector which is a scalar.
76
90
""" RealOutput
77
91
78
- @connector function RealOutputArray (; name, nout, u_start = zeros (nout))
92
+ @connector function RealOutputArray (; name, nout, u_start = nothing , guess = zeros (nout))
93
+ if u_start != = nothing
94
+ Base. depwarn (
95
+ " The keyword argument `u_start` is deprecated. Use `guess` instead." , :u_start )
96
+ guess = u_start
97
+ end
79
98
@variables u (t)[1 : nout] [
80
99
output = true ,
81
100
description = " Inner variable in RealOutputArray $name "
82
101
]
83
- u = collect (u)
84
- ODESystem (Equation[], t, [u... ], []; name = name, guesses = [u => u_start])
102
+ ODESystem (Equation[], t, [u], []; name = name, guesses = [u => guess])
85
103
end
86
104
@doc """
87
- RealOutputArray(;name, nout, u_start )
105
+ RealOutputArray(;name, nout, guess )
88
106
89
107
Connector with an array of output signals of type Real.
90
108
91
109
# Parameters:
92
110
- `nout`: Number of outputs.
93
- - `u_start =zeros(nout)`: Guess value for `u`.
111
+ - `guess =zeros(nout)`: Guess value for `u`.
94
112
95
113
# States:
96
114
- `u`: Value of the connector which is an array.
@@ -116,8 +134,8 @@ Single input single output (SISO) continuous system block.
116
134
y (t) = y_start, [description = " Output of SISO system" ]
117
135
end
118
136
@components begin
119
- input = RealInput (u_start = u_start)
120
- output = RealOutput (u_start = y_start)
137
+ input = RealInput (guess = u_start)
138
+ output = RealOutput (guess = y_start)
121
139
end
122
140
@equations begin
123
141
u ~ input. u
@@ -139,8 +157,8 @@ Base class for a multiple input multiple output (MIMO) continuous system block.
139
157
"""
140
158
@component function MIMO (; name, nin = 1 , nout = 1 , u_start = zeros (nin),
141
159
y_start = zeros (nout))
142
- @named input = RealInput (nin = nin, u_start = u_start)
143
- @named output = RealOutput (nout = nout, u_start = y_start)
160
+ @named input = RealInput (nin = nin, guess = u_start)
161
+ @named output = RealOutput (nout = nout, guess = y_start)
144
162
@variables (u (t)[1 : nin]= u_start, [description = " Input of MIMO system $name " ],
145
163
y (t)[1 : nout]= y_start, [description = " Output of MIMO system $name " ],)
146
164
eqs = [
0 commit comments