Cross-validation of DAVE and Orcaflex static results

Create a new DAVE scene based on the “snake15.dave” example file and solve statics

from DAVE import *
s = Scene('Snake15.dave')
s.solve_statics()
Equilibrium-core version = 1.07
default resource folders:
/home/ruben/miniconda3/lib/python3.8/site-packages/DAVE/resources
/home/ruben/DAVE_models
/home/ruben/DAVE_book/DAVE-notebooks
Loading /home/ruben/miniconda3/lib/python3.8/site-packages/DAVE/resources/Snake15.dave
Solved to 3.183207331924898e-05.
True

Show the model

from DAVE.jupyter import *
show(s, sea=False, camera_pos = (10,-50,-10), lookat = (10,0,-10))
embedWindow(verbose=True): could not load k3d module, try:
> pip install k3d      # and if necessary:
> conda install nodejs
../_images/crossvalidate_ofx_Snake15_4_1.png
# view(s)  # for interactive view

The model consists of 15 bodies that are all connected to the previous one using a hinge. Each body has a mass.

These is a first body (base0) which is connected to the world. The last body of the chain is connected to a cable. Like so:

s.print_node_tree()
base0 [Axis]
 |-> base1 [RigidBody]
 |    |-> base2 [RigidBody]
 |    |    |-> base3 [RigidBody]
 |    |    |    |-> base4 [RigidBody]
 |    |    |    |    |-> base5 [RigidBody]
 |    |    |    |    |    |-> base6 [RigidBody]
 |    |    |    |    |    |    |-> base7 [RigidBody]
 |    |    |    |    |    |    |    |-> base8 [RigidBody]
 |    |    |    |    |    |    |    |    |-> base9 [RigidBody]
 |    |    |    |    |    |    |    |    |    |-> base10 [RigidBody]
 |    |    |    |    |    |    |    |    |    |    |-> base11 [RigidBody]
 |    |    |    |    |    |    |    |    |    |    |    |-> base12 [RigidBody]
 |    |    |    |    |    |    |    |    |    |    |    |    |-> base13 [RigidBody]
 |    |    |    |    |    |    |    |    |    |    |    |    |    |-> base14 [RigidBody]
 |    |    |    |    |    |    |    |    |    |    |    |    |    |    |-> base15 [RigidBody]
 |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |-> Poi [Point]
Poi_1 [Point]
Cable [Cable]

Orcaflex

This model can be exported to orcaflex.

  • The bodies will be exported as 6D buoys

  • The hinges (reduced degrees of freedom in DAVE) are exported as constraints

  • The cable is exported as a winch

This is all exported to a .yml file.

If you have orcaflex on this computer then DAVE will use the OrcFxAPI to open the model, solve statics and summarize the static results. The static results are returned as a dict.

This only runs if you have orcaflex and an available license.

from DAVE.io.orcaflex import *

# If the orcaflex/python configuration on your pc is not properly configured then you may need to manually add the path to the orcaflex api. This is done here
import sys
sys.path.append(r'C:\Program Files (x86)\Orcina\OrcaFlex\10.2\OrcFxAPI\Python')

try:
    ofx_results = run_statics_collect(s, filename = r'c:\data\snake15.yml')
except Exception as E:
    print(E)
'TEMP'

Now it is possible that you, like me, do not have orcaflex. In that case the previous cell resulted in an error like “No module named ‘OrcFxAPI’ “

What if you do not have Orcaflex

  • You can still download the orcaflex demo to open and view the .yml model file

screenshot

- All the bodies have been exported as 6D buoys
- The partially free connections to their parents have been exported as contraints
- The cable has been exported as winch
  • You can give the model to somebody who has orcaflex and ask nicely if they can run it for you using the created .py file

  • You can then load the model_sum.yml file directly.

ofx_results = r'snake15_sum.yml' # this step can be skipped if the previous cell ran without errors

There is a small utility fuction to compare the orcaflex static results to the results in the DAVE model. ofx_results may be a results dictionary or a modelname_sum.yml file

comparison = compare_statics(s, ofx_results)

To nicely display the result dictionary we convert it to a pandas dataframe. Just a quick trick to make a table.

