kilianknoll / DWDForecast

Python module to query the DWD Mosmix data for irridation - and other relevant data to forecast solar generation
GNU General Public License v3.0
34 stars 4 forks source link

Shit happened ? run_model() got an unexpected keyword argument 'times' #1

Closed plin2 closed 3 years ago

plin2 commented 4 years ago

I set up your script on my server, installed the necessary modules and get the following error when running the script: Shit happened ? run_model() got an unexpected keyword argument 'times'

No Data is filled into my DB table.

pip install pvlib shows Requirement already satisfied: pvlib in /usr/lib/python3.6/site-packages (0.8.0) Requirement already satisfied: scipy>=1.2.0 in /usr/lib64/python3.6/site-packages (from pvlib) (1.2.0) Requirement already satisfied: pandas>=0.22.0 in /usr/lib64/python3.6/site-packages (from pvlib) (0.23.4) Requirement already satisfied: pytz in /usr/lib/python3.6/site-packages (from pvlib) (2018.5) Requirement already satisfied: numpy>=1.12.0 in /usr/lib64/python3.6/site-packages (from pvlib) (1.17.3) Requirement already satisfied: requests in /usr/lib/python3.6/site-packages (from pvlib) (2.22.0) Requirement already satisfied: python-dateutil>=2.5.0 in /usr/lib/python3.6/site-packages (from pandas>=0.22.0->pvlib) (2.7.3) Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/lib/python3.6/site-packages (from requests->pvlib) (1.25.7) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib/python3.6/site-packages (from requests->pvlib) (3.0.4) Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3.6/site-packages (from requests->pvlib) (2019.9.11) Requirement already satisfied: idna<2.9,>=2.5 in /usr/lib/python3.6/site-packages (from requests->pvlib) (2.8) Requirement already satisfied: six>=1.5 in /usr/lib/python3.6/site-packages (from python-dateutil>=2.5.0->pandas>=0.22.0->pvlib) (1.11.0)

kilianknoll commented 4 years ago

Hi plin2 sorry for the inconvenience. I just pushed a new version up that should allow me to better identify what is going wrong. Here are my questions / requests: 1) Can you please rerun with the updated version of the script. Could you please also first use the configuration.ini that is provided in the repository to check if the default config is working. In case this fails too, could you please provide the script output as well as the debug output ? 2) In case step 1 does not show any issues, can you please provide me your configuration.ini file. Please note - DWD has some MOSMIX weather stations that do not provide Rad1h values. Fastest way to check this is to open the moxmix.kml file in a texteditor and search for Rad1h

plin2 commented 4 years ago

Hi kilianknoll,

I downloaded and tested your new version and still get the message Error processing DWDArray run_model() got an unexpected keyword argument 'times'

Yesterday I did some testing and found out that in pvlib 0.8.0 the syntax for run_model has changed. I adjusted the line #self.myModelChain.run_model(times=self.mc_weather.index, weather=self.mc_weather) self.myModelChain.run_model(self.mc_weather)

After that I ran into DB problems: ,subroutine dwdweather, addsingleRow2DB 1292 (22007): Incorrect datetime value: '2020-09-14T05:00:00.000Z' for columnSolar.dwd.mydatetimeat row 1

So I did another adjustment #self.mosmixdata[0][counter]=self.timevalue[counter] self.mosmixdata[0][counter]=self.myTZtimestamp

After that I was able to insert records into my database.

P.S. You didn't provide a script for creating the database table. Mine looks like this: `create database Solar;

DROP TABLE IF EXISTS dwd;

CREATE TABLE dwd ( mydatetime datetime NOT NULL DEFAULT 0, mytimestamp int(11) NOT NULL, Rad1h float(8,2) NOT NULL DEFAULT 0, PPPP float(8,2) NOT NULL DEFAULT 0.00, FF float(8,2) NOT NULL DEFAULT 0.00, TTT float(8,2) NOT NULL DEFAULT 0.00, Rad1wh float(8,2) NOT NULL DEFAULT 0.00, Rad1Energy float(8,2) NOT NULL DEFAULT 0.00, ACSim float(8,2) NOT NULL DEFAULT 0.00, DCSim float(8,2) NOT NULL DEFAULT 0.00, CellTempSim float(8,2) NOT NULL DEFAULT 0.00, PRIMARY KEY (mydatetime, mytimestamp) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='DWD Forecast';`

solar_dwd.sql.txt

plin2 commented 4 years ago

The curent pvlib only includes the 'Kostal Solar Electric: Piko 5.3'. Is there any informationen which of the parameters in the libraries csv files matches which detail from the Kostal data sheet, so I cann add my 'Kostal Solar Electric: PLENTICORE plus 7.0'?

StefaE commented 3 years ago

Hi plin2,

... you should be able to add your own lines to the file where you find the Piko 5.3; docu as to what the parameters mean is here

That said, not sure it makes a meaningful difference as long as you select an inverter with larger rated power than what you are using (which essentially guarantees that no clipping happens ...); Kilian selected an SMA with rated power of 10kW vs. yours with 7kW, so you should be fine - efficiency maybe off by 1-2%.

Stefan

kilianknoll commented 3 years ago

I have just pushed a new version that resolves the issue around the different pvlib version and them changing their APIs. This related to the error: run_model() got an unexpected keyword argument 'times' Many thanks plin2 for the explanation (saved me a lot of time) Concerning automated creation of a table from within the script ... - I am not such a big fan of this since I do not want the script to do "too much" - also the configuration file gives an indication of the schema required. I will close this issue for now

plin2 commented 3 years ago

Concerning automated creation of a table from within the script ... - I am not such a big fan of this since I do not want the script to do "too much" - also the configuration file gives an indication of the schema required. "indication of the schema": Well, people are lazy. Supplying a sample with the sql statement wouldn't hurt ...