Skip to content

Commit 8f78bce

Browse files
committed
Update readme install instructions, small bug fix FLORIS interface, update env yaml for macs
-- readme install instructions updated to be more clear on order of operations -- small bug fix to ensure only platforms with turbines are considered in FLORIS interface -- updated env yaml to work for macs as well as pcs
1 parent 0a5743f commit 8f78bce

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,7 @@ of the Humboldt lease area is shown below.
2121

2222

2323
## Installation
24-
25-
To install FAModel itself, clone the FAModel repository and then enter the
26-
following in the command line from its directory.
27-
28-
For development use:
29-
30-
run ```python setup.py develop``` or ```pip install -e .``` from the command line in the main FAModel directory.
31-
32-
For non-development use:
33-
34-
run ```python setup.py``` or ```pip install .``` from the command line in the main FAModel directory.
24+
To install FAModel itself, first clone the FAModel repository.
3525

3626
The dependencies required by FAModel depend on how it is used. To install all
3727
possible required dependencies, you can create a
@@ -47,6 +37,17 @@ run the following command:
4737
This command will install all the dependencies required to run FAModel.
4838
Activate your virtual environment before using FAModel with ```conda activate famodel-env```
4939

40+
To install the FAModel package in your environment, enter the
41+
following in the command line from the FAModel directory.
42+
43+
For development use:
44+
45+
run ```python setup.py develop``` or ```pip install -e .``` from the command line in the main FAModel directory.
46+
47+
For non-development use:
48+
49+
run ```python setup.py``` or ```pip install .``` from the command line in the main FAModel directory.
50+
5051
** At this time, FAModel requires the latest MoorPy development branch version to be used. **
5152
Therefore, you must install MoorPy with ```git clone https://github.com/NREL/MoorPy.git```
5253
then navigate to the MoorPy folder and checkout the development branch with ```git checkout dev```

examples/example_driver.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#%% Section 1: Project without RAFT
3131
print('Creating project without RAFT\n')
3232
# create project object
33-
project = Project(file=ontology_file,raft=0)
33+
project = Project(file=ontology_file,raft=False)
3434
# create moorpy system of the array, include cables in the system
3535
project.getMoorPyArray(cables=1)
3636
# plot in 3d, using moorpy system for the mooring and cable plots
@@ -40,7 +40,7 @@
4040
#%% Section 2: Project with RAFT
4141
print('\nCreating project with RAFT \n')
4242
#create project object, automatically create RAFT object (and automatically create moorpy system in the process!)
43-
project = Project(file=ontology_file,raft=1)
43+
project = Project(file=ontology_file,raft=True)
4444
# plot in 3d, use moorpy system for mooring and cables, use RAFT for platform, tower, and turbine visuals
4545
project.plot3d(fowt=True,draw_boundary=False,boundary_on_bath=False)
4646

@@ -53,7 +53,6 @@
5353
model.analyzeCases()
5454
# plot results
5555
model.plotResponses()
56-
model.plot()
5756

5857
#%% Section 3: FLORIS
5958
print('Running FLORIS')

famodel-env.yaml

-338 Bytes
Binary file not shown.

famodel/cables/dynamic_cable.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,8 +699,6 @@ def getMG(mgDict):
699699
rAth = 0 # exit while loop when we find thickness at low
700700
count1 = 0 # counter
701701
while rAth==0: # and count1 < len(th):
702-
if count1 == len(th):
703-
breakpoint()
704702
if flip:
705703
if high[2] <= th[count1][2]:
706704
LThick.append(th[count1][0])

famodel/project.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ def loadDesign(self, d, raft=1):
464464
moor.attachTo(platform, end='B')
465465

466466
# reposition mooring
467-
moor.reposition(r_center=platform.r, heading=headings[j]+platform.phi)
467+
moor.reposition(r_center=platform.r, heading=headings[j]+platform.phi, project=self)
468468

469469
# update anchor depth and soils
470470
self.updateAnchor(anch=anch)
@@ -521,7 +521,7 @@ def loadDesign(self, d, raft=1):
521521
# reposition
522522
moor.reposition(r_center=[self.platformList[PFNum[1]].r,
523523
self.platformList[PFNum[0]].r],
524-
heading=headingB)
524+
heading=headingB, project=self)
525525

