Skip to content

Commit 8a67616

Browse files
Merge pull request SciML#359 from shobhitvoleti/main
Connector name edits for Power and Modulo
2 parents 9c05d69 + 59df239 commit 8a67616

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

src/Blocks/math.jl

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -215,18 +215,18 @@ Output the exponential with base as the first input and exponent as second input
215215
216216
# Connectors:
217217
218-
- `input1`
219-
- `input2`
218+
- `base`
219+
- `exponent`
220220
- `output`
221221
"""
222222
@mtkmodel Power begin
223223
@components begin
224-
input1 = RealInput()
225-
input2 = RealInput() # denominator can not be zero
224+
base = RealInput()
225+
exponent = RealInput()
226226
output = RealOutput()
227227
end
228228
@equations begin
229-
output.u ~ input1.u ^ input2.u
229+
output.u ~ base.u ^ exponent.u
230230
end
231231
end
232232

@@ -237,18 +237,18 @@ Output the remainder when the first input is divided by second input.
237237
238238
# Connectors:
239239
240-
- `input1`
241-
- `input2`
242-
- `output`
240+
- `dividend`
241+
- `divisor`
242+
- `remainder`
243243
"""
244244
@mtkmodel Modulo begin
245245
@components begin
246-
input1 = RealInput()
247-
input2 = RealInput(guess = 1.0) # denominator can not be zero
248-
output = RealOutput()
246+
dividend = RealInput()
247+
divisor = RealInput(guess = 1.0) # denominator can not be zero
248+
remainder = RealOutput()
249249
end
250250
@equations begin
251-
output.u ~ mod(input1.u, input2.u)
251+
remainder.u ~ mod(dividend.u, divisor.u)
252252
end
253253
end
254254

@@ -272,7 +272,6 @@ Output the product of -1 and the input.
272272
end
273273
end
274274

275-
## Rounding functions add after the symbolic functions are registered
276275
"""
277276
Floor(; name)
278277
@@ -313,7 +312,6 @@ Output the ceiling rounding of the input.
313312
end
314313
end
315314

316-
317315
"""
318316
StaticNonLinearity(func; name)
319317

test/Blocks/math.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ end
164164
@named int = Integrator(; k = 1)
165165
@named model = ODESystem(
166166
[
167-
connect(c1.output, pow.input1),
168-
connect(c2.output, pow.input2),
167+
connect(c1.output, pow.base),
168+
connect(c2.output, pow.exponent),
169169
connect(pow.output, int.input)
170170
],
171171
t,
@@ -184,8 +184,8 @@ end
184184
@named modl = Modulo(;)
185185
@named model = ODESystem(
186186
[
187-
connect(c1.output, modl.input1),
188-
connect(c2.output, modl.input2)
187+
connect(c1.output, modl.dividend),
188+
connect(c2.output, modl.divisor)
189189
],
190190
t,
191191
systems = [modl, c1, c2])
@@ -194,7 +194,7 @@ end
194194
sol = solve(prob, Rodas4())
195195
@test isequal(unbound_inputs(sys), [])
196196
@test sol.retcode == Success
197-
@test sol[modl.output.u] mod.(2 * sol.t,1)
197+
@test sol[modl.remainder.u] mod.(2 * sol.t,1)
198198
end
199199

200200
@testset "UnaryMinus" begin

0 commit comments

Comments
 (0)