diff --git a/src/Blocks/math.jl b/src/Blocks/math.jl index 45e0c8203..a787a9f43 100644 --- a/src/Blocks/math.jl +++ b/src/Blocks/math.jl @@ -215,18 +215,18 @@ Output the exponential with base as the first input and exponent as second input # Connectors: - - `input1` - - `input2` + - `base` + - `exponent` - `output` """ @mtkmodel Power begin @components begin - input1 = RealInput() - input2 = RealInput() # denominator can not be zero + base = RealInput() + exponent = RealInput() output = RealOutput() end @equations begin - output.u ~ input1.u ^ input2.u + output.u ~ base.u ^ exponent.u end end @@ -237,18 +237,18 @@ Output the remainder when the first input is divided by second input. # Connectors: - - `input1` - - `input2` - - `output` + - `dividend` + - `divisor` + - `remainder` """ @mtkmodel Modulo begin @components begin - input1 = RealInput() - input2 = RealInput(guess = 1.0) # denominator can not be zero - output = RealOutput() + dividend = RealInput() + divisor = RealInput(guess = 1.0) # denominator can not be zero + remainder = RealOutput() end @equations begin - output.u ~ mod(input1.u, input2.u) + remainder.u ~ mod(dividend.u, divisor.u) end end @@ -272,7 +272,6 @@ Output the product of -1 and the input. end end -## Rounding functions add after the symbolic functions are registered """ Floor(; name) @@ -313,7 +312,6 @@ Output the ceiling rounding of the input. end end - """ StaticNonLinearity(func; name) diff --git a/test/Blocks/math.jl b/test/Blocks/math.jl index 5812ccf3d..5ee902604 100644 --- a/test/Blocks/math.jl +++ b/test/Blocks/math.jl @@ -164,8 +164,8 @@ end @named int = Integrator(; k = 1) @named model = ODESystem( [ - connect(c1.output, pow.input1), - connect(c2.output, pow.input2), + connect(c1.output, pow.base), + connect(c2.output, pow.exponent), connect(pow.output, int.input) ], t, @@ -184,8 +184,8 @@ end @named modl = Modulo(;) @named model = ODESystem( [ - connect(c1.output, modl.input1), - connect(c2.output, modl.input2) + connect(c1.output, modl.dividend), + connect(c2.output, modl.divisor) ], t, systems = [modl, c1, c2]) @@ -194,7 +194,7 @@ end sol = solve(prob, Rodas4()) @test isequal(unbound_inputs(sys), []) @test sol.retcode == Success - @test sol[modl.output.u] ≈ mod.(2 * sol.t,1) + @test sol[modl.remainder.u] ≈ mod.(2 * sol.t,1) end @testset "UnaryMinus" begin