@@ -237,15 +237,15 @@ Generate ramp signal.
237
237
- `output`
238
238
"""
239
239
@component function Ramp (; name,
240
- height = 1 ,
241
- duration = 1 ,
242
- offset = 0 ,
243
- start_time = 0 ,
240
+ height = 1.0 ,
241
+ duration = 1.0 ,
242
+ offset = 0.0 ,
243
+ start_time = 0.0 ,
244
244
smooth = false )
245
245
@named output = RealOutput ()
246
246
pars = @parameters offset= offset start_time= start_time height= height duration= duration
247
247
equation = if smooth == false
248
- offset + ifelse (t < start_time, 0 ,
248
+ offset + ifelse (t < start_time, zero (height) ,
249
249
ifelse (t < (start_time + duration), (t - start_time) * height / duration,
250
250
height))
251
251
else
@@ -320,20 +320,20 @@ Generate step signal.
320
320
321
321
- `output`
322
322
"""
323
- @component function Step (; name, height = 1 , offset = 0 , start_time = 0 , duration = Inf ,
323
+ @component function Step (; name, height = 1.0 , offset = 0.0 , start_time = 0. 0 , duration = Inf ,
324
324
smooth = 1e-5 )
325
325
@named output = RealOutput ()
326
326
duration_numeric = duration
327
327
pars = @parameters offset= offset start_time= start_time height= height duration= duration
328
328
equation = if smooth == false # use comparison in case smooth is a float
329
- offset + ifelse ((start_time < t) & (t < start_time + duration), height, 0 )
329
+ offset + ifelse ((start_time < t) & (t < start_time + duration), height, zero (height) )
330
330
else
331
331
smooth === true && (smooth = 1e-5 )
332
332
if duration_numeric == Inf
333
333
smooth_step (t, smooth, height, offset, start_time)
334
334
else
335
335
smooth_step (t, smooth, height, offset, start_time) -
336
- smooth_step (t, smooth, height, 0 , start_time + duration)
336
+ smooth_step (t, smooth, height, zero (start_time) , start_time + duration)
337
337
end
338
338
end
339
339
@@ -366,17 +366,17 @@ Exponentially damped sine signal.
366
366
"""
367
367
@component function ExpSine (; name,
368
368
frequency,
369
- amplitude = 1 ,
369
+ amplitude = 1.0 ,
370
370
damping = 0.1 ,
371
- phase = 0 ,
372
- offset = 0 ,
373
- start_time = 0 ,
371
+ phase = 0.0 ,
372
+ offset = 0.0 ,
373
+ start_time = 0.0 ,
374
374
smooth = false )
375
375
@named output = RealOutput ()
376
376
pars = @parameters offset= offset start_time= start_time amplitude= amplitude frequency= frequency phase= phase damping= damping
377
377
378
378
equation = if smooth == false
379
- offset + ifelse (t < start_time, 0 ,
379
+ offset + ifelse (t < start_time, zero (amplitude) ,
380
380
amplitude * exp (- damping * (t - start_time)) *
381
381
sin (2 * pi * frequency * (t - start_time) + phase))
382
382
else
0 commit comments