-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
60 additions
and
488 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
example_case_folders/07_floris_standin_and_solar_pysam/plot_outputs.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Plot the outputs of the simulation | ||
|
||
import matplotlib.pyplot as plt | ||
import pandas as pd | ||
|
||
# Read the Hercules output file | ||
df = pd.read_csv("outputs/hercules_output.csv", index_col=False) | ||
|
||
# Plot the solar outputs | ||
# first test solar module outputs | ||
time = df["hercules_comms.amr_wind.wind_farm_0.sim_time_s_amr_wind"] | ||
|
||
if "external_signals.solar_power_reference_mw" in df.columns: | ||
power_setpoint = df["external_signals.solar_power_reference_mw"] | ||
ac_power = df["py_sims.solar_farm_0.outputs.power_mw"] | ||
# dc_power = df["py_sims.solar_farm_0.outputs.dc_power_mw"] | ||
aoi = df["py_sims.solar_farm_0.outputs.aoi"] | ||
irradiance = df["py_sims.solar_farm_0.outputs.dni"] | ||
|
||
fig, ax = plt.subplots(3, 1, sharex="col") # , figsize=[6,5], dpi=250) | ||
|
||
if "external_signals.solar_power_reference_mw" in df.columns: | ||
ax[0].plot(time / 3600, power_setpoint, "-", linewidth=1, label='setpoint', color="C0") | ||
ax[0].plot(time / 3600, ac_power, "--", label="power", color="C1") | ||
ax[0].set_ylabel("ac power") | ||
ax[0].grid() | ||
|
||
ax[1].plot(time / 3600, irradiance, ".-", label="irradiance") | ||
ax[1].set_ylabel("irradiance") | ||
ax[1].grid() | ||
|
||
ax[2].plot(time / 3600, aoi, ".-", label="aoi") | ||
ax[2].set_ylabel("aoi") | ||
ax[2].grid() | ||
ax[2].set_xlabel("time [hr]") | ||
|
||
fig.suptitle("Solar Outputs") | ||
|
||
# Plot combined outputs | ||
fig, ax = plt.subplots() | ||
ax.plot(time / 3600, df["hercules_comms.amr_wind.wind_farm_0.turbine_powers.000"], label="WT000") | ||
ax.plot(time / 3600, df["hercules_comms.amr_wind.wind_farm_0.turbine_powers.001"], label="WT001") | ||
ax.plot(time / 3600, df["py_sims.solar_farm_0.outputs.power_mw"]*1000, label="solar PV") | ||
ax.plot(time / 3600, df["py_sims.inputs.available_power"], label="wind power") | ||
ax.plot(time / 3600, df["py_sims.inputs.available_power"]+\ | ||
df["py_sims.solar_farm_0.outputs.power_mw"]*1000, label="available power") | ||
ax.set_ylabel("Power [kW]") | ||
ax.set_xlabel("Time [hr]") | ||
ax.legend() | ||
ax.grid(True) | ||
|
||
|
||
# Show the figures | ||
plt.show() |
Oops, something went wrong.