1
- @connector function RealInput (;
2
- name, nin = 1 , isarray = false , u_start = isarray ? zeros (nin) : 0.0 )
3
- if nin == 1 && ! isarray
1
+ @connector function RealInput (; name, nin = 1 , u_start = nin > 1 ? zeros (nin) : 0.0 )
2
+ nin > 1 && @warn " For inputs greater than one, use `RealInputArray`. "
3
+ if nin == 1
4
4
@variables u (t)= u_start [
5
5
input = true ,
6
6
description = " Inner variable in RealInput $name "
15
15
ODESystem (Equation[], t, [u... ], []; name = name)
16
16
end
17
17
@doc """
18
- RealInput(;name, nin, u_start)
18
+ RealInput(;name, u_start)
19
19
20
20
Connector with one input signal of type Real.
21
21
22
22
# Parameters:
23
- - `nin=1`: Number of inputs
24
- - `u_start=0`: Initial value for `u`
25
- - `isarray=false`: This is only applicable for `nin=1`. Boolean flag to use a scalar or a one element symbolic vector
23
+ - `u_start=0`: Initial value for `u`.
26
24
27
25
# States:
28
- - `u`: Value of the connector; if nin=1 this is a scalar
26
+ - `u`: Value of the connector which is a scalar.
29
27
""" RealInput
30
28
31
- @connector function RealOutput (;
32
- name, nout = 1 , isarray = false , u_start = isarray ? zeros (nout) : 0.0 )
33
- if nout == 1 && ! isarray
29
+ @connector function RealInputArray (; name, nin = 2 , u_start = zeros (nin))
30
+ @variables u (t)[1 : nin]= u_start [
31
+ input = true ,
32
+ description = " Inner variable in RealInputArray $name "
33
+ ]
34
+ u = collect (u)
35
+ ODESystem (Equation[], t, [u... ], []; name = name)
36
+ end
37
+ @doc """
38
+ RealInputArray(;name, nin, u_start)
39
+
40
+ Connector with an array of input signals of type Real.
41
+
42
+ # Parameters:
43
+ - `nin=2`: Number of inputs.
44
+ - `u_start=zeros(nin)`: Initial value for `u`.
45
+
46
+ # States:
47
+ - `u`: Value of the connector which is an array.
48
+ """ RealInputArray
49
+
50
+ @connector function RealOutput (; name, nout = 1 , u_start = nout > 1 ? zeros (nout) : 0.0 )
51
+ nout > 1 && @warn " For outputs greater than one, use `RealOutputArray`."
52
+ if nout == 1
34
53
@variables u (t)= u_start [
35
54
output = true ,
36
55
description = " Inner variable in RealOutput $name "
@@ -45,19 +64,38 @@ Connector with one input signal of type Real.
45
64
ODESystem (Equation[], t, [u... ], []; name = name)
46
65
end
47
66
@doc """
48
- RealOutput(;name, nout, u_start)
67
+ RealOutput(;name, u_start)
49
68
50
69
Connector with one output signal of type Real.
51
70
52
71
# Parameters:
53
- - `nout=1`: Number of outputs
54
- - `u_start=0`: Initial value for `u`
55
- - `isarray=false`: This is only applicable for `nout=1`. Boolean flag to use a scalar or a one element symbolic vector
72
+ - `u_start=0`: Initial value for `u`.
56
73
57
74
# States:
58
- - `u`: Value of the connector; if nout=1 this is a scalar
75
+ - `u`: Value of the connector which is a scalar.
59
76
""" RealOutput
60
77
78
+ @connector function RealOutputArray (; name, nout = 2 , u_start = zeros (nout))
79
+ @variables u (t)[1 : nout]= u_start [
80
+ output = true ,
81
+ description = " Inner variable in RealOutput $name "
82
+ ]
83
+ u = collect (u)
84
+ ODESystem (Equation[], t, [u... ], []; name = name)
85
+ end
86
+ @doc """
87
+ RealOutputArray(;name, nout, u_start)
88
+
89
+ Connector with an array of output signals of type Real.
90
+
91
+ # Parameters:
92
+ - `nout=2`: Number of outputs.
93
+ - `u_start=zeros(nout)`: Initial value for `u`.
94
+
95
+ # States:
96
+ - `u`: Value of the connector which is an array.
97
+ """ RealOutputArray
98
+
61
99
"""
62
100
SISO(;name, u_start = 0.0, y_start = 0.0)
63
101
0 commit comments