@@ -290,22 +290,22 @@ additional equations to handle the mass are removed.
290
290
- `kwargs`: are passed to `LineForceWithMass`
291
291
292
292
# Rendering
293
- - `num_windings = 6`
294
- - `color = [0,0,1,1]`
295
- - `radius = 0.1`
296
- - `N = 200`
293
+ - `num_windings = 6`: Number of windings of the coil when rendered
294
+ - `color = [0,0,1,1]`: Color of the spring when rendered
295
+ - `radius = 0.1`: Radius of spring when rendered
296
+ - `N = 200`: Number of points in mesh when rendered. Rendering time can be reduced somewhat by reducing this number.
297
297
298
298
See also [`SpringDamperParallel`](@ref)
299
299
"""
300
300
@component function Spring (; c, name, m = 0 , lengthfraction = 0.5 , s_unstretched = 0 , num_windings= 6 , color= [0 ,0 ,1 ,1 ], radius= 0.1 , N= 200 , kwargs... )
301
301
@named ptf = PartialTwoFrames ()
302
302
@unpack frame_a, frame_b = ptf
303
303
pars = @parameters begin
304
- # c=c, [description = "spring constant", bounds = (0, Inf)]
305
- # s_unstretched=s_unstretched, [
306
- # description = "unstretched length of spring",
307
- # bounds = (0, Inf),
308
- # ] # Bug in MTK where parameters only passed to sub components are ignored
304
+ c= c, [description = " spring constant" , bounds = (0 , Inf )]
305
+ s_unstretched= s_unstretched, [
306
+ description = " unstretched length of spring" ,
307
+ bounds = (0 , Inf ),
308
+ ]
309
309
num_windings = num_windings, [description = " Number of windings of the coil when rendered" ]
310
310
color[1 : 4 ] = color
311
311
radius = radius, [description = " Radius of spring when rendered" ]
@@ -375,16 +375,26 @@ and `D(s)` is the time derivative of `s`.
375
375
# Arguments:
376
376
- `d`: Damping coefficient
377
377
378
+ # Rendering
379
+ - `radius = 0.1`: Radius of damper when rendered
380
+ - `length_fraction = 0.2`: Fraction of the length of the damper that is rendered
381
+ - `color = [0.5, 0.5, 0.5, 1]`: Color of the damper when rendered
382
+
378
383
See also [`SpringDamperParallel`](@ref)
379
384
"""
380
- @component function Damper (; d, name, kwargs... )
385
+ @component function Damper (; d, name, radius = 0.1 , length_fraction = 0.2 , color = [ 0.5 , 0.5 , 0.5 , 1 ], kwargs... )
381
386
@named plf = PartialLineForce (; kwargs... )
382
387
@unpack s, f = plf
383
- @parameters d= d [description = " damping constant" , bounds = (0 , Inf )]
388
+ pars = @parameters begin
389
+ d= d, [description = " damping constant" , bounds = (0 , Inf )]
390
+ radius = radius, [description = " Radius of damper when rendered" ]
391
+ length_fraction = length_fraction, [description = " Fraction of the length of the damper that is rendered" ]
392
+ color[1 : 4 ] = color
393
+ end
384
394
eqs = [
385
395
f ~ d * D (s),
386
396
]
387
- extend (ODESystem (eqs, t; name), plf)
397
+ extend (ODESystem (eqs, t, [s, f], pars ; name), plf)
388
398
end
389
399
390
400
"""
0 commit comments