- Posts: 15
 
Adjusting Weather Data
- lwkerber
 - Topic Author
 
        Less
        More
        
            
    
        
            
        
                04 Nov 2016 08:21                #4891
        by lwkerber
    
    
            
            
            
            
            
                                
    
                                                
    
        Adjusting Weather Data was created by lwkerber            
    
        I get the following error when I do Simulate:
exec fail(pvsamv1): electric load profile must have same number of values as weather file, or 8760
Simulation pvsamv1 failed.
I understand that the weather file must be adjusted to align with my 15-minute load data. Can you provide a step-by-step overview of using the LK Script for converting the weather file to 15-minute intervals?
Thanks.
    exec fail(pvsamv1): electric load profile must have same number of values as weather file, or 8760
Simulation pvsamv1 failed.
I understand that the weather file must be adjusted to align with my 15-minute load data. Can you provide a step-by-step overview of using the LK Script for converting the weather file to 15-minute intervals?
Thanks.
Please Log in or Create an account to join the conversation.
- Paul Gilman
 
        Less
        More
        
            
    
        - Posts: 5666
 
            
        
                07 Nov 2016 10:35         -  02 Jul 2019 13:56        #4892
        by Paul Gilman
    
    
    
            
            
            
            
                                
    
                                                
    
        Replied by Paul Gilman on topic Adjusting Weather Data            
    
        Hello,
1. Go to the LK samples , and download the hourly_to_15min.lk file.
2. Locate the hourly weather file you want to convert. If it is one of the files that comes with SAM, you can find those files in the solar_resource folder of your SAM installation (C:/SAM/2016.3.14/solar_resource by default in windows, see this post to find the folder in OS X).
3. Copy the file from Step 2 to your SAM weather file folder. If you do not have such a folder, create one in your Documents folder or a folder that you have full access to.
4. Start SAM, and on the Welcome page, click Open script, and open the .lk file you downloaded in Step 1. If SAM is already running, you can open the file from the File menu.
5. In the Script window, click Run at the top of the window, and open the weather file from Step 3. The script will work with any hourly weather file, as long as it is in the SAM CSV format. (You can use the Solar Resource File converter macro that comes with SAM to convert a file from some common formats to SAM CSV.) The script displays a message in the console telling you whether it converted the file, and that it saved it in the same folder as the hourly file.
6. In SAM, open your .sam file (or create a new one) and go to the Location and Resource page. If you created a new folder for the weather file, click Folder settings and add that folder to the list of folders SAM searches for weather files, and then click Refresh library.
7. Choose the converted 15-minute weather file from the solar resource library list. If you do not see the file, you may need to refresh the library to ensure that SAM adds it to the solar resource library.
You can see the converted data by clicking View data on the Location and Resource page, or by opening the file in a spreadsheet program or text editor.
The script works by making a four copies of each hourly record to represent the 15-minute data. For example, if the direct normal irradiance (DNI) for Noon on January 1 in the hourly file is 200 W/m2, the DNI in the 15-minute converted file will by 200 W/m2 for 12:00, 12:15, 12:30 and 12:45.
If you are comfortable with scripting or programming languages, you can modify the .lk script to convert to different time steps, or to use a different method for the conversion.
Best regards,
Paul.
    1. Go to the LK samples , and download the hourly_to_15min.lk file.
2. Locate the hourly weather file you want to convert. If it is one of the files that comes with SAM, you can find those files in the solar_resource folder of your SAM installation (C:/SAM/2016.3.14/solar_resource by default in windows, see this post to find the folder in OS X).
3. Copy the file from Step 2 to your SAM weather file folder. If you do not have such a folder, create one in your Documents folder or a folder that you have full access to.
4. Start SAM, and on the Welcome page, click Open script, and open the .lk file you downloaded in Step 1. If SAM is already running, you can open the file from the File menu.
5. In the Script window, click Run at the top of the window, and open the weather file from Step 3. The script will work with any hourly weather file, as long as it is in the SAM CSV format. (You can use the Solar Resource File converter macro that comes with SAM to convert a file from some common formats to SAM CSV.) The script displays a message in the console telling you whether it converted the file, and that it saved it in the same folder as the hourly file.
6. In SAM, open your .sam file (or create a new one) and go to the Location and Resource page. If you created a new folder for the weather file, click Folder settings and add that folder to the list of folders SAM searches for weather files, and then click Refresh library.
7. Choose the converted 15-minute weather file from the solar resource library list. If you do not see the file, you may need to refresh the library to ensure that SAM adds it to the solar resource library.
You can see the converted data by clicking View data on the Location and Resource page, or by opening the file in a spreadsheet program or text editor.
The script works by making a four copies of each hourly record to represent the 15-minute data. For example, if the direct normal irradiance (DNI) for Noon on January 1 in the hourly file is 200 W/m2, the DNI in the 15-minute converted file will by 200 W/m2 for 12:00, 12:15, 12:30 and 12:45.
If you are comfortable with scripting or programming languages, you can modify the .lk script to convert to different time steps, or to use a different method for the conversion.
Best regards,
Paul.
        Last edit: 02 Jul 2019 13:56  by Paul Gilman.            
            Please Log in or Create an account to join the conversation.
- pmanson
 
        Less
        More
        
            
    
        - Posts: 14
 
            
        
                14 Dec 2016 16:48                #4893
        by pmanson
    
    
            
            
            
            
            
                                
    
                                                
    
        Replied by pmanson on topic Adjusting Weather Data            
    
        There's a bug in the hourly_to_15min.lk script - it puts a "Minute" value of 0 in all rows of the output file. The fix is to move these two lines:
minute = j*15;
newWF{"Minute"}[wi] = minute;
After these lines:
for( k=0; k
    minute = j*15;
newWF{"Minute"}[wi] = minute;
After these lines:
for( k=0; k
Please Log in or Create an account to join the conversation.
- Paul Gilman
 
        Less
        More
        
            
    
        - Posts: 5666
 
            
        
                15 Dec 2016 21:28                #4894
        by Paul Gilman
    
    
            
            
            
            
            
                                
    
                                                
    
        Replied by Paul Gilman on topic Adjusting Weather Data            
    
        Thanks. I'll update the script when I get a chance.
Best regards,
Paul.
    Best regards,
Paul.
Please Log in or Create an account to join the conversation.
- Paul Gilman
 
        Less
        More
        
            
    
        - Posts: 5666
 
            
        
                02 Jul 2019 13:54                #7497
        by Paul Gilman
    
    
            
            
            
            
            
                                
    
                                                
    
        Replied by Paul Gilman on topic Adjusting Weather Data            
    
        The "Solar Resource Interpolation" macro replaces the need to use the hourly_to_15min.lk script.
To find the macro, start SAM and open or create a case. Then, click Macros (at bottom left under the Simulate button) and choose the "Solar Resource Interpolation" macro and follow the instructions.
The sample LK scripts are now available on the SAM GitHub repository .
Best regards,
Paul.
    To find the macro, start SAM and open or create a case. Then, click Macros (at bottom left under the Simulate button) and choose the "Solar Resource Interpolation" macro and follow the instructions.
The sample LK scripts are now available on the SAM GitHub repository .
Best regards,
Paul.
Please Log in or Create an account to join the conversation.
        Moderators: Paul Gilman    
 
 



