Skip to content

Commit 831d651

Browse files
committed
Small fixes unload and addCablesConnections; update examples readme
1 parent 384c9b4 commit 831d651

File tree

2 files changed

+42
-11
lines changed

2 files changed

+42
-11
lines changed

examples/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,17 @@ The examples are described below:
77

88
## Numbered Examples
99

10-
The numbered example folders (01-08) contain small isolated examples showing ontologies and driver files for basic functionalities. Within each folder, a number of sub-functionalities are shown individually. Currently, only the 01_Visualization folder is developed, as this is a work in progress.
10+
The numbered example folders (01-08) contain small isolated examples showing ontologies and driver files for basic functionalities. Within each folder, a number of sub-functionalities are shown individually. Currently, only the 01-03 example folders are developed, as this is a work in progress.
11+
The numbered example folders are as follows:
12+
- 01_Visualization : 2D and 3D plotting of various components and array information
13+
- 02_Mooring_Analysis_MoorPy : Run and analyze mooring and cable simulations
14+
- 03_Frequency_Domain_Analysis_RAFT : Run and analyze floating platform/ floating wind simulations
15+
- 04_Geography : Load and set up geographical information such as soils, bathymetry, lease coordinates, etc
16+
- 05_Anchor_Capacity_and_Sizing : Calculate anchor capacity and size anchors to meet safety requirements
17+
- 06_Wakes_Analysis_FLORIS : Run and analyze wind turbine wake simulations
18+
- 07_Cost_Analysis : Calculate total cost of array components, output spreadsheet breakdown of costs
19+
- 08_Cable_Rerouting : Reroute intra-array cables around mooring lines and anchors
20+
- 09_Failure_Analysis : Run a failure analysis of the array
1121

1222
## FAModel project from a yaml file example
1323
This example shows how to make an FAModel project from a yaml file. The sample shows various possibilities for mooring and anchoring including shared moorings and shared anchors. It also shows some functionalities of FAModel including:

famodel/project.py

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,6 @@ def loadSite(self, site):
845845
self.grid_x = np.array(site['bathymetry']['x'])
846846
self.grid_y = np.array(site['bathymetry']['y'])
847847
self.grid_depth = np.array(site['bathymetry']['depths'])
848-
# breakpoint()
849848
# self.setGrid(xs,ys)
850849
else:
851850
# assume a flat bathymetry
@@ -1000,8 +999,6 @@ def seabedIntersect(self, r, u):
1000999

10011000
r_i = r_i + u*fac # updated seabed crossing estimate
10021001

1003-
if any(np.isnan(r_i)):
1004-
breakpoint()
10051002

10061003
return r_i
10071004

@@ -1734,7 +1731,8 @@ def cableDesignInterpolation(self,depth,cables):
17341731
def addCablesConnections(self,connDict,cableType_def='dynamic_cable_66',oss=False,
17351732
substation_r=[None],ss_id=200,id_method='location',
17361733
keep_old_cables=False, connect_ss=True,
1737-
cableConfig=None, configType=0,heading_buffer=30):
1734+
cableConfig=None, configType=0,heading_buffer=30,
1735+
route_anchors=True):
17381736
'''Adds cables and connects them to existing platforms/substations based on info in connDict
17391737
Designed to work with cable optimization output designed by Michael Biglu
17401738
@@ -1868,7 +1866,7 @@ def addCablesConnections(self,connDict,cableType_def='dynamic_cable_66',oss=Fals
18681866

18691867

18701868
# create cable object
1871-
cab = Cable(cableType_def+str(i+lcab),d=dd)
1869+
cab = Cable('cable'+str(i+lcab),d=dd)
18721870
self.cableList[cab.id] = cab
18731871

18741872
# update upstream turbines property
@@ -1930,7 +1928,10 @@ def addCablesConnections(self,connDict,cableType_def='dynamic_cable_66',oss=Fals
19301928
# update routing
19311929
cab.subcomponents[cs].updateRouting(coords) # also updates static and general cable lengths
19321930

1933-
route_around_anchors(self)
1931+
1932+
if route_anchors:
1933+
route_around_anchors(self)
1934+
19341935

19351936

19361937
def updatePositions(self):
@@ -3832,21 +3833,27 @@ def unload(self,file='project.yaml'):
38323833
mapAnchNames = {}
38333834
mscs = {}
38343835
arrayMoor = []
3836+
pf_types = []
38353837
for i,anch in enumerate(self.anchorList.values()):
38363838
newanch = True
38373839
name = anch.dd['name'] if 'name' in anch.dd else str(len(anchConfigs))
38383840
if len(anch.attachments)>1:
38393841
# shared anchor, add to arrayAnch list
38403842
arrayAnch.append([anch.id,name,anch.r[0],anch.r[1],0])
3843+
# add mass if available
3844+
aad = deepcopy(anch.dd['design'])
3845+
if anch.mass is not None and anch.mass>0:
3846+
aad['mass'] = anch.mass
3847+
if 'type' in anch.dd:
3848+
aad['type'] = anch.dd['type']
38413849
if anchConfigs:
3842-
ac = [an for an,ad in anchConfigs.items() if ad==anch.dd['design']]
3850+
ac = [an for an,ad in anchConfigs.items() if ad==aad]
38433851
if len(ac)>0:
38443852
newanch = False
38453853
name = ac[0] # reset name to matching config name
38463854
if newanch:
3847-
anchConfigs[name] = dict(anch.dd['design'])
3848-
if anch.mass is not None and anch.mass>0:
3849-
anchConfigs[name]['mass'] = anch.mass
3855+
anchConfigs[name] = aad
3856+
38503857
mapAnchNames[anch.id] = name
38513858

38523859
# build out platform info
@@ -3933,6 +3940,20 @@ def unload(self,file='project.yaml'):
39333940
mscs[mname] = msys
39343941
else:
39353942
mname = 0
3943+
3944+
if not 'type' in pf.dd:
3945+
pf_type_info = [pf.rFair, pf.zFair, pf.entity]
3946+
if not pf_type_info in pf_types:
3947+
pf_types.append(pf_type_info)
3948+
if not self.platformTypes:
3949+
self.platformTypes = []
3950+
pf.dd['type'] = len(self.platformTypes)
3951+
self.platformTypes.append({'rFair': pf.rFair,
3952+
'zFair': pf.zFair,
3953+
'type': pf.entity})
3954+
else:
3955+
tt = [n for n,ps in enumerate(pf_types) if ps==pf_type_info]
3956+
pf.dd['type'] = tt[0]
39363957

39373958

39383959

0 commit comments

Comments
 (0)