Skip to content

Instantly share code, notes, and snippets.

@tobixen
Created July 31, 2021 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobixen/0abc42b0b51d87f5700a221a310b122e to your computer and use it in GitHub Desktop.
Save tobixen/0abc42b0b51d87f5700a221a310b122e to your computer and use it in GitHub Desktop.
Python program for calculating required wind force on a boat to raise a kellet to a certain vertical position
from math import sqrt
try:
from nose.tools import assert_almost_equal
except:
assert_almost_equal = lambda x, y: True
def daumann_kalk(ankertaulengde, dybde, daumannlengde, dausynk, daumannsvekt):
l1 = ankertaulengde - daumannlengde
l2 = daumannlengde
l2y = dybde*l2/ankertaulengde+dausynk
l1y = dybde - l2y
Dy = daumannsvekt
By = l2y*Dy*sqrt(l1**2-l1y**2)/(l1y*(l2y*sqrt(l1**2-l1y**2)/l1y-sqrt(l2**2-l2y**2)))
l1x = sqrt(l1**2-l1y**2)
l2x = sqrt(l2**2-l2y**2)
Bx = By*sqrt(l2**2-l2y**2)/l2y
Ay = By-Dy
Ax = Bx
assert_almost_equal(Ay, By-Dy)
assert_almost_equal(l1x**2+l1y**2, l1**2)
assert_almost_equal(Ax/Ay, l1x/l1y)
assert_almost_equal(Bx/By, l2x/l2y)
return locals()
print(str(daumann_kalk(30, 10, 25, 1.6, 10)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment