Skip to content

Commit b09f1e6

Browse files
committed
add unary minus to math.jl
1 parent 492ec48 commit b09f1e6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/Blocks/math.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,26 @@ Output the remainder when the first input is divided by second input.
252252
end
253253
end
254254

255+
"""
256+
UnaryMinus(; name)
257+
258+
Output the product of -1 and the input.
259+
260+
# Connectors:
261+
262+
- `input`
263+
- `output`
264+
"""
265+
@mtkmodel UnaryMinus begin
266+
@components begin
267+
input = RealInput()
268+
output = RealOutput()
269+
end
270+
@equations begin
271+
output.u ~ -(input.u)
272+
end
273+
end
274+
255275
## Rounding functions add after the symbolic functions are registered
256276
# """
257277
# Floor(; name)

0 commit comments

Comments
 (0)