Warning: Declaration of Jetpack_IXR_Client::query() should be compatible with IXR_Client::query(...$args) in /var/www/esbenuth.dk/public_html/wp-content/plugins/jetpack/vendor/automattic/jetpack-connection/legacy/class-jetpack-ixr-client.php on line 54

Warning: Cannot modify header information - headers already sent by (output started at /var/www/esbenuth.dk/public_html/wp-content/plugins/jetpack/vendor/automattic/jetpack-connection/legacy/class-jetpack-ixr-client.php:0) in /var/www/esbenuth.dk/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1794
{"id":98,"date":"2020-04-11T19:38:58","date_gmt":"2020-04-11T19:38:58","guid":{"rendered":"http:\/\/esbenuth.dk\/?p=98"},"modified":"2020-04-11T19:38:58","modified_gmt":"2020-04-11T19:38:58","slug":"importing-time-series-to-homer","status":"publish","type":"post","link":"http:\/\/esbenuth.dk\/?p=98","title":{"rendered":"Importing time series to Homer"},"content":{"rendered":"\n

For our P2 project we are currently working towards a goal of obtaining the most efficient household setup of PV solar, hybrid inverter and storage batteries. This setup is of course connected to the grid.<\/p>\n\n\n\n

Using the Homer software to run simulations is very useful in obtaining our main goals in the project, but it also feel pretty useful to have knowledge working with it when returning to work in the industries after receiving our masters.<\/p>\n\n\n\n

Anyhow. The timeseries load profile we wanted to use in our project originated from my own personel load profile from a local electricity supplier formerly known as “SE” which know goes by the name “Norlys”. Unfortunately the only way to get one year of hourly usage on your laptop is by manually clicking 3 times each time you download a file, bear in mind that each file only hourly data for one day, so this proces has to be repeated 365 times to download data for a complete year.<\/p>\n\n\n\n

Finally with the data downloaded and trying to import it to Homer, it would not work. Homer simply does not recognize the format supplied by Norlys.<\/p>\n\n\n\n

I turned to my trusted friend Matlab, and by writing a script suitable for our situation Matlab easily digested through all of the files trimmed and compiled the load data into a single .csv file which then could be easily imported to Homer.<\/p>\n\n\n\n

The hardest thing for me was to find out what sort of format Homer would accept. There is little help to find on their website here<\/a>, but that did not help me all to much, mainly because I don’t know too much about formatting .csv files. (I know it is comma separated \ud83d\ude42 ) What I did find out eventually was that if I just simply use a one column csv format Homer would recognize it and put all my data in the right spot. So this was what i did, i simply created a single .csv file containing all the hourly load data, and from this data Homer accepted it and added it to the respective dates with no problems whatsoever.<\/p>\n\n\n\n

Not sure how well you can use my matlab code for this project, but I will put it up here just in case. I have the script placed in main folder, and “jan”,”feb”…etc. are all subfolders containing the downloaded time series from Norlys. When I refer to the 3rd column, it is simply because this is the place of the load data in the downloaded file, the tweaking must be up to you guys \ud83d\ude09<\/p>\n\n\n\n

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% Matlab Script\n% Creating suitable time series load profile for Homer Pro Grid Software\n%\n% Created by Esben Uth\n%    \n% Energy Department\n% Aalborg University Esbjerg\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%clean up\nclear\nclc\n%output script start to command line\ndisp('Conversion started');\n%create empty matrix to hold all load data\nM = zeros(1,1);\n%run through all subfolders\nsf = {'jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'};\nfor k = 1:12\n    %define folder\n    myDir = sf{k}; %gets directory\n    % count number of files in folder\n    myFiles = dir(fullfile(myDir,'*.csv')); %gets all csv files in subfolder\n    n_files=size(myFiles,1);\n    % start the for loop, extracting data from all the files in the folder.\n    for i = 1:length(myFiles)\n        %construct file name\n        baseFileName = myFiles(i).name;\n        fullFileName = fullfile(myDir, baseFileName);\n        %read file and move data from .csv file to the T variable\n        T = readtable(fullFileName, 'Delimiter', ';', 'PreserveVariableNames', true);\n        %convert table to cell\n        T = T{:,:};\n        %read data from the file\n        load_data = T(1:24,3);\n        date_data = T(1:24,1);\n        %trim data before appending them to the matrix\n        load_data = strrep(load_data,',', '.');\n        load_data = str2double(load_data);\n        date_data = strrep(date_data,'-', '\/');\n        date_data = str2double(date_data);\n        %create temporary matrix\n        temp_data = [load_data];\n        %append new data to the matrix\n        M = [M;temp_data];\n        %output part done to command line\n        disp(fprintf('File %d of %.0f in %s converted.', i, n_files, sf{k}));\n    end\nend\n%delete first row of matrix\nM(1,:) = [];\n%write load data into .csv file\nwritematrix(M,'Homer_time_series_load_profile.csv'); \n%output script end to command line\ndisp('Conversion complete');<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"

For our P2 project we are currently working towards a goal of obtaining the most efficient household setup of PV solar, hybrid inverter and storage batteries. This setup is of course connected to the grid. Using the Homer software to run simulations is very useful in obtaining our main goals in the project, but it […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":""},"categories":[27,36,29,35],"tags":[39,2,3,40,37,30,38],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/esbenuth.dk\/index.php?rest_route=\/wp\/v2\/posts\/98"}],"collection":[{"href":"http:\/\/esbenuth.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/esbenuth.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/esbenuth.dk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/esbenuth.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=98"}],"version-history":[{"count":1,"href":"http:\/\/esbenuth.dk\/index.php?rest_route=\/wp\/v2\/posts\/98\/revisions"}],"predecessor-version":[{"id":99,"href":"http:\/\/esbenuth.dk\/index.php?rest_route=\/wp\/v2\/posts\/98\/revisions\/99"}],"wp:attachment":[{"href":"http:\/\/esbenuth.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=98"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/esbenuth.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=98"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/esbenuth.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=98"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}