!********************************************************** !* MACRO GEOMETRY MODULE shwcoeff(); !* Displays a list of principle coefficients. !* !* (C)Microform AB 1998-09-23, J.Kjellander !* Stephan Helma !* !********************************************************** INT status; FLOAT k1(1),k2(2),k3(3),k4(4),k6(6); FLOAT displ,wparea,sectarea,lwl,ywl,beam,draught,density; BEGINMODULE !* !***Get the displacement. !* status:=getdat_gm("DISPLACEMENT",k4); if status = 4 then displ:=k4(1); else displ:=-1; endif; !* !***Get the max section area. !* status:=getdat_gm("SECTAREA",k2); if status = 2 then sectarea:=k2(1); else sectarea:=-1; endif; !* !***Get the waterplane area. !* status:=getdat_gm("WPAREA",k6); if status = 6 then wparea:=k6(1); else wparea:=-1; endif; !* !***Get length water line. !* status:=getdat_gm("LWL",k2); if status = 2 then lwl:=k2(1); ywl:=k2(2); else lwl:=-1; endif; !* !***BEAM. !***Max beam at waterline. !* status:=getdat_gm("BEAM",k3); if status = 3 then beam:=k3(3); else beam:=-1; endif; !* !***Get the max draught of the canoe body. !FIXME: Not good programming practice. Store values for MAXDRAUGHT and LWL... ! See shwwldat(). !* status:=getdat_gm("MAXDRAUGHT",k3); if status = 3 then draught:=k2(2)-k3(2); else draught:=-1; endif; !* !***Get the density of water. !* status:=getdat_gm("DENSITY_WATER",k1); if status = 1 then density:=k1(1); else density:=-1; endif; lst_ini("Current design coefficients @ WL ("+str(ywl/1E3,1,3)+"m) !"); !* !***Some very basic coefficients. !* lst_lin("LWL/B Length waterline/beam = "+str(lwl/beam,-8,2)+" -"); lst_lin("LWL/T Length waterline/draught = "+str(lwl/draught,-8,2)+" -"); lst_lin("B/T Beam/draught = "+str(beam/draught,-8,2)+" -"); lst_lin(""); !* !***MMTINERTIA. !***Moments of inertia and metacentric heights !***(longitudinal & transversal). !***BM is repeated from shwwldata() just for convenience. !* if wparea > -1 and displ > 0 then lst_lin("BM Trans. metacentric height = "+str(k6(6)/displ/1E3,-8,3)+" meters"); else lst_lin("BM Trans. metacentric height = "+"Not defined"); endif; lst_lin(""); !* !***cP. !***Prismatic coefficient. !* lst_lin("cP Prismatic coefficient = "+str((displ/(sectarea*lwl)),-8,3)+" -"); !* !***cB. !***Block coefficient. !* lst_lin("cB Block coefficient = "+str(displ/(lwl*beam*draught),-8,3)+" -"); !* !***cM. !***Max sectional area/(TB). !* lst_lin("cM AM coefficient = "+str(sectarea/(beam*draught),-8,3)+" -"); !* !***cWP !* lst_lin("cWP Waterplane coefficient = "+str(wparea/(lwl*beam),-8,3)+" -"); lst_lin(""); !* !***DLRATIO. !***Diplacement/Length waterline ratio. !* lst_lin("LWL/V LWL/Displ^(1/3) ratio = "+str(lwl/(displ**(1.0/3.0)),-8,2)+" -"); lst_lin("D/LWL Diplacement/LWL ratio [ = "+str((displ/1E6/0.4536/2240)/((0.01*lwl/1E3/0.3048)**3),-8,2)+" pounds/ft³ ]"); lst_lin(""); !* !***DISPSPEED. !***Hull speed. !* lst_lin("Vhull Displacement speed = "+str(0.40*sqrt(9.81*lwl/1E3),-8,2)+" m/s"); lst_lin(" [ = "+str(1.34*sqrt(lwl/1E3/0.3048),-8,2)+" knots ]"); lst_lin(""); !* !***TBCOMFORT. !***Ted Brewers comfort factor. !* lst_lin(" Brewers comfort factor = "+str(displ/1E6/0.4536/ (0.65*(0.7*lwl/1E3/0.3048+0.3*53)*(beam/1E3/0.3048)**1.333),-8,1)+" ?"); lst_lin(""); !* !***Wetted area. !***From Larsson/Eliasson p.33 !* lst_lin("Sw Wetted area (estimated) = "+str((1.97+0.171*beam/draught)*sqrt(displ*lwl/1E12)*(0.65/(sectarea/(beam*draught)))**(1.0/3.0),-8,3)+" meters²"); !* !***SIMPSON_SLICES. !***Number of Simpson double slices. !* status:=getdat_gm("SIMPSON_SLICES",k1); if status = 1 then lst_lin(""); lst_lin("< Calculated with "+str(k1(1),-1,0)+" Simpson double slices (2*dx="+str((lwl/1E3)/k1(1),-1,2)+"m). >"); endif; !* !***Density of water. !* if density > 0 then lst_lin("< Density of water = "+str(density*1E9,-6,4)+" kg/m³ >"); else lst_lin("< Density of water = "+"Not defined >"); endif; lst_exi(); ENDMODULE !**********************************************************