This works:
using StaticArrays, Parameters
import Base.zero
const SEGMENTS = 6
# struct, defining the phyical parameters of one spring
@with_kw mutable struct Spring{I, S}
p1::I = 1 # number of the first point
p2::I = 2 # number of the second point
length::S = 1.0 # Current unstressed spring length
c_spring::S = 1.0 #
damping::S = 0.1 #
end
const SP = Spring{Int16, Float64}
function zero(::Type{SP})
s = SP()
s.p1 = 0
s.p2 = 0
s.length = 0.0
s.c_spring = 0.0
s.damping = 0.0
s
end
@with_kw mutable struct KPS4{S, P, Q, SP}
masses::MVector{P, S} = ones(P)
springs::SVector{Q, SP} = zeros(SP, Q)
end
function KPS4()
KPS4{Float64, SEGMENTS+1, SEGMENTS, SP}()
end
kps = KPS4()
Slightly inconvenient, but not much…
Thanks a lot!