GHS Port Reference Center
Information for maritime designers, engineers and builders
Maintained by Creative Systems, Inc., Creators of GHS
Click here for information about GHS and other fine marine software.
Go to Main page

Towline Pull Criterion as given in 46 CFR 173.095 (b)
    save temp.old
    write (macros) temp.mac
    clear macros
    clear variables
    report off
    page 1
    
    variable nprop:1:3
    variable power:1:99999
    variable diam:0.1:999
    variable sfract:0:1
    variable harm:0:999
    variable beam:1:9999
    variable q,q1,coef,gmreq,maxvcg,kfact,draft,ddraft,n
    variable (string) t,powunit,lenunit
    variable (string) proj,self
    variable draft1:0.1:99,draft2:0.1:99,ndrafts:1:50
    variable cleared
    
    set proj="173095b"
    
    set self="173095B.RF"
    
    template about
     "Calculates required GM and maximum VCG as a function of"
     "draft at zero trim using the Towline Pull Criterion as"
     "given in 46 CFR 173.095 (b)."
    /
    
    macro readgf
     template t "Note"
      "No geometry file has been read."
      "Do you want to locate and Read one now?"
      "Yes" "No" exit
     //
     .t
     if {templok}=0 then exit
     template t "Geometry file"
      "Read" file t /ext:"gf" /exist
     //
     .t
     if {templok}=0 then exit
     read {t}
    /
    
    macro readsave
     run {proj}.sav /call
     cls
    /
    
    macro save
     report off
     save {proj}.sav
    /
    
    macro clear
     template t "Warning"
      "Are you sure you want to clear all settings?"
      "Yes" "No" exit
     //
     .t
     if {templok}=0 then exit dialog
     macro t
      if fexist %%91 then erase %%91
     //
     .t {proj}.sav
     set cleared=1
     template t " "
      "Please rerun this wizard to begin fresh."
     //
     .t
    /
    
    macro checkval
     if "%1"="" then set t="missing" | exit
     if %1<%2 then set t="too small" | exit
     if %1>%3 then set t="too large" | exit
     set t=""
    /
    
    macro coef
     set q = {power} times {diam}
     set q = {q} power 0.6667
     set coef = {q} times {nprop} times {sfract} times {harm} times {beam}
     set coef = {coef} div {kfact}
    /
    
    macro gmreq
     set gmreq=9999
     set maxvcg=-9999
     heel 0 | trim 0
     draft {draft}
     solve weight, lcg
     set q = {FREEBD}
     template t "Error"
      "Freeboard ({q}) is {t}."
     //
     .checkval "{q}" 0.0001 9999 | if "{t}"<>"" then .t | exit
     set q1 = {coef} div {q}
     set q = {WEIGHT}
     template t "Error"
      "Displacement ({q}) is {t}."
     //
     .checkval "{q}" 0.5 9999999 | if "{t}"<>"" then .t | exit
     set gmreq = {q1} div {q}
     set maxvcg = {BMT} plus {VCB} minus {gmreq}
    /
    
    template whatsfr
     "s is that fraction of the projected propeller circle"
     "that would be intercepted by the rudder turned 45 degrees"
     "from centerline."
    /
    template whathar
     "h is the vertical distance from propeller shaft centerline"
     "at rudder to the towing bitts."
    /
    
    template dialog "46 CFR 173.096 (b) Wizard"
     ""                        |  "About" .about /noverify
     "Number of propellers (N)"   nprop
     "Shaft power per shaft (P)"  power    | "{powunit}"
     "Propeller diameter (D)"     diam     | "{lenunit}"
     "s"                          sfract   | "?" .whatsfr /noverify
     "h"                          harm     | "?" .whathar /noverify
     "Molded beam (B)"            beam     | "{lenunit}"
     "Least draft"                draft1   | "{lenunit}"
     "Greatest draft"             draft2   | "{lenunit}"
     "Number of draft increments" ndrafts
     ""                        | "Report" .calc
    /
    
    macro rephead
     \     Draft        Displ       Freebd      GM req     max VCG\
     \------------------------------------------------------------\
    /
    
    macro report
     \{ draft:3}  { WEIGHT:1}  { FREEBD:3} {  gmreq:3} { maxvcg:3}\
    /
    
    macro dodraft
     if {n}=0 then exit
     .gmreq
     .report
     set draft={draft} plus {ddraft}
     set n = {n} minus 1
    /
    
    macro calc
     report {proj}.pf
     \\\\GM required according to CFR 173.095 (b)\
     \\N = {nprop}  P = {power} {powunit}  D = {diam:2} {lenunit}\
     \\s = {sfract:3}  h = {harm:2} {lenunit}  B = {beam:2} {lenunit}\
     \
     set ddraft={draft2} minus {draft1} div {ndrafts}
     set draft={draft1}
     set n={ndrafts}
     .rephead
     .coef
     .dodraft(50)
     \---------------- Displacement in {WUNIT} ----------------\
     view
     report off
     template t "Note"
      "You can print this report through the Report pulldown menu."
      "The report file name is {proj}.pf"
      "Ok" EXIT
     //
     .t
    /
    
    macro metric
     set powunit="kilowatts"
     set lenunit="meters"
     set kfact=13.93
    /
    macro english
     set powunit="horsepower"
     set lenunit="feet"
     set kfact=38.0
    /
    
    macro dodialog
     screen nohead
     me "46 CFR 173.095 (b) Wizard\
     .dialog
     if {templok}=0 then exit
     if {cleared}<>0 then exit
     .save
    /
    
    macro init
     set nprop=1
    /
    
    macro esc
     template t "Error"
      "Error encountered in running {proj}.sav."
      "Restart" "Exit" EXIT
     //
     macro recover
      set error=0
      erase {proj}.sav
      run {self}
     //
     .t
     if {templok}<>0 then exit recover
    /
    if fexist {proj}.sav then .readsave /call else .init
    macro esc
    /
    
    if "{LUNIT}"="FEET" then .english else .metric
    
    if "{gf}"="" then .readgf
    if "{gf}"<>"" then .dodialog
    
    clear macros
    clear variables
    macro restore
     run temp.old /call
     template t "Note"
      "Original condition restored."
     //
     .t
    /
    if {templok}=0 then .restore
    macro restore
    /
    run temp.mac /call
    scr head
    erase temp.mac
    erase temp.old
    
    
    
    

Add a free link to your site
Copyright © , Creative Systems, Inc.