From 4cdc5ea0ae03319e8ae9b60d1c874c4ea1ab0702 Mon Sep 17 00:00:00 2001 From: Gerhard Hippmann Date: Mon, 15 Jan 2024 09:35:12 +0100 Subject: [PATCH] Explicitly define float type of local variables in SpringDamper and Bushing --- src/Composition/ForceElements/Bushing.jl | 8 ++++---- src/Composition/ForceElements/SpringDamperPtP.jl | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Composition/ForceElements/Bushing.jl b/src/Composition/ForceElements/Bushing.jl index 278c06f..e93146c 100644 --- a/src/Composition/ForceElements/Bushing.jl +++ b/src/Composition/ForceElements/Bushing.jl @@ -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 diff --git a/src/Composition/ForceElements/SpringDamperPtP.jl b/src/Composition/ForceElements/SpringDamperPtP.jl index 97aba03..1ca12ea 100644 --- a/src/Composition/ForceElements/SpringDamperPtP.jl +++ b/src/Composition/ForceElements/SpringDamperPtP.jl @@ -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