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()
DAVEcore version = 2.0 from c:\python\miniconda3\envs\book\Lib\site-packages\DAVEcore.cp311-win_amd64.pyd
! Blender not found - Blender can be installed from the microsoft windows store.   if you have blender already and want to be able to use blender then please either:
   - configure windows to open .blend files with blender automatically 
   - add the folder containing blender-launcher.exe to the PATH variable.
Loading c:\python\miniconda3\envs\book\Lib\site-packages\DAVE\resources\Snake15.dave
True

Show the model

from DAVE.jupyter import *
show(s, camera_pos = (10,-50,-10), lookat = (10,0,-10))
../_images/d48d7e0e039496070b02ed39422789b0570f7bd9ae0d18657c0c38f0af34f78a.png

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 [Frame]
 |-> 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)
created c:\data\snake15.yml
Written C:\Users\beneden\AppData\Local\Temp\ofx_dave_runfile.py to run c:\data\snake15.yml and save resuts as c:\data\snake15_sum.yml
No module named 'OrcFxAPI'

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.34581693585757, 0.0)
4 base2 global position [m,m,m] (2.127468608064057, 0.0, -1.9959338050041169) (2.127468596221335, 0.0, -1.9959338057604419)
5 base2 global rotation vec [deg,deg,deg] [0.0, 85.87717852547878, 0.0] (0.0, 85.87717890073976, 0.0)
6 base3 global position [m,m,m] (2.2712580663835693, 0.0, -3.9907582563471875) (2.2712580414756625, 0.0, -3.9907582580452665)
7 base3 global rotation vec [deg,deg,deg] [0.0, 85.27096717156601, 0.0] (0.0, 85.27096761890284, 0.0)
8 base4 global position [m,m,m] (2.4361450916600234, 0.0, -5.983949734578891) (2.4361450511902705, 0.0, -5.983949737564325)
9 base4 global rotation vec [deg,deg,deg] [0.0, 84.4564042129098, 0.0] (0.0, 84.45640477749188, 0.0)
10 base5 global position [m,m,m] (2.629351315140033, 0.0, -7.974595698885099) (2.6293512550548184, 0.0, -7.974595703774352)
11 base5 global rotation vec [deg,deg,deg] [0.0, 83.3043786313607, 0.0] (0.0, 83.30437937661381, 0.0)
12 base6 global position [m,m,m] (2.8625409894083895, 0.0, -9.960954824475087) (2.862540903486359, 0.0, -9.960954832397464)
13 base6 global rotation vec [deg,deg,deg] [0.0, 81.55231497122648, 0.0] (0.0, 81.55231604541771, 0.0)
14 base7 global position [m,m,m] (3.156353610237007, 0.0, -11.93925564685823) (3.156353487225446, 0.0, -11.939255660289056)
15 base7 global rotation vec [deg,deg,deg] [0.0, 78.57476666635955, 0.0] (0.0, 78.57476826268501, 0.0)
16 base8 global position [m,m,m] (3.5525316848000683, 0.0, -13.899623707513042) (3.5525315071704253, 0.0, -13.899623731981837)
17 base8 global rotation vec [deg,deg,deg] [0.0, 72.45636490885146, 0.0] (0.0, 72.45636873786475, 0.0)
18 base9 global position [m,m,m] (4.155395765159377, 0.0, -15.806599035253946) (4.155395460088689, 0.0, -15.806599100011471)
19 base9 global rotation vec [deg,deg,deg] [0.0, 54.03568857722478, 0.0] (0.0, 54.03568099765549, 0.0)
20 base10 global position [m,m,m] (5.329958195605648, 0.0, -17.425364953163065) (5.329958104678966, 0.0, -17.425364862539546)
21 base10 global rotation vec [deg,deg,deg] [0.0, -22.137479774128504, 0.0] (0.0, -22.137478829107895, 0.0)
22 base11 global position [m,m,m] (7.182522850128579, 0.0, -16.671704418961934) (7.182522771632563, 0.0, -16.6717043588941)
23 base11 global rotation vec [deg,deg,deg] [0.0, -65.47560858758786, 0.0] (0.0, -65.47560490233012, 0.0)
24 base12 global position [m,m,m] (8.01268402031783, 0.0, -14.852135120608608) (8.012684058856292, 0.0, -14.852135113936647)
25 base12 global rotation vec [deg,deg,deg] [0.0, -75.88524800628304, 0.0] (0.0, -75.88524655062089, 0.0)
26 base13 global position [m,m,m] (8.500413455301638, 0.0, -12.912516601865715) (8.500413543118237, 0.0, -12.912516607585056)
27 base13 global rotation vec [deg,deg,deg] [0.0, -80.15406824716375, 0.0] (0.0, -80.15406738824612, 0.0)
28 base14 global position [m,m,m] (8.842412268896693, 0.0, -10.941974338553512) (8.842412386253573, 0.0, -10.94197434939974)
29 base14 global rotation vec [deg,deg,deg] [0.0, -82.45195404074741, 0.0] (0.0, -82.45195365728361, 0.0)
30 base15 global position [m,m,m] (9.105127333723386, 0.0, -8.959304221082352) (9.105127464349694, 0.0, -8.959304233686854)
31 base15 global rotation vec [deg,deg,deg] [0.0, -83.88353327130856, 0.0] (0.0, -83.88353303099507, 0.0)
32 Cable Tension [kN] 56.439632552228254 56.439631
33 Cable Stretched length [m] 7.003950774278656 7.003951

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.