Skip to content

Commit bfa4872

Browse files
committed
Add Power block to math.jl and update docs
1 parent 84e1c2c commit bfa4872

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

docs/src/API/blocks.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ Add
3636
Add3
3737
Product
3838
Division
39+
Power
40+
Modulo
3941
StaticNonLinearity
4042
Abs
4143
Sign

src/Blocks/math.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,28 @@ Output first input divided by second input.
208208
end
209209
end
210210

211+
"""
212+
Power(; name)
213+
214+
Output the exponential with base as the first input and exponent as second input i.e u1^u2
215+
216+
# Connectors:
217+
218+
- `input1`
219+
- `input2`
220+
- `output`
221+
"""
222+
@mtkmodel Power begin
223+
@components begin
224+
input1 = RealInput()
225+
input2 = RealInput() # denominator can not be zero
226+
output = RealOutput()
227+
end
228+
@equations begin
229+
output.u ~ input1.u ^ input2.u
230+
end
231+
end
232+
211233
"""
212234
Modulo(; name)
213235

0 commit comments

Comments
 (0)