From 965ce9d34d3172bfc44ee836c0b077e34fbac238 Mon Sep 17 00:00:00 2001 From: Florian Kotthoff <74312290+FlorianK13@users.noreply.github.com> Date: Fri, 25 Oct 2024 13:32:15 +0200 Subject: [PATCH] Delete parameter for numberSimulation #47 We will fully focus on sky domes from now on. NumberSimulations only makes sense if we neglect diffuse radiance, which we cannot do anymore. --- README.md | 9 +++------ src/main.ts | 20 ++++---------------- src/rayTracingWebGL.ts | 2 +- src/utils.ts | 6 ------ 4 files changed, 8 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 3e4e803..3866e40 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,9 @@ scene.addShadingGeometry(someShadingGeometry); scene.addSimulationGeometry(someSimulationGeometry); let mesh = await scene.calculate({ - numberSimulations: 100, - diffuseIrradiance: "https://www.openpv.de/data/irradiance", - urlDirectIrrandianceTIF: - "https://www.openpv.de/data/irradiance/geotiff/average_direct_radiation.tif", - urlDiffuseIrrandianceTIF: - "https://www.openpv.de/data/irradiance/geotiff/average_diffuse_radiation.tif", + diffuseIrradiance: 'https://www.openpv.de/data/irradiance', + urlDirectIrrandianceTIF: 'https://www.openpv.de/data/irradiance/geotiff/average_direct_radiation.tif', + urlDiffuseIrrandianceTIF: 'https://www.openpv.de/data/irradiance/geotiff/average_diffuse_radiation.tif', }); showThreeJS(mesh); diff --git a/src/main.ts b/src/main.ts index 612a5ec..1d688e4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -138,7 +138,6 @@ export class ShadingScene { async calculate(params: CalculateParams = {}) { const { - numberSimulations = 80, diffuseIrradianceURL, pvCellEfficiency = 0.2, maxYieldPerSquareMeter = 1400 * 0.2, @@ -195,17 +194,12 @@ export class ShadingScene { const doDiffuseIntensities = typeof diffuseIrradianceURL === 'string'; const simulationRounds = doDiffuseIntensities ? 2 : 1; - const directIntensities = await this.rayTrace( - midpointsArray, - normalsArray, - meshArray, - numberSimulations, - undefined, - (i, total) => progressCallback(i, total * simulationRounds), + const directIntensities = await this.rayTrace(midpointsArray, normalsArray, meshArray, undefined, (i, total) => + progressCallback(i, total * simulationRounds), ); let diffuseIntensities = new Float32Array(); if (doDiffuseIntensities) { - diffuseIntensities = await this.rayTrace(midpointsArray, normalsArray, meshArray, 0, diffuseIrradianceURL, (i, total) => + diffuseIntensities = await this.rayTrace(midpointsArray, normalsArray, meshArray, diffuseIrradianceURL, (i, total) => progressCallback(i + total, total * simulationRounds), ); } @@ -259,7 +253,6 @@ export class ShadingScene { * @param midpoints midpoints of triangles for which to calculate intensities * @param normals normals for each midpoint * @param meshArray array of vertices for the shading mesh - * @param numberSimulations number of random sun positions that are used for the simulation. Either numberSimulations or irradianceUrl need to be given. * @param diffuseIrradianceUrl url where a 2D json of irradiance values lies. To generate such a json, visit https://github.com/open-pv/irradiance * @return * @memberof Scene @@ -268,7 +261,6 @@ export class ShadingScene { midpoints: Float32Array, normals: TypedArray, meshArray: Float32Array, - numberSimulations: number, diffuseIrradianceUrl: string | undefined, progressCallback: (progress: number, total: number) => void, ) { @@ -281,12 +273,8 @@ export class ShadingScene { irradiance = sun.convertSpericalToEuclidian(diffuseIrradianceSpherical); } else if (typeof diffuseIrradianceUrl != 'undefined') { throw new Error('The given url for diffuse Irradiance is not valid.'); - } else if (numberSimulations > 0) { - irradiance = sun.getRandomSunVectors(numberSimulations, this.latitude, this.longitude); } else { - throw new Error( - 'No irradiance found for the simulation. Either give a valid URL for diffuse radiation or a numberSimulation > 0.', - ); + throw new Error('No irradiance found for the simulation.'); } if (this.elevationRaster.length > 0) { diff --git a/src/rayTracingWebGL.ts b/src/rayTracingWebGL.ts index f71ea09..948e0f4 100644 --- a/src/rayTracingWebGL.ts +++ b/src/rayTracingWebGL.ts @@ -1,5 +1,5 @@ import { TypedArray } from 'three'; -import { Point, SunVector, timeoutForLoop } from './utils'; +import { SunVector, timeoutForLoop } from './utils'; function addToArray(ar1: Float32Array, ar2: Float32Array) { for (var i = 0; i < ar1.length; i++) { diff --git a/src/utils.ts b/src/utils.ts index 35b9bbf..a7acb72 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -76,12 +76,6 @@ export type ColorMap = (t: number) => Color; * Interface for the parameter object for {@link index.ShadingScene.calculate} */ export interface CalculateParams { - /** - * Number of random sun positions that are used to calculate the PV yield. - * @defaultValue 80 - */ - numberSimulations?: number; - /** * URL where the files for the diffuse Irradiance can be retreived. * The object at this URL needs to be of type {@link SolarIrradianceData}.