@@ -290,22 +290,22 @@ additional equations to handle the mass are removed.
290290- `kwargs`: are passed to `LineForceWithMass`
291291
292292# 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.
297297
298298See also [`SpringDamperParallel`](@ref)
299299"""
300300@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... )
301301 @named ptf = PartialTwoFrames ()
302302 @unpack frame_a, frame_b = ptf
303303 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+ ]
309309 num_windings = num_windings, [description = " Number of windings of the coil when rendered" ]
310310 color[1 : 4 ] = color
311311 radius = radius, [description = " Radius of spring when rendered" ]
@@ -375,16 +375,26 @@ and `D(s)` is the time derivative of `s`.
375375# Arguments:
376376- `d`: Damping coefficient
377377
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+
378383See also [`SpringDamperParallel`](@ref)
379384"""
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... )
381386 @named plf = PartialLineForce (; kwargs... )
382387 @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
384394 eqs = [
385395 f ~ d * D (s),
386396 ]
387- extend (ODESystem (eqs, t; name), plf)
397+ extend (ODESystem (eqs, t, [s, f], pars ; name), plf)
388398end
389399
390400"""
0 commit comments