Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ufechner7 committed Aug 18, 2024
1 parent b54fe3c commit b73e5d8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Tether_03.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ V0::Float64 = 4 # initial velocity [m/
@variables spring_force(t)[1:3] = [0.0, 0.0, 0.0]
@variables force(t) = 0.0 norm1(t) = abs(l0) spring_vel(t) = 0.0

eqs = vcat(D.(pos) .~ vel,
D.(vel) .~ acc,
norm1 .~ norm(pos),
unit_vector .~ -pos/norm1, # direction from point mass to origin
spring_vel .~ -unit_vector vel,
c_spring .~ c_spring0 * (norm1 > abs(l0)),
spring_force .~ (c_spring * (norm1 - abs(l0)) + damping * spring_vel) * unit_vector,
acc .~ G_EARTH + spring_force/mass)
eqs = vcat(D.(pos) ~ vel,
D.(vel) ~ acc,
norm1 ~ norm(pos),
unit_vector ~ -pos/norm1, # direction from point mass to origin
spring_vel ~ -unit_vector vel,
c_spring ~ c_spring0 * (norm1 > abs(l0)),
spring_force ~ (c_spring * (norm1 - abs(l0)) + damping * spring_vel) * unit_vector,
acc ~ G_EARTH + spring_force/mass)

@named sys = ODESystem(Symbolics.scalarize.(reduce(vcat, Symbolics.scalarize.(eqs))), t)
simple_sys = structural_simplify(sys)
Expand Down

0 comments on commit b73e5d8

Please sign in to comment.