Skip to content

Commit

Permalink
Update output vis
Browse files Browse the repository at this point in the history
  • Loading branch information
paulf81 committed Nov 21, 2024
1 parent b766429 commit 15ea201
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 488 deletions.
22 changes: 6 additions & 16 deletions example_case_folders/07_floris_standin_and_solar_pysam/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

## Description

This example demonstrates how to use the FLORIS Standin and a solar model using pysam.
This example demonstrates how to use the FLORIS Standin and a solar model using pysam. The simulation should run for 20 simulated seconds.

## Files

#Todo: Explain all the input files

## Running

Expand All @@ -15,17 +12,10 @@ To run the example, execute the following command in the terminal:
```bash
bash run_script.sh
```
## Outputs

To plot the outputs run the following command in the terminal:

To run `hercules` using the PV plant controller, which provides power setpoints and adjusts the PV power output accordingly, ensure the following line is uncommented in `run_script.sh`:

```
python3 hercules_runscript.py hercules_controller_input_000.yaml >> outputs/loghercules.log 2>&1 &
```

To run `hercules` without the PV plant controller, ensure the folling line is uncommented `run_script.sh`:

```
python3 hercules_runscript.py hercules_input_000.yaml >> outputs/loghercules.log 2>&1 &
```

```bash
python plot_outputs.py
```
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()
Loading

0 comments on commit 15ea201

Please sign in to comment.