Maximilian Schwab
Maximilian Schwab

Reputation: 23

Why is the simple model chain example from the website is calculating negative ac power?

I'm using the pvlib library for my masterthesis. When I run the example for times later than 4pm it is usually reporting for the ac power -0.02. Does somebody know why? I'm using the code below:

import pandas as pd
import numpy as np

# pvlib imports
import pvlib

from pvlib.pvsystem import PVSystem
from pvlib.location import Location
from pvlib.modelchain import ModelChain

# load some module and inverter specifications
sandia_modules = pvlib.pvsystem.retrieve_sam('SandiaMod')
cec_inverters = pvlib.pvsystem.retrieve_sam('cecinverter')

sandia_module = sandia_modules['Canadian_Solar_CS5P_220M___2009_']
cec_inverter = cec_inverters['ABB__MICRO_0_25_I_OUTD_US_208_208V__CEC_2014_']
location = Location(latitude=49.0205559, longitude=12.057453900000041)
system = PVSystem(surface_tilt=20, surface_azimuth=200,
              module_parameters=sandia_module,
              inverter_parameters=cec_inverter)
mc = ModelChain(system, location)
python_native_dt = datetime.datetime.now()
weather = pd.DataFrame([[1050, 1000, 100, 30, 5]],
                   columns=['ghi', 'dni', 'dhi', 'temp_air', 'wind_speed'],
                   index=[pd.Timestamp(pytz.timezone('Etc/GMT+2').localize(python_native_dt))])

mc.run_model(times=weather.index, weather=weather)
print(mc.ac)

Doing a mc.acwill result in: 2018-06-05 16:20:19.117017-02:00 -0.02 dtype: float64

Upvotes: 2

Views: 394

Answers (2)

Weatherman
Weatherman

Reputation: 13

G'day Maximilian,

I suspect it is the weather dataframe. I have noticed that most weather files from NWP centres (I am using ECMWF ERA5) represent DNI GHI DHI in accumulation. With ERA5 data I noticed negative power values with raw data.

After converting from accumulation to W/s by dividing by 60(secs)*60(minutes) it worked.

Upvotes: 0

Will Holmgren
Will Holmgren

Reputation: 735

The -0.02 is the energy your chosen inverter consumes when the input dc power is below its activation threshold.

To improve reproducibility and help us track down the answer, I suggest you specify an exact time rather than relying on datetime.datetime.now(). Using index=[pd.Timestamp('2018-06-05 16:20:19.117017-02:00')], I get 2018-06-05 16:20:19-02:00 13.660678.

I suggest that you confirm that mc.aoi and mc.solar_position are consistent with your weather inputs. They are derived from the time index and used to calculate the plane of array irradiance.

If that does not help... What versions of pvlib and pandas? Note that the example also needs import pytz and import datetime to run.

Upvotes: 2

Related Questions