Skip to content

Commit 0cf170f

Browse files
committed
IRMA: Adding a couple more tasks in the staged strategy
1 parent 36d1ac1 commit 0cf170f

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

famodel/irma/irma.py

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,11 @@ def visualizeActions(self):
311311
if len(longest_path)>=1:
312312
last_node = longest_path[-1] # Identify last node of the longest path
313313
# Define layout
314-
pos = nx.shell_layout(G)
314+
pos = nx.shell_layout(G)
315315
# Draw all nodes and edges (default gray)
316-
nx.draw(G, pos, with_labels=True, node_size=500, node_color='skyblue', font_size=10, font_weight='bold', font_color='black', edge_color='gray')
316+
nx.draw(G, pos, with_labels=True, node_size=500,
317+
node_color='skyblue', font_size=10, font_weight='bold',
318+
font_color='black', edge_color='gray')
317319

318320
# Highlight longest path in red
319321
nx.draw_networkx_edges(G, pos, edgelist=longest_path_edges, edge_color='red', width=2)
@@ -450,16 +452,56 @@ def implementStrategy_staged(sc):
450452
act_sequence[acts[i].name] = []
451453
else: # remaining actions are just a linear sequence
452454
act_sequence[acts[i].name] = [ acts[i-1].name ] # (previous action must be done first)
455+
456+
# create the task, passing in the sequence of actions
453457
sc.addTask(acts, act_sequence, 'install_all_anchors')
454458

455459
# ----- Create a Task for all the mooring installs -----
456460

461+
# gather the relevant actions
462+
acts = []
463+
# first load each mooring
464+
for action in sc.actions.values():
465+
if action.type == 'load_mooring':
466+
acts.append(action)
467+
# next lay each mooring (eventually route logic could be added)
468+
for action in sc.actions.values():
469+
if action.type == 'lay_mooring':
470+
acts.append(action)
457471

472+
# create a dictionary of dependencies indicating that these actions are all in series
473+
act_sequence = {} # key is action name, value is a list of what action names are to be completed before it
474+
for i in range(len(acts)):
475+
if i==0: # first action has no dependencies
476+
act_sequence[acts[i].name] = []
477+
else: # remaining actions are just a linear sequence
478+
act_sequence[acts[i].name] = [ acts[i-1].name ] # (previous action must be done first)
479+
480+
# create the task, passing in the sequence of actions
481+
sc.addTask(acts, act_sequence, 'install_all_moorings')
458482

459483

460484
# ----- Create a Task for the platform tow-out and hookup -----
461485

486+
# gather the relevant actions
487+
acts = []
488+
# first tow out the platform
489+
acts.append(sc.actions['tow'])
490+
# next hook up each mooring
491+
for action in sc.actions.values():
492+
if action.type == 'mooring_hookup':
493+
acts.append(action)
494+
495+
# create a dictionary of dependencies indicating that these actions are all in series
496+
act_sequence = {} # key is action name, value is a list of what action names are to be completed before it
497+
for i in range(len(acts)):
498+
if i==0: # first action has no dependencies
499+
act_sequence[acts[i].name] = []
500+
else: # remaining actions are just a linear sequence
501+
act_sequence[acts[i].name] = [ acts[i-1].name ] # (previous action must be done first)
462502

503+
# create the task, passing in the sequence of actions
504+
sc.addTask(acts, act_sequence, 'tow_and_hookup')
463505

464506

465507

0 commit comments

Comments
 (0)