This tutorial shows how to simulate compartment flooding in Virtual Testbed and how to get statistics without reading statistics.log. First, we import ship hull from the file and generate dummy compartments for this hull. Dummy compartments are arranged in a 3-d grid and occupy bounding box of the ship. This of course makes them non-realistic, but this approach is good enough to demonstrate how mass distribution affects ship motions.

(use-modules (ice-9 pretty-print))
(define ship
  (let* ((hull (import-hull "aurora.bsp")) ;; import hull geometry
         (compartments (generate-compartments hull '(6 3 3))) ;; generate 6x3x3 grid of compartments
         (ship (make-ship #:hull hull #:compartments compartments))) ;; make ship from the hull and the compartments
    (pretty-print (ship-compartments ship)) ;; display compartment names
    (ship-compartment-flood! ship "room-0-0-0" 9999.0) ;; flood one of the compartments
    ship))
Now simulate ship motions for 30 seconds.
(define vtb
  (make-testbed
    #:policy 'openmp
    #:wave-generator (make-calm-sea-generator)
    #:ship ship))
(for-each
 (lambda (i)
   (testbed-step! vtb 0.1))
 (iota 600))
After the simulation we get the following picture.
Flooded compartment.
Now we get statistics without reading statistics.log, but using statistic-current-row procedure like the following.
(pretty-print (statistics-current-row (testbed-statistics vtb)))
This command prints associative list of columns and their values.
((time . 59.999656677246094)
 (surge . 0.010292157530784607)
 (sway . -0.3035007417201996)
 (heave . -6.185904026031494)
 (roll . 0.047156743705272675)
 (pitch . -0.002280984539538622)
 (yaw . -0.001262190518900752)
 (velocity-x . 1.7467985162511468e-4)
 (velocity-y . -0.005390468053519726)
 (velocity-z . 7.859510515118018e-5)
 (angular-velocity-x . -6.211842410266399e-4)
 (angular-velocity-y . -7.078093040036038e-5)
 (angular-velocity-z . -3.787495006690733e-5)
 (acceleration-x . -1.37167049274467e-7)
 (acceleration-y . 5.3628991736331955e-5)
 (acceleration-z . 9.870389476418495e-5)
 (angular-acceleration-x . -8.398099453188479e-4)
 (angular-acceleration-y . 2.1901079162489623e-4)
 (angular-acceleration-z . -7.2818311309674755e-6)
 (underwater-volume . 7121.53564453125)
 (wave-length-t . 0.0)
 (wave-length-x . 0.0)
 (wave-length-y . 0.0)
 (wave-number-t . 0.0)
 (wave-number-x . 0.0)
 (wave-number-y . 0.0)
 (wave-height-t . 0.0)
 (wave-height-x . 0.0)
 (wave-height-y . 0.0)
 (elevation . 0.0)
 (angular-momentum-x . -0.01591651514172554)
 (angular-momentum-y . -0.058883439749479294)
 (angular-momentum-z . -0.021883737295866013))
See statistics-columns for the list of all column names and their values.
Demonstation video.