1- function [Tcell Tmodule ] = pvl_sapmcelltemp(E , E0 , a , b , windspeed , Tamb , deltaT )
1+ function [Tcell , Tmodule ] = pvl_sapmcelltemp(E , E0 , a , b , windspeed , Tamb , deltaT )
22% PVL_SAPMCELLTEMP Estimate cell temperature from irradiance, windspeed, ambient temperature, and module parameters (SAPM)
33%
44% Syntax
4141% See also PVL_SAPM
4242%
4343p = inputParser ;
44- p .addRequired(' E' , @(x ) all( isnumeric(x ) & ( x >= 0 ) & isvector (x )));
45- p .addRequired(' E0' , @(x ) all( isnumeric(x ) & isscalar(x ) & ( x >= 0 )));
46- p .addRequired(' a' , @(x ) all(isscalar( x ) & isnumeric( x ) ));
47- p .addRequired(' b' , @(x ) all(isscalar( x ) & isnumeric( x ) ));
48- p .addRequired(' windspeed' , @(x ) all(isvector( x ) & isnumeric( x ) ));
49- p .addRequired(' Tamb' , @(x ) all( isnumeric(x ) & ( x >= - 273.15 ) & isvector (x )));
50- p .addRequired(' deltaT' , @(x ) all( isnumeric(x ) & ( x >= 0 ) & isscalar (x )));
44+ p .addRequired(' E' , @(x ) isnumeric(x ) && isvector( x ) && all( x >= 0 | isnan (x )));
45+ p .addRequired(' E0' , @(x ) isnumeric(x ) && isscalar(x ) && all( x >= 0 | isnan( x )));
46+ p .addRequired(' a' , @(x ) isnumeric( x ) && isscalar( x ));
47+ p .addRequired(' b' , @(x ) isnumeric( x ) && isscalar( x ));
48+ p .addRequired(' windspeed' , @(x ) isnumeric( x ) && isvector( x ));
49+ p .addRequired(' Tamb' , @(x ) isnumeric(x ) && isvector( x ) && all( x >= - 273.15 | isnan (x )));
50+ p .addRequired(' deltaT' , @(x ) isnumeric(x ) && isscalar( x ) && all( x >= 0 | isnan (x )));
5151p .parse(E , E0 , a , b , windspeed , Tamb , deltaT )
5252
53- E = E(: );
54-
55- if isscalar(p .Results .windspeed )
56- windspeed = p .Results .windspeed * ones(size(E ));
57- else
58- windspeed = p .Results .windspeed(: );
59- end
60-
61- if isscalar(p .Results .Tamb )
62- Tamb = p .Results .Tamb * ones(size(E ));
63- else
64- Tamb = p .Results .Tamb(: );
53+ if ~(isscalar(windspeed ) || numel(windspeed ) == numel(E ))
54+ error(' Input windspeed must be scalar or vectors of same length as E.' );
6555end
66-
67- if (numel(E ) ~= numel(windspeed )) || (numel(E ) ~= numel(Tamb )) || (numel(E ) ~= numel(windspeed ))
68- error([' Error in pvl_kingcelltemp. Inputs E, Tamb, and windspeed must ' ...
69- ' be scalars or vectors of same length.' ]);
56+ if ~(isscalar(Tamb ) || numel(Tamb ) == numel(E ))
57+ error(' Input Tamb must be scalar or vectors of same length as E.' );
7058end
7159
7260Tmodule = E .*(exp(a + b .* windspeed ))+Tamb ;
73- Tcell = Tmodule + E ./ E0 .* deltaT ;
61+ Tcell = Tmodule + E ./ E0 .* deltaT ;
0 commit comments