- Posts: 18
Questions regarding pvwattsfunc in SSC
- sfrank
- Topic Author
Less
More
02 Jul 2013 13:11 #1695
by sfrank
Questions regarding pvwattsfunc in SSC was created by sfrank
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
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.
Please Log in or Create an account to join the conversation.
- pgilman
Less
More
- Posts: 5447
15 Jul 2013 10:01 #1696
by pgilman
Replied by pgilman on topic Questions regarding pvwattsfunc in SSC
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.
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.
Please Log in or Create an account to join the conversation.
- sfrank
- Topic Author
Less
More
- Posts: 18
15 Jul 2013 17:33 #1697
by sfrank
Replied by sfrank on topic Questions regarding pvwattsfunc in SSC
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
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
Please Log in or Create an account to join the conversation.
- pgilman
Less
More
- Posts: 5447
16 Jul 2013 09:45 #1698
by pgilman
Replied by pgilman on topic Questions regarding pvwattsfunc in SSC
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.
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.
Please Log in or Create an account to join the conversation.
- sfrank
- Topic Author
Less
More
- Posts: 18
17 Jul 2013 09:38 #1699
by sfrank
Replied by sfrank on topic Questions regarding pvwattsfunc in SSC
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
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
Please Log in or Create an account to join the conversation.
- sfrank
- Topic Author
Less
More
- Posts: 18
17 Jul 2013 09:40 #1700
by sfrank
Replied by sfrank on topic Questions regarding pvwattsfunc in SSC
%% 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', );
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');
% 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', );
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');
Please Log in or Create an account to join the conversation.
Moderators: pgilman