!********************************************************** !* MACRO GEOMETRY MODULE el_lys(); !* Displays a LYS estimate according to the !* formula developed by Erik Lindskog. (el@signal.uu.se) !* !* If one or more of the neccessary data is defined !* in the model this data is used. Data not defined !* is requested from the user. !* !* LOA and MAXBEAM are calculated by the hull module. !* DISPLACEMENT is calculated by the hydrstat module. !* SAILAREA is not yet implemented. !* !* If no hull is defined none of these values exist !* and the user will have to enter all values. !* If a hull is defined LOA and MAXBEAM exist. !* If a displacement analysis has been done also !* DISPLACEMENT exists. !* !* The purpose of this construction is to make it !* possible to make LYS estimates without having !* defined all neccesary data. !* !* (C)Microform AB 1998-09-23, J.Kjellander !* !********************************************************** INT status; FLOAT lys,sa(1),loa(1),beam(3),disp(4); STRING s*10; BEGINMODULE !* !***Get SA, LOA, BEAM and DISPLACEMENT. If not yet defined !***in the model ask the user for approximate values instead. !* !* !***SAILAREA. !* status:=getdat_gm("SAILAREA",sa); if status < 0 then loop1: psh_pmt("Erik Lindskogs LYS estimate !"); s:=inpmt("Sailarea not defined, enter approx. value in square meters !", "",10); pop_pmt(); if s = "" then exit(); else sa(1):=fval(s,status)*1E6; if status < 0 then goto loop1; endif; endif; endif; !* !***LOA. !* status:=getdat_gm("LOA",loa); if status < 0 then loop2: psh_pmt("Erik Lindskogs LYS estimate !"); s:=inpmt("LOA not defined, enter approx. value in meters !", "",10); pop_pmt(); if s = "" then exit(); else loa(1):=fval(s,status); if status < 0 then goto loop2; endif; endif; endif; !* !***MAXBEAM. !* status:=getdat_gm("MAXBEAM",beam); if status < 0 then loop3: psh_pmt("Erik Lindskogs LYS estimate !"); s:=inpmt("Beam not defined, enter approx. value in meters !", "",10); pop_pmt(); if s = "" then exit(); else beam(3):=fval(s,status); if status < 0 then goto loop3; endif; endif; endif; !* !***DISPLACEMENT. !* status:=getdat_gm("DISPLACEMENT",disp); if status < 0 then loop4: psh_pmt("Erik Lindskogs LYS estimate !"); s:=inpmt("Displacement not defined, enter approx. disp. in kilos !", "",10); pop_pmt(); if s = "" then exit(); else disp(1):=fval(s,status); if status < 0 then goto loop4; endif; endif; endif; !* !***Calculate Erik Lindskogs LYS estimate. !* part(#1,calellys(loa(1)/1E3,beam(3)/1E3,disp(1)/1E9/1E3,sa(1)/1E6,lys)); !* !***Display result. !* lst_ini("Erik Lindskogs LYS-estimate !"); lst_lin("LOA = "+str(loa(1)/1E3,-8,2)+"meters"); lst_lin("Beam = "+str(beam(3)/1E3,-8,2)+"meters"); lst_lin("Displacement = "+str(disp(1)/1E9,-8,3)+"kilos"); lst_lin("Sailarea = "+str(sa(1)/1E6,-8,1)+"square meters"); lst_lin(""); lst_lin("LYS estimate = "+str(lys,-1,2)); lst_exi(); ENDMODULE !**********************************************************