Questions regarding pvwattsfunc in SSC

9 posts / 0 new
Last post
sfrank
sfrank's picture
Questions regarding pvwattsfunc in SSC

First, thank you for making the SDK available! Some background on what I'm doing: I'm currently creating a Simulink interface to the pvwattsfunc module of SSC so that PV output calculations can be embedded within Simulink simulations. To do this, I need to understand the pvwattsfunc inputs and outputs in detail. I have three questions (at the moment) regarding the way the pvwattsfunc module works: 1. How exactly is the time zone input 'tz' specified? (For mountain date time, I tried -6 (for GMT -6), but this gave zero outputs at a time of 12 noon. Using +6 instead gave the expected result, but as a result I don't understand how the time zones are numbered.) 2. How does pvwattsfunc window the input data to calculate average power? I assume it calculates performance over the time window [start time] -> [start time + time step], i.e. from 12:00 PM to 12:30 PM for a start time of 12:00 and a time step of 0.5 hours. 3. How exactly does pvwattsfunc use the Input/Output variables 'tcell' (cell temperature) and 'poa' (Place of array irradiance)? From experimentation, it appears that: i. Adjusting the input value of 'tcell' has no effect on simulation results, but ii. Adjusting the input value of 'poa' affects the output values of 'tcell', 'dc' (DC power), and 'ac' (AC power). It seems that the input value of 'poa' is somehow used to estimate an initial cell temperature and the initial cell temperature specified by 'tcell' is ignored? Could you clarify this? Thank you! Steve Frank FYI: I did check the existing literature on PVWatts from https://sam.nrel.gov/reference and from the SAM help. It is not enlightening on these points since it all describes running a full year simulation in PVWatts.

Paul Gilman

Hi Steve,

Sorry for the slow response.

1. The time zone for Mountain Standard Time should be -7 (not positive 7). Maybe some other input is causing the output at noon to be zero. The longitude has to be consistent with the time zone. It may be that using Daylight Time instead of Standard Time would cause this problem. The time-related calculations ignore daylight savings and leap years. (If your weather data is for a leap year, you should delete the 24 rows of data for February 29.)

2. The answer to this question depends on the time convention used in the weather data. For standard TMY2 files, the solar radiation is the total amount of radiation received during the 60 minute period ending at the time stamp. Following that convention, for a 0.5-hour time step, the energy at hour 12 would be the total energy delivered during the preceding 30 minutes (11:30 - 12:00), not the following 30 minutes (12:00 - 12:30).

3. The Tcell input is the cell temperature in the preceding time step. The Tcell output is the cell temperature in the current time step. Adjusting the Tcell input in the current time step has no effect on any results in the current time step because it only affects results in the next time step.

Best regards,
Paul.

sfrank
sfrank's picture

Hi Paul,

Thank you for the replies, especially confirming my initial interpretation of the timezone. After further investigation, it was a sign error in the longitude that was causing the zero output.

I'm afraid I still do not understand your explanation of Tcell:
"The Tcell input is the cell temperature in the preceding time step. The Tcell output is the cell temperature in the current time step." -- This makes sense to me.
"Adjusting the Tcell input in the current time step has no effect on any results in the current time step because it only affects results in the next time step." -- This, however, does not. It would seem that with any short timestep model of cell thermal mass, the cell temperature in the previous time step should affect the final temperature of this time step. IE, if I ran the module sequentially, then the cell temperature output from one time step should logically be the input for the next. Saving that the temperature "has no effect on any results in the current time step" implies some type of internal memory buffer to the module such that if I set a temperature now and run the module, I will see no change, but if I then reset the values in the Tcell and poa fields and run the module a second time, I should see a change?

Thanks,

Steve

Paul Gilman

Hi Steve,

Your description is consistent with the algorithm of the pvwattsfunc module: When you run the module sequentially, you should set the cell temperature input for the current time step to the cell temperature output of the previous time step.

If you run the module once, because tcell is of type SSC_INOUT, the module assumes that the tcell value you provide as an input is the previous time step's cell temperature. It uses that value along with the ambient temperature and wind speed from the current time step and other parameters to calculate the cell temperature in the current time step, which it stores in the tcell variable, replacing its previous value. The value of tcell in the module's outputs is the cell temperature in the current time step.

My description is confusing because in my attempt to make the explanation clear, I made it sound like the tcell input and tcell output are separate variables.

For those who might be following this conversation, the pvwattsfunc module in SSC (part of the SAM SDK) is a version of the PVWatts model that runs one simulation for a single time step. That's different from the pvwattsv1 module, which runs a set of 8,760 hourly simulations to calculate the system's output over an entire year.

Best regards,
Paul.


sfrank
sfrank's picture

Hi Paul,

Thanks for the clarification. It sounds like I do have the right interpretation of what is happening. Still, its odd: changing the input value of 'tcell' to any number prior to calling the module has no effect on the returned output power or cell temperature---out to at least 6 decimal places. (The exception is inputting physically impossible values, that is, less than absolute zero. Those produce NaN's in the output). I'm using a very small time step (1 minute), so I would expect the input cell temperature to have a noticeable impact on the output cell temperature.

On the other hand, changing the input value of 'poa' has a very noticeable effect on the output powers and cell temperature. (I assume the direct effect is on cell temperature and power is affected indirectly.)

Understanding this behavior is probably not critical to my application, since I plan to feed it the previous time steps values of 'tcell' and 'poa' anyway. However, I'm curious as to what's happening behind the scenes.

I have a minimal example written for the MATLAB interface, but I haven't found a good way to upload the file. Instead, I will copy it into a separate comment.

Thanks,

Steve

sfrank
sfrank's picture

%% PVWatts function module in SSC (pvwattsfunc) - example
% This is the MATLAB example that accompanies my previous comment
% (Sorry that it does not display monospaced in the forum.)

% Load SSC
SSC.ssccall('load');

% Create & populate data container
data = SSC.ssccall('data_create');
SSC.ssccall('data_set_number', data, 'year', 2012);
SSC.ssccall('data_set_number', data, 'month', 6);
SSC.ssccall('data_set_number', data, 'day', 21);
SSC.ssccall('data_set_number', data, 'hour', 12);
SSC.ssccall('data_set_number', data, 'minute', 0);
SSC.ssccall('data_set_number', data, 'lat', 39.742);
SSC.ssccall('data_set_number', data, 'lon', -105.18);
SSC.ssccall('data_set_number', data, 'tz', -6); % UTC offset
SSC.ssccall('data_set_number', data, 'beam', 970); % W/m2
SSC.ssccall('data_set_number', data, 'diffuse', 86); % W/m2
SSC.ssccall('data_set_number', data, 'tamb', 25.4); % deg C
SSC.ssccall('data_set_number', data, 'wspd', 3.6); % m/s
SSC.ssccall('data_set_number', data, 'time_step', 1/60); % 1 min
SSC.ssccall('data_set_number', data, 'system_size', 100); % kW
SSC.ssccall('data_set_number', data, 'track_mode', 0); % Fixed
SSC.ssccall('data_set_number', data, 'azimuth', 180); % South facing
SSC.ssccall('data_set_number', data, 'tilt', 40); % deg
SSC.ssccall('data_set_number', data, 'derate', 0.95);

% Initialize IN/OUT variables - modify here to see effect on cell temp
SSC.ssccall('data_set_number', data, 'tcell', 25); % deg C
SSC.ssccall('data_set_number', data, 'poa', 1000); % W/m2

% Create pvwattsfunc module
module = SSC.ssccall('module_create', 'pvwattsfunc');

% Run the simulation
ok = SSC.ssccall('module_exec', module, data);

% Check for errors
if ~ok
% Get error messages
i = 0;
msg = '';
while true,
err = SSC.ssccall('module_log', module, i);
if strcmp(err,''),
break;
else
msg = [msg err '\n'];
i = i + 1;
end
end

% Throw error
error('runSSC:sscError', ['SSC library returned errors:\n' msg]);
end

% Display results
fprintf('%s:\t%f\t(%s)\n', 'dc', ...
SSC.ssccall('data_get_number', data, 'dc'), 'W');
fprintf('%s:\t%f\t(%s)\n', 'ac', ...
SSC.ssccall('data_get_number', data, 'ac'), 'W');
fprintf('%s:\t%f\t(%s)\n', 'tcell', ...
SSC.ssccall('data_get_number', data, 'tcell'), 'deg C');
fprintf('%s:\t%f\t(%s)\n', 'poa', ...
SSC.ssccall('data_get_number', data, 'poa'), 'W/m2');
disp(' ');

% Clean up
SSC.ssccall('module_free', module);
SSC.ssccall('data_free', data);
SSC.ssccall('unload');

Paul Gilman

Hi Steve,

I don't have MATLAB, so could not test your code directly. However, when I replicated it as an LK script in the SSCdev tool that comes in the SAM SDK package, I think I get different results than you describe:

POA before simulation = 1000
Tcell before simulation = 25

POA after simulation = 965.85
Tcell after simulation = 47.2424

Here is the LK script I used for the test -- you can copy and paste it into the SSCdev Script Editor to run it yourself:

Do you get a different result?

[BEGIN SCRIPT]

clear();

var('year', 2012);
var('month', 6);
var('day', 21);
var('hour', 12);
var('minute', 0);
var('lat', 39.742);
var('lon', -105.18);
var('tz', -6);

var('beam', 970);
var('diffuse', 86);
var('tamb', 25.4);
var('wspd', 3.6);
var('snow', 0);
var('time_step', 1/60);
var('system_size', 100);
var('derate', 0.95);
var('track_mode', 0);
var('azimuth', 180);
var('tilt', 40);
var('tcell', 25);
var('poa', 1000);

outln("before poa="+var('poa'));
outln("before tcell="+var('tcell'));

run('pvwattsfunc');

outln("after poa="+var('poa'));
outln("after tcell="+var('tcell'));
outln("after dc="+var('dc'));
outln("after ac="+var('ac'));

[END SCRIPT]

Thanks,
Paul.

sfrank
sfrank's picture

Hi Paul,

Ok, thanks for taking the time to replicate the script in LK.

I think your results are aligned with mine. Here's the equivalent MATLAB output:
dc: 88642.835938 (W)
ac: 81783.929688 (W)
tcell: 47.242397 (deg C)
poa: 965.850037 (W/m2)

To see the phenomenon I'm referring to, modify the initial values of 'tcell' and 'poa' (seperately) and examine the results. For example, here are three runs I tried and the results (with some annotation):

[Script]
...
var('tcell', 50); <--- INCREASED TO 50
var('poa', 1000);
...

[Results]
before poa=1000
before tcell=50
after poa=965.85
after tcell=47.2424 <--- UNCHANGED
after dc=88642.8
after ac=81783.9
elapsed time: 39 msec

[Script]
...
var('tcell', 25);
var('poa', 0); <--- DECREASED TO 0
...

[Results]
before poa=0
before tcell=25
after poa=965.85
after tcell=45.2398 <--- CHANGED
after dc=89641.5
after ac=82672.9
elapsed time: 26 msec

[Script]
...
var('tcell', 25);
var('poa', 5000); <--- INCREASED TO 5000
...

[Results]
before poa=5000
before tcell=25
after poa=965.85
after tcell=54.9714 <--- CHANGED
after dc=84788.6
after ac=78357
elapsed time: 22 msec

My observation is that modifying the initial value of 'tcell' doesn't seem to affect the results at all. This suggests that if I feed the cell temperature result from previous time steps into subsequent time steps, it won't make any difference to the calculation. However, modifying the initial value of 'poa' affects the output values of 'tcell', 'ac', and 'dc.'

Paul Gilman

Hi Steve,

As you know, the pvwattsfunc module calculates the cell temperature based on the tcell input value along with the the incident solar radiation (or plane-of-array radiation, POA), wind speed, and ambient temperature. The POA value has the largest impact on cell temperature. The cooling effect of the wind is also significant.

When you change only the tcell input value, depending on the values of the other parameters, they may dominate over the effect of the difference in the tcell input value, so you won't see a change in the tcell output value.

In your example, if you change the wind speed to zero, and run the module over a range of tcell input values while holding the other parameters constant, you will see a small difference in the tcell output value:

wspd = 0:
before tcell, after tcell
25, 62.2293
30, 62.0742
35, 62.0781
40, 62.0821
45, 62.0861
50, 62.0901

wspd = 3.6:
before tcell, after tcell
25, 47.2424
30, 47.1745
35, 47.1745
40, 47.1745
45, 47.1745
50, 47.1745

Best regards,
Paul.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer