`Demonstrates setting/unsetting of surfaced sail parts to simulate a roll on transfer from
`shore to barge. User must have access to LEw module for interactive tank ballasting
`in conjunction with Roll macro button.

CLEAR
READ BARGE1.GF
TITLE CONDITION: EXAMPLE ROLL-ON OF MODULE

LBP 0,300

WEIGHT = 1.3@0,2.6@5,3.9@10,5.2@15,6.5@25,6.5@297,6@300
WEIGHT *,154.1,0,11.5


VARI MOVE=200 `Initial movement of module
VARI TWT =1050 `Total cargo weight
VARI DWT =150 `Weight per section
VARI DWT1 `Receives weight of current section
VARI LEN =0 `Distribution length
VARI TLEN = 140 `Total length
VARI STEP:0:7=7 `Number of steps
VARI MLOC = 150 `LCG of cargo
VARI M1=20 `Distance moved per step
VARI X = 1 `Iteration number
VARI T `Set to 1 if user has CG module
SET MLOC = {MLOC} PLUS {TLEN}


MACRO DI
DI(*)STATUS PROFILE:WITHSAILS, PLAN:WITHSAILS %1
/


MACRO CGCHECK
`Utility macro to verify if user has Condition Graphics Module
template failure
"Condition Graphics is not part of your GHS configuration,"
"therefore graphics will not be included in the report."
"Press OK to continue."
"OK" exit
//
SET ERROR=-1
DI(*)STATUS PROFILE:WITHSAILS, PLAN:WITHSAILS %1
IF {ERROR}=0 THEN .FAILURE
SET ERROR = -1
/



MACRO REPORT
REPORT ROLLON.PF /BOX:COLOR /APPEND
`Check for CG Module for graphic of condition
IF {T} = 1 THEN .DI ELSE .CGCHECK
STATUS WEIGHT CRTPT GROUND WPL /NOREF
LS /NOTABLE:PLOTONLY /PROFILE
CLS
/

MACRO DISTRIB `Distrute weight over length aboard barge
SET LEN = {STEP} TIMES 20 PLUS 140 `300 - 160 + (20 * STEP)
SET DWT1 = {DWT} TIMES {X}
ADD "CARGO" {DWT1}, %1, 0, 36 /LEN:300,{LEN} /NOWARN
TYPE(CARGO.C) SET /MOVE:%2,0,0 /COLOR:2
/

MACRO ROLL `Move object on barge
IF {STEP} = 0 THEN EXIT
.DISTRIB {MLOC},{MOVE}
SOLVE
.REPORT
SET MOVE = {MOVE} MINUS {M1}
SET MLOC = {MLOC} MINUS 10
SET STEP = {STEP} MINUS 1
SET X = {X} PLUS 1
/

.CGCHECK /SYNC `Check for CG module with synchronized condition display
DEPTH=0
`Set up seafloor ground points near loading ramp
GROUND "STRBD-GROUND" *,290,10,0 /PEN:-13.5
ground "PORT-GROUND" *,290,-10,0 /PEN:-13.5

SOLVE

TYPE(CARGO.C) UNSET

`To Use this example without LEw module comment out next line.
LOAD (*) EDIT /AUTO /LS /MACRO:"ROLL" /DISPLAY:PLAN,PROFILE

`To use this example without LEw module remove comment mark from next line
`.ROLL(8)
PRINT PREVIEW