Coder Social home page Coder Social logo

jamiembright / engerer2-separation-model Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 7.0 56 KB

Code for the Engerer2 diffuse fraction separation model following the newly parameterised version published in the Journal of Renewable and Sustainable Energy. The model estimates the diffuse horizontal irradiance from inputs of global horizontal irradiance, latitude, longitude and time.

MATLAB 66.17% R 15.23% Python 18.60%

engerer2-separation-model's People

Contributors

adamrjensen avatar jamiembright avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

engerer2-separation-model's Issues

TJ clear-sky model implementations use sin instead of sind

I think all three implementations of the TJ clear-sky model in this repo are flawed in that the arguments to sin are interpreted as radians but should be interpreted as degrees. Here are the relevant lines of code:

a_tj = 1160 + 75 * np.sin((360 * (day_of_year - 275)) / 365)
k_tj = 0.174 + 0.035 * np.sin((360 * (day_of_year - 100)) / 365)
c_tj = 0.095 + 0.04 * np.sin((360 * (day_of_year - 100)) / 365)

A = 1160 + 75 .* sin((360.*(doy-275))./365);
k = 0.174 + 0.035 .* sin((360.*(doy-100))./365);
C = 0.095 + 0.04 .* sin((360.*(doy-100))./365);

A = 1160 + 75 * sin((360 * (doy - 275)) / 365)
k = 0.174 + 0.035 * sin((360 * (doy - 100)) / 365)
C = 0.095 + 0.04 * sin((360 * (doy - 100)) / 365)

As an aside, I think the implementation in the clear-sky-models repo has the same problem: https://github.com/JamieMBright/clear-sky-models/blob/86fe607e9ba66226be6102895491b7d756473a7e/R/1-TJ.R#L26-L28

The 360/365 coefficient seems like it is intended to produce one period per year in degrees. Treating it as radians introduces an undesirable amplitude variation of period ~6 days, as these two screenshots show:

image

image

Changing the 360s to 2*np.pi seems to resolve the issue in the python implementation. I did not check the R or MATLAB versions.

As far as I can tell, these equations for A, k, and C do not come from the 1957 Threlkeld & Jordan paper but rather from G Masters' "Renewable and Efficient Electric Power Systems", which contains this example (Example 7.8). It only gives the correct answer if the argument to sin is interpreted as degrees:

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.