import pandas as pd
pd.DataFrame.from_dict(comparison)
Name Prop Orcaflex DAVE
0 base0 global position [m,m,m] (0.0, 0.0, 0.0) (0.0, 0.0, 0.0)
1 base0 global rotation vec [deg,deg,deg] [0.0, 0.0, 0.0] (0.0, 0.0, 0.0)
2 base1 global position [m,m,m] (2.0, 0.0, 0.0) (2.0, 0.0, 0.0)
3 base1 global rotation vec [deg,deg,deg] [0.0, 86.3458165958974, 0.0] (0.0, 86.345816887175, 0.0)
4 base2 global position [m,m,m] (2.127468608064057, 0.0, -1.9959338050041169) (2.127468597917222, 0.0, -1.9959338056521359)
5 base2 global rotation vec [deg,deg,deg] [0.0, 85.87717852547878, 0.0] (0.0, 85.87717896681353, 0.0)
6 base3 global position [m,m,m] (2.2712580663835693, 0.0, -3.9907582563471875) (2.2712580408711087, 0.0, -3.9907582581027796)
7 base3 global rotation vec [deg,deg,deg] [0.0, 85.27096717156601, 0.0] (0.0, 85.2709676819344, 0.0)
8 base4 global position [m,m,m] (2.4361450916600234, 0.0, -5.983949734578891) (2.436145048392991, 0.0, -5.983949737803232)
9 base4 global rotation vec [deg,deg,deg] [0.0, 84.4564042129098, 0.0] (0.0, 84.45640479915949, 0.0)
10 base5 global position [m,m,m] (2.629351315140033, 0.0, -7.974595698885099) (2.6293512515047355, 0.0, -7.974595704086323)
11 base5 global rotation vec [deg,deg,deg] [0.0, 83.3043786313607, 0.0] (0.0, 83.30437947159486, 0.0)
12 base6 global position [m,m,m] (2.8625409894083895, 0.0, -9.960954824475087) (2.862540896643425, 0.0, -9.960954833096002)
13 base6 global rotation vec [deg,deg,deg] [0.0, 81.55231497122648, 0.0] (0.0, 81.55231619416448, 0.0)
14 base7 global position [m,m,m] (3.156353610237007, 0.0, -11.93925564685823) (3.1563534752466045, 0.0, -11.939255661750368)
15 base7 global rotation vec [deg,deg,deg] [0.0, 78.57476666635955, 0.0] (0.0, 78.57476866393792, 0.0)
16 base8 global position [m,m,m] (3.5525316848000683, 0.0, -13.899623707513042) (3.5525314814627653, 0.0, -13.899623736217656)
17 base8 global rotation vec [deg,deg,deg] [0.0, 72.45636490885146, 0.0] (0.0, 72.45636899716955, 0.0)
18 base9 global position [m,m,m] (4.155395765159377, 0.0, -15.806599035253946) (4.155395425750588, 0.0, -15.806599106975685)
19 base9 global rotation vec [deg,deg,deg] [0.0, 54.03568857722478, 0.0] (0.0, 54.035702025324696, 0.0)
20 base10 global position [m,m,m] (5.329958195605648, 0.0, -17.425364953163065) (5.3299574762504145, 0.0, -17.42536530057056)
21 base10 global rotation vec [deg,deg,deg] [0.0, -22.137479774128504, 0.0] (0.0, -22.137451532394017, 0.0)
22 base11 global position [m,m,m] (7.182522850128579, 0.0, -16.671704418961934) (7.182522502260879, 0.0, -16.671705679519487)
23 base11 global rotation vec [deg,deg,deg] [0.0, -65.47560858758786, 0.0] (0.0, -65.47560389242267, 0.0)
24 base12 global position [m,m,m] (8.01268402031783, 0.0, -14.852135120608608) (8.012683821556719, 0.0, -14.852136449194631)
25 base12 global rotation vec [deg,deg,deg] [0.0, -75.88524800628304, 0.0] (0.0, -75.88524670125825, 0.0)
26 base13 global position [m,m,m] (8.500413455301638, 0.0, -12.912516601865715) (8.500413300719178, 0.0, -12.912517941560743)
27 base13 global rotation vec [deg,deg,deg] [0.0, -80.15406824716375, 0.0] (0.0, -80.15406784032515, 0.0)
28 base14 global position [m,m,m] (8.842412268896693, 0.0, -10.941974338553512) (8.842412128306407, 0.0, -10.941975680676963)
29 base14 global rotation vec [deg,deg,deg] [0.0, -82.45195404074741, 0.0] (0.0, -82.4519538618693, 0.0)
30 base15 global position [m,m,m] (9.105127333723386, 0.0, -8.959304221082352) (9.10512719932302, 0.0, -8.959305564026003)
31 base15 global rotation vec [deg,deg,deg] [0.0, -83.88353327130856, 0.0] (0.0, -83.88353325788096, 0.0)
32 Cable Tension [kN] 56.439632552228254 56.4589
33 Cable Stretched length [m] 7.003950774278656 7.00395

The results are comparable enough to conclude that both programs agree on the equilibrium positions and tensions. They are also different enough to confirm that they are really originate from different programs.