526526
elif any(ids['ID'] == arrayMooring[j]['endA'] for ids in arrayAnchor): # end A is an anchor
527527
# get ID of platform connected to line
@@ -2027,7 +2027,8 @@ def plot2d(self, ax=None, plot_seabed=True,plot_bathymetry=True, plot_boundary=T
20272027
ax.set_xlabel('X (m)')
20282028
ax.set_ylabel('Y (m)')
20292029
if axis_equal:
2030-
ax.axis('equal')
2030+
ax.set_aspect('equal',adjustable='box')
2031+
20312032
handles, labels = plt.gca().get_legend_handles_labels()
20322033
by_label = dict(zip(labels, handles)) # Removing duplicate labels
20332034
ax.legend(by_label.values(), by_label.keys(),loc='upper center',bbox_to_anchor=(0.5, -0.1), fancybox=True, ncol=4)
@@ -2591,7 +2592,8 @@ def getFLORISMPequilibrium(self, ws, wd, ti, cutin, hubht, plotting = True):
25912592
f = interpolate.interp1d(self.windSpeeds, self.thrustForces)
25922593

25932594
#initialize list of wind speeds (1 wind speed for each turbine)
2594-
nturbs = len(self.platformList)
2595+
turblist = [x.body for x in self.platformList.values() if x.entity.upper()=='FOWT']
2596+
nturbs = len(turblist)
25952597
ws = [ws] * nturbs
25962598

25972599
winds = []
@@ -2602,31 +2604,31 @@ def getFLORISMPequilibrium(self, ws, wd, ti, cutin, hubht, plotting = True):
26022604
for n in range(0, 2):
26032605

26042606
# interpolate thrust force from speed/thrust curve
2605-
for i in range(0, nturbs):
2607+
for i in range(0,nturbs):
26062608
if ws[i] < cutin:
26072609
T = 0
26082610
else:
26092611
T = f(ws[i])
26102612

26112613
# apply thrust force/moments (split into x and y components)
2612-
self.ms.bodyList[i].f6Ext = np.array([T*np.cos(np.radians(wd)), T*np.sin(np.radians(wd)), 0, T*np.cos(np.radians(wd))*hubht, T*np.sin(np.radians(wd))*hubht, 0]) # apply an external force on the body
2614+
turblist[i].f6Ext = np.array([T*np.cos(np.radians(wd)), T*np.sin(np.radians(wd)), 0, T*np.cos(np.radians(wd))*hubht, T*np.sin(np.radians(wd))*hubht, 0]) # apply an external force on the body
26132615

26142616

26152617
#solve statics to find updated turbine positions
26162618
self.ms.initialize()
26172619
self.ms.solveEquilibrium(DOFtype='both')
26182620

26192621
#update floris turbine positions and calculate wake losses
2620-
self.flow.set(layout_x=[body.r6[0] for body in self.ms.bodyList], layout_y=[body.r6[1] for body in self.ms.bodyList])
2622+
self.flow.set(layout_x=[body.r6[0] for body in turblist], layout_y=[body.r6[1] for body in turblist])
26212623
self.flow.run()
26222624

26232625

26242626

26252627
#update wind speed list for RAFT
26262628
ws = list(self.flow.turbine_average_velocities[0])
26272629
winds.append(ws)
2628-
xpositions.append([body.r6[0] for body in self.ms.bodyList])
2629-
ypositions.append([body.r6[1] for body in self.ms.bodyList])
2630+
xpositions.append([body.r6[0] for body in turblist])
2631+
ypositions.append([body.r6[1] for body in turblist])
26302632

26312633

26322634
#return FLORIS turbine powers (in order of turbine list)
@@ -2684,7 +2686,7 @@ def getFLORISMPequilibrium(self, ws, wd, ti, cutin, hubht, plotting = True):
26842686
#return turbines to neutral positions **** only done if plotting - this reduces runtime for AEP calculation
26852687
for i in range(0, nturbs):
26862688

2687-
self.ms.bodyList[i].f6Ext = np.array([0, 0, 0, 0, 0, 0]) # apply an external force on the body
2689+
turblist[i].f6Ext = np.array([0, 0, 0, 0, 0, 0]) # apply an external force on the body
26882690

26892691
#solve statics to find updated turbine positions
26902692
# self.ms.initialize()

0 commit comments

Comments
 (0)