Skip to content

Commit 5d49360

Browse files
committed
Update on vessels day rates, visualizeActions, and action naming in main irma example:
- The __main__ example in irma takes the keyname of the objects and assign it to the name of the action. - irma checks for duplicate action names and flag a warning in registerAction method, - day rates of various vessels obtained from ORBIT and other sources are provided in the vessels.yaml file, - Updating visualizeActions method to give equal axis and showcase action starters with a green colored node.
1 parent 19c2591 commit 5d49360

File tree

2 files changed

+30
-16
lines changed

2 files changed

+30
-16
lines changed

famodel/irma/irma.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,11 @@ def registerAction(self, action):
198198

199199
# this also handles creation of unique dictionary keys
200200

201-
while action.name in self.actions: # check if there is already a key with the same name
201+
if action.name in self.actions: # check if there is already a key with the same name
202+
raise Warning(f"Action '{action.name}' is already registered.")
202203
print(f"Action name '{action.name}' is in the actions list so incrementing it...")
203204
action.name = increment_name(action.name)
204-
205+
205206
# What about handling of dependencies?? <<< done in the action object,
206207
# but could check that each is in the list already...
207208
for dep in action.dependencies.values():
@@ -275,6 +276,16 @@ def visualizeActions(self):
275276
plt.text(pos[last_node][0], pos[last_node][1] - 0.1, f"{total_duration:.2f} hr", fontsize=12, color='red', fontweight='bold', ha='center')
276277
else:
277278
pass
279+
plt.axis('equal')
280+
281+
# Color first node (without dependencies) green
282+
i = 0
283+
for node in G.nodes():
284+
if G.in_degree(node) == 0: # Check if the node has no incoming edges
285+
nx.draw_networkx_nodes(G, pos, nodelist=[node], node_color='green', node_size=500, label='Action starters' if i==0 else None)
286+
i += 1
287+
plt.legend()
288+
return G
278289

279290

280291

@@ -326,38 +337,38 @@ def findCompatibleVessels(self):
326337

327338
# Parse out the install steps required
328339

329-
for anchor in project.anchorList.values():
340+
for akey, anchor in project.anchorList.items():
330341

331342
# add and register anchor install action(s)
332-
a1 = sc.addAction('install_anchor', 'install_anchor-1', objects=[anchor])
333-
a1.evaluateAssets({'operator' : sc.vessels["MPSV_01"]}) # example assignment to test the code.
343+
a1 = sc.addAction('install_anchor', f'install_anchor-{akey}', objects=[anchor])
344+
a1.evaluateAssets({'carrier' : sc.vessels["MPSV_01"]})
334345

335346
# register the actions as necessary for the anchor <<< do this for all objects??
336347
anchor.install_dependencies = [a1]
337348

338349

339350
hookups = [] # list of hookup actions
340351

341-
for mooring in project.mooringList.values():
352+
for mkey, mooring in project.mooringList.items():
342353

343354
# note origin and destination
344355

345356
# --- lay out all the mooring's actions (and their links)
346357
# create load vessel action
347-
a2 = sc.addAction('load_mooring', 'load_mooring', objects=[mooring])
358+
a2 = sc.addAction('load_mooring', f'load_mooring-{mkey}', objects=[mooring])
348359

349360
# create ship out mooring action
350361

351362
# create lay mooring action
352-
a3 = sc.addAction('lay_mooring', 'lay_mooring', objects=[mooring], dependencies=[a2])
363+
a3 = sc.addAction('lay_mooring', f'lay_mooring-{mkey}', objects=[mooring], dependencies=[a2])
353364
sc. addActionDependencies(a3, mooring.attached_to[0].install_dependencies) # in case of shared anchor
354365

355366
# mooring could be attached to anchor here - or could be lowered with anchor!!
356367
#(r=r_anch, mooring=mooring, anchor=mooring.anchor...)
357368
# the action creator can record any dependencies related to actions of the anchor
358369

