Skip to content

Commit

Permalink
Explicitly define float type of local variables in SpringDamper and B…
Browse files Browse the repository at this point in the history
…ushing
  • Loading branch information
GerhardHippmann committed Jan 15, 2024
1 parent 15f82dd commit 4cdc5ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/Composition/ForceElements/Bushing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,28 +122,28 @@ mutable struct Bushing{F <: Modia3D.VarFloatType} <: Modia3D.AbstractForceElemen
if (isa(springForceLaw[dir], Function))
springForceFunction[dir] = springForceLaw[dir]
else
stiffness = Modia3D.convertAndStripUnit(F, u"N/m", springForceLaw[dir])
stiffness::F = Modia3D.convertAndStripUnit(F, u"N/m", springForceLaw[dir])
stiffnessFunction(pos::F) = stiffness * pos
springForceFunction[dir] = stiffnessFunction
end
if (isa(damperForceLaw[dir], Function))
damperForceFunction[dir] = damperForceLaw[dir]
else
damping = Modia3D.convertAndStripUnit(F, u"N*s/m", damperForceLaw[dir])
damping::F = Modia3D.convertAndStripUnit(F, u"N*s/m", damperForceLaw[dir])
dampingFunction(vel::F) = damping * vel
damperForceFunction[dir] = dampingFunction
end
if (isa(rotSpringForceLaw[dir], Function))
rotSpringForceFunction[dir] = rotSpringForceLaw[dir]
else
rotStiffness = Modia3D.convertAndStripUnit(F, u"N*m/rad", rotSpringForceLaw[dir])
rotStiffness::F = Modia3D.convertAndStripUnit(F, u"N*m/rad", rotSpringForceLaw[dir])
rotStiffnessFunction(ang::F) = rotStiffness * ang
rotSpringForceFunction[dir] = rotStiffnessFunction
end
if (isa(rotDamperForceLaw[dir], Function))
rotDamperForceFunction[dir] = rotDamperForceLaw[dir]
else
rotDamping = Modia3D.convertAndStripUnit(F, u"N*m*s/rad", rotDamperForceLaw[dir])
rotDamping::F = Modia3D.convertAndStripUnit(F, u"N*m*s/rad", rotDamperForceLaw[dir])
rotDampingFunction(om::F) = rotDamping * om
rotDamperForceFunction[dir] = rotDampingFunction
end
Expand Down
4 changes: 2 additions & 2 deletions src/Composition/ForceElements/SpringDamperPtP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ mutable struct SpringDamperPtP{F <: Modia3D.VarFloatType} <: Modia3D.AbstractFor
if (isa(springForceLaw, Function))
springForceFunction = springForceLaw
else
stiffness = Modia3D.convertAndStripUnit(F, u"N/m", springForceLaw)
stiffness::F = Modia3D.convertAndStripUnit(F, u"N/m", springForceLaw)
springForceFunction(pos::F) = stiffness * pos
end

if (isa(damperForceLaw, Function))
damperForceFunction = damperForceLaw
else
damping = Modia3D.convertAndStripUnit(F, u"N*s/m", damperForceLaw)
damping::F = Modia3D.convertAndStripUnit(F, u"N*s/m", damperForceLaw)
damperForceFunction(vel::F) = damping * vel
end

Expand Down

0 comments on commit 4cdc5ea

Please sign in to comment.