`Finding the angle Theta3, where A2 = A1 as in the RINA Cargo Loss criterion.
`In this run file, the TCG of the vessel is set to create conditions during
`lifting and after the cargo loss. Since the effect of TCG varies with the
`cosine of the heel angle it is equivalent to setting a cosine based heeling
`When using this method, the run file should either set up actual loading
`conditions with and without the crane load, or use a heeling moment to represent
`the counterballast weights. Keep in mind that the equilibrium angle during
`lifting is saved as variable t1 and is necessary to evaluate the criteria.

proj theta3
read subdivy
crt(1) Vent 25a, 5s, 11 /sym
draft 6
vcg 8
solve weight lcg

macro findt3 `finds Theta3, then evaluates RINA Cargo Loss
macro t3 `incrementally adjust t3 until t < 0.05
lim title --Find Angle Theta3----------
lim(1) res ratio from abs {t1} to abs {t3} > 1
ra /lim /noprint
\limmarg: {limmarg}; t3: {t3}; t: {t} `prints iteration history
if {t} < 0.005 then exit
if {limmarg}>0 then set t3={t3} minus {t} else set t3={t3} plus {t}
set t={t} times 0.5
exit t3
variable t3=30 `theta3-terminating angle for res ratio limit
variable t `amount to increment or decrement t3
set t={t3} div 2
lim off
\\Theta3 is {t3:1} degrees, as demonstrated below.\
ra /lim:att /graph:none `/stop:fld
if {t3}>30 then set t3=30 | ,,
\Theta3 not to be taken greater then 30, therefore Theta3=30\
lim off
limit title RINA Pt E, Ch 19, Sec 2: 2.2.3
lim(1) res ratio from abs {t1} to FLD or RA0 > 1
lim(2) angle from abs {t3} to FLD or RA0 > 20
ra /lim:att /stop:fld

tcg=.5 `Simulate lifting condition - hook load on starboard side
variable t1={heel} `Equilibrium heel angle during lifting

tcg=-1.5 `Simulate dropped load condition - counterballast on port side
`Setting angles direction and sign of starting angle, t1, if RAH to port.
`(Righting arm direction is determined by equilibrium angles before and
` after the hook load is dropped. When the righting arm is to port, ABS
` angles are the opposite of the normal sign convention, which is +=STBD.
` Angles * is not sufficient to direct the righting arm direction for all
` combinations of equilibrium with and without lifting.)
if {t1}>{heel} then angles 0 -5 ... -30 | set t1=minus {t1},,
     else angles 0 5 ... 30

print preview
report off