359370
# create hookup action
360-
a4 = sc.addAction('mooring_hookup', 'mooring_hookup',
371+
a4 = sc.addAction('mooring_hookup', f'mooring_hookup-{mkey}',
361372
objects=[mooring, mooring.attached_to[1]], dependencies=[a2, a3])
362373
#(r=r, mooring=mooring, platform=platform, depends_on=[a4])
363374
# the action creator can record any dependencies related to actions of the platform
@@ -374,7 +385,7 @@ def findCompatibleVessels(self):
374385

375386
# ----- Do some graph analysis -----
376387

377-
sc.visualizeActions()
388+
G = sc.visualizeActions()
378389

379390

380391

famodel/irma/vessels.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ AHTS_alpha:
4848
install_semisub: {}
4949
install_spar: {}
5050
install_tlp: {}
51+
day_rate: 107187 # USD/day taken from ORBIT: https://github.com/WISDEM/ORBIT/blob/dev/library/vessels/example_ahts_vessel.yaml
5152

5253
# --- Multipurpose Support Vessel ---
5354

@@ -93,6 +94,7 @@ MPSV_01:
9394
lay_mooring: {}
9495
install_wec: {}
9596
monitor_installation: {}
97+
day_rate: 122699 # USD/day taken from ORBIT (for support vessel: https://github.com/WISDEM/ORBIT/blob/dev/library/vessels/example_support_vessel.yaml)
9698

9799
# --- Construction Support Vessel ---
98100

@@ -145,7 +147,7 @@ CSV_A:
145147
lay_cable: {}
146148
lay_and_bury_cable: {}
147149
monitor_installation: {}
148-
150+
day_rate: 122699 # USD/day taken from ORBIT (for support vessel: https://github.com/WISDEM/ORBIT/blob/dev/library/vessels/example_support_vessel.yaml)
149151
# --- ROV Support Vessel ---
150152

151153
ROVSV_X:
@@ -180,7 +182,7 @@ ROVSV_X:
180182
actions:
181183
monitor_installation: {}
182184
site_survey: {}
183-
185+
day_rate: 52500 # USD/day taken from a Nauticus Robotics post on X: https://x.com/nautrobo/status/1840830080748003551
184186
# --- Diving Support Vessel ---
185187

186188
DSV_Moon:
@@ -207,7 +209,7 @@ DSV_Moon:
207209
actions:
208210
monitor_installation: {}
209211
site_survey: {}
210-
212+
day_rate: x # USD/day (research needed)
211213
# --- Heavy Lift Vessel ---
212214

213215
HL_Giant:
@@ -235,7 +237,7 @@ HL_Giant:
235237
transport_components: {}
236238
install_wec: {}
237239
install_wtg: {}
238-
240+
day_rate: 624612 # USD/day taken from Orbit: https://github.com/WISDEM/ORBIT/blob/dev/library/vessels/example_heavy_lift_vessel.yaml
239241
# --- Survey Vessel ---
240242

241243
SURV_Swath:
@@ -262,7 +264,7 @@ SURV_Swath:
262264
actions:
263265
site_survey: {}
264266
monitor_installation: {}
265-
267+
day_rate: x # USD/day (research needed)
266268
# --- Barge ---
267269

268270
Barge_squid:
@@ -288,7 +290,7 @@ Barge_squid:
288290
install_anchor: {}
289291
retrieve_anchor: {}
290292
install_wec: {}
291-
293+
day_rate: 147239 # USD/day taken from Orbit: https://github.com/WISDEM/ORBIT/blob/dev/library/vessels/floating_barge.yaml
292294
# --- Rock Installation Vessel ---
293295

294296
ROCK_FallPipe:
@@ -312,3 +314,4 @@ ROCK_FallPipe:
312314
actions:
313315
backfill_rockdump: {}
314316
site_survey: {}
317+
day_rate: x # USD/day (research needed)

0 commit comments

Comments
 (0)