clear unit m macro v variable (len) %1 set %1=%2 %3 %4 %5 %6 %7 %8 %9 / `Specify a barge for the crane: .v BodyLength 85 .v BargeDepth {BodyLength} times 0.08 .v HalfBeam {BodyLength} div 5 .v RakeLength {BodyLength} div 10 .v RakeDepth {RakeLength} div 2 .v HeadHt {BargeDepth} times 1.2 `Landing spot for the cargo: .v Lfv {BodyLength} times 0.67 read FV.GF .v Dfv 15 draft 6 solve weight variable (we) Wfv={WEIGHT} .v SunkDepth {BodyLength} div 4 ENTER PM `First make a sail-part substitute for the FV hull so we can move it visually. create fvwrap class sail ends -50, 50 top 20 bot 0 out 20 spacing 1 fit (int) hull comp ends -50, 0 top 30 bot 0 out 20 fit (int) hull\focsle.c / WRITE temp.gf QUIT PM unit m ENTER PM delete hull surface (fvwrap) unit=m shift {Lfv},0,{BargeDepth} modify fvwrap ref {Lfv},0,{BargeDepth} / `Now make the barge: CREATE HULL class hull ends 0, {BodyLength} out {HalfBeam} bot 0 top {BargeDepth} comp fr top {BargeDepth} bot 0 @ 0, {RakeDepth} @ -{RakeLength} out {HalfBeam} spacing 1 join hull comp focsle ends 0, -{RakeLength} top {HeadHt} bot {bargeDepth} out {HalfBeam} comp ar top {BargeDepth} bot {RakeDepth} @ {RakeLength}, 0 @ 0 out {HalfBeam} vector {BodyLength},0,0 spacing 1 join hull / write temp.gf QUIT PM `Crane specification: .v PedistalDiam {BargeDepth} .v PedistalHt {HalfBeam} .v PedistalTop {BargeDepth} plus {PedistalHt} .v BoomBaseL {BodyLength} times 0.2 .v HouseHt {PedistalHt} div 2 .v BoomBaseV {HouseHt} div 2 plus {PedistalTop} .v HouseTop {PedistalTop} plus {HouseHt} .v BoomLength {BodyLength} times 0.6 .v BoomOverPin {BoomLength} times 0.05 .v BoomLoc8L {BoomBaseL} minus {BoomOverPin} .v BoomDepth1 {BoomLength} div 7.5 .v BoomDepth2 {BoomDepth1} div 2.5 .v BoomUnderPin {BoomDepth1} div 2 .v BoomHalfWidth {BoomDepth2} div 2 .v BoomLoc8V {BoomBaseV} minus {BoomUnderPin} .v RamPin2Off {BoomLength} minus {BoomOverPin} div 3 .v RamPinRadius 1 .v RamPinDiam {RamPinRadius} times 2 .v RamPin2D {BoomUnderPin} plus {RamPinRadius} .v RamPin1Off {PedistalDiam} div 2 plus {RamPinRadius} .v x {RamPin2Off} minus {RamPin1Off} .v RamPin1V {BoomBaseV} minus {RamPin2D} minus {x} .v PedistalBaseD {PedistalDiam} times 1.25 .v PedistalBaseTop {RamPin1V} minus {RamPinDiam} .v RamDiam1 {PedistalDiam} div 3 .v RamDiam2 {RamDiam1} div 2 .v SheaveL {Lfv} .v SheaveV {BoomLoc8V} v (we) BoomWeight | set BoomWeight={BoomDepth1} plus {BoomDepth2} times {BoomHalfWidth} times {BoomLength} times 4 .v BoomCG {BoomLength} minus {BoomOverPin} times 0.3 `Macro to calculate ram pin locations at given boom swing and topping angles: macro ram1 `%1: swing; %2: topping variables L1,L2,T1,T2,V1,V2 BOOM "rampin2" 0, {BoomBaseL}, 0, {BoomBaseV}, {RamPin2Off}, %1, %2, 0, {RamPin2D}, 90 ADD "rampin2" *, L2, T2, V2 /ACCESS delete "rampin2" BOOM "rampin1" 0, {BoomBaseL}, 0, {RamPin1V}, {RamPin1Off}, %1, 0 ADD "rampin1" *, L1, T1, V1 /ACCESS delete "rampin1" / `In addition to pin locations, calculate ram angle and length: macro ram .ram1 0, %2 variables dL, dV set dL = {L2} minus {L1} set dV = {V2} minus {V1} set x = {dV} div {dL} set x = atan {x} variable RamAngle={x} set dL={dL} times {dL} set dV={dV} times {dV} set x={dL} plus {dV} set x=sqrt {x} minus {RamPinRadius} minus {RamPinRadius} variable (len) RamLength={x} set x={RamLength} plus {RamPinRadius} variable (len) RamLengthPlus={x} set x={RamLength} minus {RamPinDiam} variable (len) RamLengthMinus={x} .ram1 %1, %2 / .ram 0, 0 .v Ram1Length {RamLength} .v RamPin2L {L2} .v RamPin2V {V2} .v RamPin1L {L1} .v MastHt {BoomLength} times 0.75d .v MastTop {MastHt} plus {HouseTop} ENTER PM CREATE BOOM class sail ends 0, {BoomLength} top {BoomDepth1} @ 0, {BoomDepth2} @ {BoomLength} bot 0 out {BoomHalfWidth} vector {BoomLoc8L},0,{BoomLoc8V} ref {BoomBaseL},0,{BoomBaseV} comp rampin2 cyl {RamPin2L},0,{RamPin2V}, {RamPin2L},{BoomHalfWidth},{RamPin2V}, {RamPinDiam} / surface (boom) CREATE RAM1 class sail cyl (32) {RamPin1L},0,{RamPin1V}, 99,0,{RamPin1V} diam {RamDiam1} @ {RamPinRadius}, {RamDiam1} @ {RamLengthMinus} comp rampin1 cyl {RamPin1L},0,{RamPin1V}, {RamPin1L},{RamPinDiam},{RamPin1V}, 3 ref {RamPin1L}, 0, {RamPin1V} / surface (ram1) CREATE RAM2 class sail cyl (16) {RamPin1L},0,{RamPin1V}, 99,0,{RamPin1V} diam {RamDiam2} @ {RamPinRadius}, {RamDiam2} @ {RamLengthPlus} ref {RamPin1L}, 0, {RamPin1V} / surface (ram2) CREATE SHEAVE class sail cyl {SheaveL},0,{SheaveV}, {SheaveL}, {RamPinRadius}, {SheaveV}, {RamPinDiam} ref {SheaveL},0,{SheaveV} / surface (sheave) CREATE ROPE clas sail cyl {SheaveL},0,{SheaveV}, 1, 0,0, 0.1, LST ref {SheaveL},0,{SheaveV} / surface (rope) CREATE HOOK class sail sphere {SheaveL},0,{SheaveV}, 1.0 ref {SheaveL},0,{SheaveV} / surface (hook) CREATE PEDISTAL class sail cyl (24) {BoomBaseL},0,{PedistalBaseTop}, {BoomBaseL},0,{PedistalTop}, {PedistalDiam} ref {BoomBaseL},0,{BargeDepth} comp house ends -5, 5 top {HouseTop} bot {PedistalTop} out 5 vector {BoomBaseL},0,0 comp boompin cyl (24) {BoomBaseL},5,{BoomBaseV}, {BoomBaseL},0,{BoomBaseV}, 4 / surface (pedistal) create pedistalbase class hull cyl (16) {BoomBaseL},0,{BargeDepth}, {BoomBaseL},0,{PedistalBaseTop}, {PedistalBaseD} / CREATE MAST class sail cyl {BoomBaseL},0,{HouseTop}, {MastHt},0,90,0.3, LST / create light class sail sphere {BoomBaseL},0,{MastTop}, 1.5 / surface (light) CREATE ANCHOR class sail cyl -{RakeLength},0,{BargeDepth}, -30,0,-30, 0.01 / write temp.gf QUIT PM `Barge wt & CG: set x={BargeDepth} div 2 depth {x} set x={BargeDepth} vcg {x} BOOM "Boom Weight" {BoomWeight}, {BoomBaseL},0,{BoomBaseV}, {BoomCG}, 0, 0 solve weight, lcg `Color assignments type (fvwrap,hook,rope) set /color:8 type (light) set /color:12 type (pedistal) set /color:3 type (boom) set /color:14 type (ram1) set /color:12 type (ram2) set /color:13 type (sheave) set /color:11 macro di1 display status profile:outboard:withsail /max /sync / macro di2 display status /update wait {delay} / variable t macro crane `%1: swing angle; %2: topping angle; %3: hook drop; %4: hook load; %5: hookswing type (pedistal) set /SWING:%1 type (boom) set /TOP:%2 /SWING:%1 BOOM "Boom Weight" {BoomWeight}, {BoomBaseL},0,{BoomBaseV}, {BoomCG}, %1, %2 /nowarn set x={SheaveL} minus {BoomBaseL} set t=%4 if {t}<0 then set t=0 BOOM "HookLoad" {t}, {BoomBaseL},0,{BoomBaseV}, {x}, %1, %2, 0, {BoomUnderPin}, 90 /nowarn solve ADD "HookLoad" *, L1, T1, V1 /ACCESS type (sheave) set /MOVE:{L1},{T1},{V1} /SWING:%1 type (rope) set /MOVE:{L1},{T1},{V1} /TOP:-90 /SCALE:%3 variable (len) SheaveHt={V1} BOOM "hook" 0, {L1},{T1},{V1}, %3, 0, -90 ADD "hook" *, L1,T1,V1 /ACCESS delete "hook" type (hook) set /MOVE:{L1},{T1},{V1} BOOM "fvwrap" 0, {L1},{T1},{V1}, {Dfv}, 0, -90 ADD "fvwrap" *, L1,T1,V1 /ACCESS delete "fvwrap" if %4=0 then type (fvwrap) unset else if %4>0 then type (fvwrap) set /MOVE:{L1},{T1},{V1} /SWING:%5 if %4<0 then set x={Wfv} else set x=0 ADD "FVweight" {x}, {Lfv},0,{BargeDepth} /nowarn .ram %1, %2 type (ram*) set /TOP:{RamAngle} /SWING:%1 /MOVE:{L1},{T1},{V1} set x={RamLength} div {Ram1Length} type (ram2) set /SCALE:{x} / .crane 0,0, 10, 0, 0 set x={BargeDepth} times 0.4 draft {x} solve weight, lcg vcg {BargeDepth} macro light if {light}=3 then type (light) set /color:8 if {light}=6 then type (light) set /color:12 | set light=0 set light={light} plus 1 / macro lift .crane {swing}, {top}, {drop}, {hookload}, {hookswing} .light .di2 / macro plus set %1={%1} plus {d%1} if {%1}>%2 then set %1=%2 .lift if {%1}<%2 then exit plus %1, %2 / macro minus set %1={%1} minus {d%1} if {%1}<%2 then set %1=%2 .lift if {%1}>%2 then exit minus %1, %2 / macro swingout .plus swing, %1 / macro swingin .minus swing, %1 / macro hookswing .plus hookswing, %1 / macro unhookswing .minus hookswing, %1 / macro topup .plus top, %1 / macro topdown .minus top, %1 / macro dropdown .plus drop, %1 / macro dropup .minus drop, %1 / macro blink .light .di2 / variable light=0 variable (we) hookload=0 variable swing=0, dswing=1 variable top=0, dtop=1 variable (le) drop10 | set drop10={PedistalHt} div 2 variable (le) drop15 | set drop15={drop10} times 1.5 variable (le) drop5 | set drop5={drop10} times 0.5 variable (le) drop={drop10}, ddrop=0.5 variable hookswing=0, dhookswing=2.5 variable delay=0.1 screen min .di1 .blink (20) .topup 20 .swingout 110 .swingin 80 .topdown 0 set x={SheaveHt} plus {SunkDepth} .dropdown {x} set hookload={Wfv} .dropup {drop10} .topup 40 .swingin 45 .topdown 20 .swingin 0 .topdown 0 .hookswing 45 .unhookswing 0 set x={SheaveHt} minus {BargeDepth} minus {Dfv} .dropdown {x} set hookload=-1 .dropup {drop15} .topup 30 .blink (15) template ohno "Oh No!" /bg:4 "We didn't get a salvage permit." / .ohno set x={SheaveHt} minus {BargeDepth} minus {Dfv} .dropdown {x} set hookload={Wfv} .dropup {drop15} .swingout 90 set x={SheaveHt} plus {SunkDepth} .dropdown {x} set hookload=0 .dropup {drop15} .swingin 0 .topdown 0 .dropup {drop5} .blink (50) end