Rhino3d Script to get trim angles for different heels

Discussion in 'Stability' started by Tapsa84, May 22, 2016.

  1. Tapsa84
    Joined: May 2016
    Posts: 19
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: Finland

    Tapsa84 Junior Member

    Hi,

    I am currently examining the accuracy of using heeled LCB to determine angle of trim against static LCB. In short, I am just tilting the heeled boat around a point perpendicular to stern and keel so that the static and heeled LCBs are aligned. Then the boat is raised/lowered to get the displacement as close as possible. Then it iterates until it gets as close as possible.

    Does anyone think this is a workable method?

    This would be great in determining hull balance quickly without specifying CG or using expensive software to get this data. It would be easy to plot a graph for heeling from 0 to 30 degrees for example. With trim and Cyrus Hamlin's method for determining helm balance.

    I found an excel sheet calculator which apparently does this without CG, or at least I did not see CG specified anywhere. I am not excactly sure what they mean by "The trim applied makes the bows and transom equal in their height above or below the heeled waterplane"? How does this work?

    This is the link:
    http://www.onemetre.net/Design/Balance/Designv30.xls

    I am not sure how it trims straight to the correct trim angle with the trim macro, and then to correct displacement with the rise macro? At least without knowing the CG.

    I remember that there is a link to a german site, which has an interactive trim, list and heel model to play with. This model is complete with CG and all, so it is spot on with it's calculations. Modelling CG in to the equation would be the next step, but at the moment I could do without it.

    Anyways, current version of the script trims up/down 0,1 degrees depending on the heeled LCB against the static and gets the new displacement. I can get it to move up down depending on the displacement, but getting the algorithm to iterate is a bit tricky. It's been years since I have used VBScript for anything. :D
     
  2. Heimfried
    Joined: Apr 2015
    Posts: 325
    Likes: 34, Points: 28, Legacy Rep: 37
    Location: Berlin, Germany

    Heimfried Senior Member

    It sounds interesting, but I don't understand what you are doing. A Sketch?
     
  3. TANSL
    Joined: Sep 2011
    Posts: 5,725
    Likes: 181, Points: 73, Legacy Rep: 300
    Location: Spain

    TANSL Senior Member

    It would require a more detailed explanation of what is intended to do.
    I do not understand the following "boat heeled around a point perpendicular to stern and keel". How it can be a point perpendicular to the stern ?. More difficult still it is that the point is perpendicular to both the stern and the keel. I'm probably misinterpreting something.
    Typically, considering that the boat rotates about an axis which passes through, not any point, but through the cog of the waterplane area.
     
  4. Gary Brown
    Joined: Mar 2012
    Posts: 13
    Likes: 1, Points: 3, Legacy Rep: 12
    Location: USA

    Gary Brown Junior Member

    Tapsa84:

    It is meaningless to talk about calculating the trim balance without specifying the LCG since this is the very point about which you are trying to balance.
    The trim reported on the spreadsheet from the link you provided is just the amount of rotation required to make the bow and transom equal height and it is not the hydrostatic equilibrium trim. He is calculating the sink with "fixed" trim.
     
  5. Tapsa84
    Joined: May 2016
    Posts: 19
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: Finland

    Tapsa84 Junior Member

    I see what you are getting at. What I mean, is a point that is horizontally aligned with transom and vertically with the lowest point of keel. So the x = 0, and y = draft. Now that you mentioned it, I wrote something that made no sense :)

    My first thought was to use a static point, so that the model would always be back at the same point when untrimmed. The hydrostatics script in Rhino uses x or y axis and references all the calculated information with this.

    I could also trim the model from the centroid of the heeled waterplane, by trimming 0,1 degrees from this point, then adjust the displacement, and calculate the new centroid of the waterplane and iterate again from this point, until I get the heeled LCB aligned with the static one.

    The problem is the amount of movement of the model in reference of the x axis. I checked that the model will move different amounts in the x axis if I trim through the COF vs a selected point. When Using COF for trim with the current model, LCB will move 12mm less for 1 degree of trim angle. This would effect the alignment of course. So I guess the COF-method is the way go.

    I also checked whether the model would get back to the same point. So I first trimmed 1 degree from the COF and then matched the static displacement. Then I got the new COF and trimmed again matching the displacement. After this I trimmed yet again from the new COF with -2 degrees and it did indeed get back to the original place.

    The question is, is it even possible to get the trim with just aligning the LCB without specifying CG?
     
  6. Tapsa84
    Joined: May 2016
    Posts: 19
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: Finland

    Tapsa84 Junior Member

    Thanks. This clears up a whole lot!
     
  7. Heimfried
    Joined: Apr 2015
    Posts: 325
    Likes: 34, Points: 28, Legacy Rep: 37
    Location: Berlin, Germany

    Heimfried Senior Member

    In ship hydrostatics the CoG and the CoB are considered to be the points of attac of the forces G and B. If they are not aligned, the resulting momentum is causing the movement of the boat. The new CoF is the result of the movement, not the reason for it.

    An example:
    http://www.bootsphysik.de/rechner/bootx.php
    (Button "English" top right)
     
  8. Tapsa84
    Joined: May 2016
    Posts: 19
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: Finland

    Tapsa84 Junior Member

    It took me a while to understand how the model worked, but I am now confident that I can reproduce the results with a Rhino3D model. With the added bonus of being able to get the GZ curve also. Too bad there is no way of assigning density in Rhino, at least without buying 3rd party software. Still have to think on how to estimate/define the preliminary VCG thou. How do you professional designers go about this?

    Anyway, I am now in the process of adding the CG to the mix. It was a bit tricky locking it to the model, which is moving around and using the closed macro/script for the hydrostatic calculations.

    Slowly but surely getting there. Thanks for the link.
     
  9. TANSL
    Joined: Sep 2011
    Posts: 5,725
    Likes: 181, Points: 73, Legacy Rep: 300
    Location: Spain

    TANSL Senior Member

    The density of the liquid will have to incorporate yourself in some of the macros you are creating.
    Once calculated for a given flotation then hydrostatic values, there are two of them, tons per centimeter immersion and the moment to trim one centimeter, which will be very useful to estimate the new equilibrium position of the boat when rotating.
    To calculate the VCG the most practical way is to placed in an Excel table all and each of the weights, actual or estimated, with their cog and calculate the resulting COG.
     
  10. Tapsa84
    Joined: May 2016
    Posts: 19
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: Finland

    Tapsa84 Junior Member

    Thanks for the tips. I have since switched from vbscripting to a real C# plugin, and I am currently making a GUI for the plugin. This will be easier to port into a Mac-version of Rhino3d (for all you Mac lovers :D). I have another embedded industrial project which is hindering my progress. Slowly but surely. I'll keep you posted on my progress.
     
  11. TANSL
    Joined: Sep 2011
    Posts: 5,725
    Likes: 181, Points: 73, Legacy Rep: 300
    Location: Spain

    TANSL Senior Member

    Yes, please.
     
  12. vv3k4i
    Joined: Mar 2008
    Posts: 40
    Likes: 1, Points: 18, Legacy Rep: 10
    Location: Gdansk

    vv3k4i Junior Member

    Hello Tapsa 84.
    I'm not sure if you have a full picture of what is required to create a plugin for rhino to calculate free floating object stability. Maybe you should start from getting closer with theory, as this will be very much needed to accomplish the plugin development with success. I'm also in the middle of wrinting my own .NET code for the same purpose, and to handle all the problems and speciffic cases I spend lots of time. My solution already has three different projects and tousends of lines of code inside, and still growing.
    However if you're looking for the base for calculations, maybe below document will give you some answers
    https://www.prs.pl/__files/parent347/tr_no_72.pdf
     
  13. Tapsa84
    Joined: May 2016
    Posts: 19
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: Finland

    Tapsa84 Junior Member

    Hi, nice to see that other people are also working on the same problems :D

    I do not know how you are doing it, but I am getting all relevant hydrostatic data with only 10 lines of code. I only have a total of 7 base functions that trim the boat for each degree of heel to line up longitudinal center of buoyancy and longitudinal center of gravity with correct displacement.

    The functions are as follows;

    1. Get hull for calculations
    2. Add center of gravity specified by user from transom and lowest point of keel
    3. Calculate hydrostatics
    4. Parse hydrostatic calculation data
    5. Move hull up down according to user specified displacement and water density
    6. Heel hull (always clockwise)
    7. Trim hull (bow up or down)

    Last 5 of these are integrated with an algorithm that iterates thousands of time to get the hull floating correctly (not n. 6 obviously, only 1 degree at a time).

    I have just one command in my solution with four forms, one for getting user data, one for saving and loading it from a file and the last one for plotting a graph that can be saved in png-format. I do not have thousands of lines of code. Each of the functions have only from 10 to 100 lines of code. The most tricky one was adding the center of gravity and locking it in relative to the model :D

    Few things to criticize, is that lateral center of gravity is not specified. It is assumed to be inline with the keel, so no listing calculations at the moment. The waterline is always at z-axis 0. If the model has naked edges, the plugin can't make the calculations. So there can be no leaks, if you are calculating for example inverted stability.

    Once I get the time from my day job, I will concentrate on the measurement of righting arm, on which I already have an idea how to solve. Then I will get the righting moment as well.

    Thank for the link, there was some interesting points on GZ-arm relative to which axis is trimmed. And also that the effect of constant trim vs free floating trim is negligible in an intact model when calculating stability. But, I have it, so why not use it. Right?

    PM me if you have questions, I can explain in more detail how I did things, but I will not share straight up code. At least not for the time being. I have not decided yet on the commercial aspect.
     

    Attached Files:

  14. vv3k4i
    Joined: Mar 2008
    Posts: 40
    Likes: 1, Points: 18, Legacy Rep: 10
    Location: Gdansk

    vv3k4i Junior Member

    Well, my plugin is doing a bit more calculations, I have also tested different hull shapes including multi hulls and SWAT, I'm not sure if you have already tested this. It is fairly simple to make some basic calculations just from the start, but it gets more complicated with time. I currently allow to define transverse center of gravity and I do calculate GZ since some time. Currently I'm trying to make the form more user friendly and to implement as much of useful functionality as possible for example the effect of free surface in compartments. Besides, do you have any confirmation on how accurate are your calculations? Comparison to NAPA or any other "proven" software? Or at least hand calculations?
     

  15. Tapsa84
    Joined: May 2016
    Posts: 19
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: Finland

    Tapsa84 Junior Member

    I haven't done any tests against commercial software yet. I have yet to code the GZ measurement. But soon as I get it done, I am hoping to find someone here who has access to other 3rd party software to compare the results. The plugin does also work for multihulls.

    The accuracy really depends on Rhino's capability of measuring distance and calculating volumes and volume centroids, as much as it is dependant also in the number of control points on the models surface. Everything else is just aligning certain points of the model on a certain plane, as you already know. You can change the absolute tolerance of the model, so it is relative, as is the amount of surface control points. GZ-arm is only a measurement and when calculating RM it is this measurement times displacement. See where I am going? :D

    I would imagine that hand calculations are not nearly as close as the computer generated. But that is just my guess, or maybe more of a statement.

    So, at the moment, I have no idea on the accuracy of Rhino3d models, so I can not give you definitive answer. But for the sake of speculation, I would say that they are as accurate as yours? Would you not agree?

    I'd say you have some real tricky business if you add ballast tanks and free surface effect to those, as it would have to dynamically shift the transverse and vertical gravity in the model. Not to mention if you add the 3rd dimension. I suppose you would need some dark fluid dynamic simulation sorcery :D Can you give a general description on how you did it?
     
Forum posts represent the experience, opinion, and view of individual users. Boat Design Net does not necessarily endorse nor share the view of each individual post.
When making potentially dangerous or financial decisions, always employ and consult appropriate professionals. Your circumstances or experience may be different.