commit 1c1f0e99609e926ba6073a7aa33fcc18b08fd0cc
parent 92eae8328afc2a958a22515e161c83af061b9c26
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Tue, 7 Mar 2017 18:46:46 +0100
Merge remote-tracking branch 'origin/feature_test_model' into develop
Diffstat:
24 files changed, 847 insertions(+), 4 deletions(-)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
@@ -59,6 +59,7 @@ include_directories(
################################################################################
add_subdirectory(parser)
add_subdirectory(receivers)
+add_subdirectory(test_model)
################################################################################
# Generate files
diff --git a/cmake/parser/CMakeLists.txt b/cmake/parser/CMakeLists.txt
@@ -39,7 +39,7 @@ set(SOLPARSER_FILES_INC
solparser_shape.h
solparser_sun.h)
-# Prepend each file in the `SOLSTICE_FILES_<SRC|INC>' list by `SOLSTICE_SOURCE_DIR'
+# Prepend each file in the `SOLPARSER_FILES_<SRC|INC>' list by `SOLPARSER_SOURCE_DIR'
rcmake_prepend_path(SOLPARSER_FILES_SRC ${SOLPARSER_SOURCE_DIR})
rcmake_prepend_path(SOLPARSER_FILES_INC ${SOLPARSER_SOURCE_DIR})
rcmake_prepend_path(SOLPARSER_FILES_DOC ${PROJECT_SOURCE_DIR}/../)
diff --git a/cmake/test_model/CMakeLists.txt b/cmake/test_model/CMakeLists.txt
@@ -0,0 +1,57 @@
+# Copyright (C) CNRS 2016-2017
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+cmake_minimum_required(VERSION 2.8)
+project(test_model C)
+
+set(TESTMODEL_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../src/test_model)
+
+################################################################################
+# Define include directories
+################################################################################
+include_directories(
+ ${LibYAML_INCLUDE_DIR}
+ ${RSys_INCLUDE_DIR}
+ ${TESTMODEL_SOURCE_DIR}/../)
+
+################################################################################
+# Configure and define targets
+################################################################################
+set(TESTMODEL_FILES_SRC
+ test_model.c)
+
+# Prepend each file in the `TESTMODEL_FILES_<SRC|INC>' list by `TESTMODEL_SOURCE_DIR'
+rcmake_prepend_path(TESTMODEL_FILES_SRC ${TESTMODEL_SOURCE_DIR})
+
+if(CMAKE_COMPILER_IS_GNUCC)
+ set(MATH_LIB m)
+endif()
+
+add_executable(test_model ${TESTMODEL_FILES_SRC})
+
+################################################################################
+# Tests
+################################################################################
+if(NOT NO_TEST)
+ add_test(test_beam_down test_model beam_down)
+ add_test(test_01 test_model test01)
+ add_test(test_02 test_model test02)
+ add_test(test_03 test_model test03)
+ add_test(test_04 test_model test04)
+ add_test(test_05 test_model test05)
+
+ rcmake_copy_runtime_libraries(test_model)
+
+endif()
diff --git a/src/solstice.c b/src/solstice.c
@@ -20,6 +20,8 @@
#include "solstice_args.h"
#include "parser/solparser.h"
+#include <rsys/double2.h>
+
#include <sys/stat.h>
#include <sys/types.h>
@@ -306,6 +308,7 @@ static res_T
setup_sun_dirs(struct solstice* solstice, const struct solstice_args* args)
{
double* sun_dirs = NULL;
+ double* sun_angles = NULL;
size_t i;
res_T res = RES_OK;
ASSERT(solstice && args);
@@ -316,18 +319,26 @@ setup_sun_dirs(struct solstice* solstice, const struct solstice_args* args)
"Could not reserve the list of %lu sun directions.\n",
(unsigned long)args->nsun_dirs);
goto error;
-
}
-
+ res = darray_double_resize(&solstice->sun_angles, args->nsun_dirs*2/*#dims*/);
+ if (res != RES_OK) {
+ fprintf(stderr,
+ "Could not reserve the list of %lu sun angles.\n",
+ (unsigned long)args->nsun_dirs);
+ goto error;
+ }
sun_dirs = darray_double_data_get(&solstice->sun_dirs);
+ sun_angles = darray_double_data_get(&solstice->sun_angles);
FOR_EACH(i, 0, args->nsun_dirs) {
spherical_to_cartesian_sun_dir(args->sun_dirs + i, sun_dirs + i*3/*#dims*/);
+ d2(sun_angles + i*2, args->sun_dirs[i].azimuth, args->sun_dirs[i].elevation);
}
exit:
return res;
error:
darray_double_clear(&solstice->sun_dirs);
+ darray_double_clear(&solstice->sun_angles);
goto exit;
}
@@ -531,6 +542,7 @@ solstice_init
darray_nodes_init(allocator, &solstice->roots);
darray_nodes_init(allocator, &solstice->pivots);
darray_double_init(allocator, &solstice->sun_dirs);
+ darray_double_init(allocator, &solstice->sun_angles);
solstice->allocator = allocator ? allocator : &mem_default_allocator;
@@ -631,12 +643,14 @@ solstice_release(struct solstice* solstice)
darray_nodes_release(&solstice->roots);
darray_nodes_release(&solstice->pivots);
darray_double_release(&solstice->sun_dirs);
+ darray_double_release(&solstice->sun_angles);
}
res_T
solstice_run(struct solstice* solstice)
{
const double* sun_dirs = NULL;
+ const double* sun_angles = NULL;
size_t nsun_dirs = 0;
size_t i;
int dump;
@@ -645,6 +659,7 @@ solstice_run(struct solstice* solstice)
ASSERT(solstice);
sun_dirs = darray_double_cdata_get(&solstice->sun_dirs);
+ sun_angles = darray_double_cdata_get(&solstice->sun_angles);
nsun_dirs = darray_double_size_get(&solstice->sun_dirs);
ASSERT(nsun_dirs%3 == 0);
nsun_dirs /= 3/*#dims*/;
@@ -664,6 +679,8 @@ solstice_run(struct solstice* solstice)
} else {
FOR_EACH(i, 0, nsun_dirs) {
const double* sun_dir = sun_dirs + i*3/*#dims*/;
+ fprintf(solstice->output, "#--- Sun direction: %g %g (%g %g %g)\n",
+ SPLIT2(sun_angles), SPLIT3(sun_dir));
res = solstice_update_entities(solstice, sun_dir);
if(res != RES_OK) goto error;
@@ -683,7 +700,6 @@ solstice_run(struct solstice* solstice)
res = solstice_solve(solstice);
if(res != RES_OK) goto error;
}
- fprintf(solstice->output, "#--- Sun direction: %g %g %g\n", SPLIT3(sun_dir));
}
}
diff --git a/src/solstice.h b/src/solstice.h
@@ -92,6 +92,7 @@ struct solstice {
enum solstice_args_dump_split_mode dump_split_mode;
struct darray_double sun_dirs; /* List of double3 */
+ struct darray_double sun_angles;
size_t nrealisations; /* # realisations */
FILE* output; /* Output stream */
diff --git a/src/test_model/test_model.c b/src/test_model/test_model.c
@@ -0,0 +1,373 @@
+/* Copyright (C) CNRS 2016-2017
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <rsys/rsys.h>
+#include <rsys/math.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#ifdef COMPILER_CL
+ /* Wrap POSIX functions and constants */
+ #include <io.h>
+ #define fdopen _fdopen
+ #define fileno _fileno
+ #define execvp _execvp
+#endif
+
+#ifndef COMPILER_CL
+#include <linux/limits.h> /* MAX_PATH */
+#endif
+
+enum side {
+ FRONT,
+ BACK
+};
+
+enum RESULTS {
+ FRONT_INTEGRATED_IRRADIANCE,
+ BACK_INTEGRATED_IRRADIANCE,
+ FRONT_REFLECTIVITY_LOSS,
+ BACK_REFLECTIVITY_LOSS,
+ FRONT_ABSORPTIVITY_LOSS,
+ BACK_ABSORPTIVITY_LOSS,
+ FRONT_COS_LOSS,
+ BACK_COS_LOSS,
+ FRONT_EFFICIENCY,
+ BACK_EFFICIENCY,
+ MAX_RESULTS_COUNT__
+};
+
+static int
+file_exists(const char* name)
+{
+ FILE* f = fopen(name, "r");
+ if (!f) return 0;
+ fclose(f);
+ return 1;
+}
+
+#define MAX_LINE_LEN 2048
+
+static const char
+sundir_header [] = "#--- Sun direction:";
+
+#define IS_NEW_BLOC(Line, Header) (!strncmp((Line), (Header), strlen(Header)))
+
+static res_T
+get_dir_and_counts
+ (FILE* ref_file,
+ double sun_angles[2],
+ size_t* recv_count,
+ size_t* realisation_count)
+{
+ char line[MAX_LINE_LEN];
+
+ ASSERT(ref_file && sun_angles);
+ if (!fgets(line, sizeof(line), ref_file)) return RES_BAD_ARG;
+ if (!IS_NEW_BLOC(line, sundir_header))
+ return RES_BAD_ARG;
+ /* get sun dir */
+ if (2 != sscanf(line + strlen(sundir_header),
+ "%lg%lg", &sun_angles[0], &sun_angles[1])) {
+ return RES_BAD_ARG;
+ }
+ /* get sun dir */
+ if (!fgets(line, sizeof(line), ref_file)) return RES_BAD_ARG;
+ if (2 != sscanf(line, "%zu%zu", recv_count, realisation_count))
+ return RES_BAD_ARG;
+ return RES_OK;
+}
+
+#define READ_RECV(Name, Values, Std) \
+{ \
+ if (2 * MAX_RESULTS_COUNT__ + 1 \
+ != sscanf(line, \
+ "%s%*zu%lg%lg%lg%lg%lg%lg%lg%lg%lg%lg%lg%lg%lg%lg%lg%lg%lg%lg%lg%lg", \
+ Name, \
+ &Values[FRONT_INTEGRATED_IRRADIANCE], &Std[FRONT_INTEGRATED_IRRADIANCE], \
+ &Values[BACK_INTEGRATED_IRRADIANCE], &Std[BACK_INTEGRATED_IRRADIANCE], \
+ &Values[FRONT_REFLECTIVITY_LOSS], &Std[FRONT_REFLECTIVITY_LOSS], \
+ &Values[BACK_REFLECTIVITY_LOSS], &Std[BACK_REFLECTIVITY_LOSS], \
+ &Values[FRONT_ABSORPTIVITY_LOSS], &Std[FRONT_ABSORPTIVITY_LOSS], \
+ &Values[BACK_ABSORPTIVITY_LOSS], &Std[BACK_ABSORPTIVITY_LOSS], \
+ &Values[FRONT_COS_LOSS], &Std[FRONT_COS_LOSS], \
+ &Values[BACK_COS_LOSS], &Std[BACK_COS_LOSS], \
+ &Values[FRONT_EFFICIENCY], &Std[FRONT_EFFICIENCY], \
+ &Values[BACK_EFFICIENCY], &Std[BACK_EFFICIENCY]) \
+ ) \
+ { \
+ res = RES_BAD_ARG; \
+ goto error; \
+ } \
+}
+
+#define POSITIVE_OR_M_ONE(x) ((x) == -1 || (x) >= 0)
+
+static FINLINE int
+is_compatible_with
+ (const double ref_E,
+ const double ref_SE,
+ const double test_E,
+ const double test_SE)
+{
+ double SE;
+ ASSERT(POSITIVE_OR_M_ONE(ref_E) && POSITIVE_OR_M_ONE(ref_SE)
+ && POSITIVE_OR_M_ONE(test_E) && POSITIVE_OR_M_ONE(test_SE));
+ if (ref_E == -1) {
+ ASSERT(ref_SE == -1);
+ return (test_E == -1 && test_SE == -1);
+ }
+ ASSERT(ref_SE != -1);
+ SE = ref_SE > 0 ? 2 * ref_SE : (ref_E > 0 ? ref_E * 1e-6 : 1e-6);
+ return (fabs(ref_E - test_E) <= SE && test_SE <= SE);
+}
+
+static res_T
+check_1_reference
+ (FILE* tested_file,
+ const char* rcv_name,
+ const double* reference_E,
+ const double* reference_SE)
+{
+ res_T res = RES_OK;
+ ASSERT(tested_file && rcv_name && reference_E && reference_SE);
+ double a[2];
+ size_t c1, c2;
+
+ res = get_dir_and_counts(tested_file, a, &c1, &c2); /* skip headers */
+ if (res != RES_OK) goto error;
+ while(!feof(tested_file)) {
+ char line[MAX_LINE_LEN];
+ char tested_rcv_name[MAX_LINE_LEN];
+ double tested_E[MAX_RESULTS_COUNT__], tested_SE[MAX_RESULTS_COUNT__];
+ enum RESULTS r;
+ if (!fgets(line, sizeof(line), tested_file)) {
+ res = RES_BAD_ARG;
+ goto error;
+ }
+ READ_RECV(tested_rcv_name, tested_E, tested_SE);
+ if (strcmp(rcv_name, tested_rcv_name)) continue;
+ for (r = FRONT_INTEGRATED_IRRADIANCE; r < MAX_RESULTS_COUNT__; r++) {
+ if (!is_compatible_with
+ (reference_E[r], reference_SE[r], tested_E[r], tested_SE[r]))
+ {
+ res = RES_BAD_ARG;
+ goto error;
+ }
+ }
+ goto end; /* success */
+ }
+ res = RES_BAD_ARG; /* could not find data */
+end:
+ return res;
+error:
+ goto end;
+}
+
+static res_T
+check_1_global
+ (FILE* tested_file,
+ const double reference_E,
+ const double reference_SE,
+ const unsigned rank)
+{
+ res_T res = RES_OK;
+ char line[MAX_LINE_LEN];
+ double a[2];
+ size_t recv_count, r2;
+ unsigned i;
+ int nb;
+ double tested_E, tested_SE;
+
+ res = get_dir_and_counts(tested_file, a, &recv_count, &r2);
+ if (res != RES_OK) goto error;
+ /* skip receivers */
+ for ( ; recv_count--; ) {
+ if (!fgets(line, sizeof(line), tested_file)) {
+ res = RES_BAD_ARG;
+ goto error;
+ }
+ }
+ /* read the rank th global data */
+ for (i = 0; i <= rank; i++) {
+ if (!fgets(line, sizeof(line), tested_file)) {
+ res = RES_BAD_ARG;
+ goto error;
+ }
+ }
+ nb = sscanf(line, "%lg%lg", &tested_E, &tested_SE);
+ if (nb != 2) {
+ res = RES_BAD_ARG;
+ goto error;
+ }
+ if (!is_compatible_with
+ (reference_E, reference_SE, tested_E, tested_SE)) {
+ res = RES_BAD_ARG;
+ goto error;
+ }
+
+end:
+ return res;
+error:
+ goto end;
+}
+
+static res_T
+check_references
+ (FILE* ref_file, const char* tested_file_name)
+{
+ res_T res = RES_OK;
+ char line[MAX_LINE_LEN];
+ int nb_global = 0;
+ FILE* tested_file;
+
+ ASSERT(ref_file && tested_file_name);
+ tested_file = fopen(tested_file_name, "r");
+ if (!tested_file) {
+ res = RES_IO_ERR;
+ goto error;
+ }
+ for ( ; ; ) {
+ int nb = 0;
+ double val, std;
+ fpos_t pos;
+
+ CHECK(fgetpos(ref_file, &pos), 0);
+ if (!fgets(line, sizeof(line), ref_file)) {
+ if (feof(ref_file)) goto end;
+ res = RES_BAD_ARG;
+ goto error;
+ }
+ if (IS_NEW_BLOC(line, sundir_header)) {
+ /* keep the header as a part of the following bloc */
+ CHECK(fsetpos(ref_file, &pos), 0);
+ goto end;
+ }
+ nb = sscanf(line, "%lg%lg", &val, &std);
+ if (nb == EOF) goto end;
+ rewind(tested_file);
+ ASSERT(nb == 0 || nb == 2);
+ if (nb != 0) {
+ res = check_1_global(tested_file, val, std, nb_global);
+ if (res != RES_OK) goto error;
+ nb_global++;
+ }
+ else {
+ char ref_name[MAX_LINE_LEN];
+ double reference_E[MAX_RESULTS_COUNT__], reference_SE[MAX_RESULTS_COUNT__];
+ READ_RECV(ref_name, reference_E, reference_SE);
+ res =
+ check_1_reference(tested_file, ref_name, reference_E, reference_SE);
+ if (res != RES_OK) goto error;
+ }
+ };
+
+end:
+ if (tested_file) CHECK(fclose(tested_file), 0);
+ CHECK(remove(tested_file_name), 0);
+ return res;
+error:
+ goto end;
+}
+
+static FINLINE res_T
+create_tmp_file_name(char* out_name)
+{
+ ASSERT(out_name);
+#ifdef COMPILER_CL
+ if (tmpnam_s(out_name, L_tmpnam_s)) return RES_IO_ERR;
+#else
+ int fd;
+ strncpy(out_name, "solstice_tmp_file_XXXXXX", L_tmpnam_s);
+ fd = mkstemp(out_name);
+ if (-1 == fd) return RES_IO_ERR;
+ /* just want a name */
+ close(fd);
+#endif
+ return RES_OK;
+}
+
+static res_T
+do_check(const char* base_name)
+{
+ res_T res = RES_OK;
+ FILE* ref_file;
+ char ref_file_name[MAX_PATH];
+ size_t c1, realisation_count;
+ const char* dir = "../../yaml/";
+
+ ASSERT(base_name);
+ snprintf(ref_file_name, MAX_PATH, "%s%s.ref", dir, base_name);
+ ref_file = fopen(ref_file_name, "r");
+ if (!ref_file) {
+ res = RES_IO_ERR;
+ printf("Cannot open file '%s'\n", base_name);
+ goto end;
+ }
+ while (!feof(ref_file)) {
+ char cmd[128 + 3 * MAX_PATH];
+ double sun_angles[2];
+ char tested_file_name[L_tmpnam_s];
+#ifdef COMPILER_CL
+ const char* exe_name = "..\\Debug\\solstice.exe";
+#else
+ const char* exe_name = "../Debug/solstice.exe";
+#endif
+
+ res = get_dir_and_counts(ref_file, sun_angles, &c1, &realisation_count);
+ if (res != RES_OK) goto end;
+
+ res = create_tmp_file_name(tested_file_name);
+ if (res != RES_OK) goto end;
+
+ snprintf(cmd, sizeof(cmd),
+ "%s -o %s -f -D %g,%g -n %zu -R %s%s_receiver.yaml %s%s.yaml",
+ exe_name, tested_file_name, SPLIT2(sun_angles), realisation_count,
+ dir, base_name, dir, base_name);
+ if (system(cmd)) {
+ res = RES_BAD_ARG;
+ goto end;
+ }
+ res = check_references(ref_file, tested_file_name);
+ if (res != RES_OK) {
+ goto end;
+ }
+ }
+end:
+ if (ref_file) fclose(ref_file);
+ return res;
+}
+
+int
+main(int argc, char** argv)
+{
+ int err = 0;
+
+ if (argc != 2) goto usage;
+
+ if (RES_OK != do_check(argv[1]))
+ goto error;
+
+exit:
+ return err;
+usage:
+ printf("Usage: %s <file_base_name>\n", argv[0]);
+error:
+ err = 1;
+ goto exit;
+}
+
diff --git a/yaml/beam_down.ref b/yaml/beam_down.ref
@@ -0,0 +1,12 @@
+#--- Sun direction: 0 90 (-3.7494e-33 -6.12323e-17 -1)
+2 10000
+tower.secondary.hyperbol 10 465.464 0.00509812 0 0 0 0 0 0 0 0 0 0 34.5362 0.00509812 0 0 0.930847 1.01954e-05 0 0
+tower.receptor 14 465.464 0.00509812 -1 -1 0 0 -1 -1 0 0 -1 -1 34.5362 0.00509812 -1 -1 0.930847 1.01954e-05 -1 -1
+0 0
+0 0
+#--- Sun direction: 50 50 (-0.413176 -0.492404 -0.766044)
+2 10000
+tower.secondary.hyperbol 10 400.231 0.107226 0 0 0 0 0 0 0 0 0 0 99.7686 0.107226 0 0 0.800393 0.000214433 0 0
+tower.receptor 14 136.51 1.90718 -1 -1 0 0 -1 -1 0 0 -1 -1 32.9896 0.464742 -1 -1 0.272997 0.00381404 -1 -1
+0 0
+0 0
diff --git a/yaml/beam_down.yaml b/yaml/beam_down.yaml
@@ -0,0 +1,108 @@
+# Debug/solstice -D 90,90 -R ../yaml/beam_down_receiver.yaml ../yaml/beam_down.yaml
+# Debug/solstice -D 90,90 -r pos=-100,-100,50:tgt=0,0,50:up=0,0,1:img=1000x800 -o ../yaml/beam_down.ppm -f ../yaml/beam_down.yaml
+#
+# 1 10000
+# tower.receptor 14 465.464 0.00509812 -1 -1 0 0 -1 -1 0 0 -1 -1 34.5362 0.00509812 -1 -1 0.930847 1.01954e-05 -1 -1
+# 0 0
+# 0 0
+# --- Sun direction: -3.7494e-33 -6.12323e-17 -1
+
+- sun: &sun { dni: 1, spectrum: [{wavelength: 1, data: 1}] }
+
+- material: &mirror { mirror: { reflectivity: 1, roughness: 0 } }
+- material: &black { matte: { reflectivity: 0 } }
+- material: &virtual { virtual: }
+
+- template: &hyperbol
+ name: hyperbol
+ primary: 0
+ geometry:
+ - hyperbol:
+ focals: &hyperbol_focals { real: 100, image: 20 }
+ clip:
+ - operation: AND
+ #vertices: [[-25, -25], [-25, 25], [25, 25], [25, -25]]
+ vertices: [[-5, 0], [20, -10], [35, 0], [20, 10]]
+ material: { front: *mirror, back: *virtual }
+ anchors:
+ - name: image_point
+ hyperboloid_image_focals: *hyperbol_focals
+
+- geometry: &target
+ - plane:
+ clip:
+ - operation: AND
+ vertices: [[-2.5, -2.5], [-2.5, 2.5], [2.5, 2.5], [2.5, -2.5]]
+ #vertices: [[-1, -1], [-1, 1], [1, 1], [1, -1]]
+ #vertices: [[-.5, -.5], [-.5, .5], [.5, .5], [.5, -.5]]
+ #vertices: [[-.1, -.1], [-.1, .1], [.1, .1], [.1, -.1]]
+ material: *black
+
+- geometry: &primary150
+ - parabol:
+ focal: 150
+ clip:
+ - operation: AND
+ vertices: [[-5, -5], [-5, 5], [5, 5], [5, -5]]
+ #vertices: [[-3, -3], [-3, 3], [3, 3], [3, -3]]
+ #vertices: [[-2, -2], [-2, 2], [2, 2], [2, -2]]
+ #vertices: [[-1, -1], [-1, 1], [1, 1], [1, -1]]
+ #vertices: [[-.01, -.01], [-.01, .01], [.01, .01], [.01, -.01]]
+ material: *mirror
+
+- template: &temp_heliostat150
+ name: "temp-heliostat150"
+ primary: 0
+ geometry:
+ - cylinder: { radius: 0.3, height: 10 }
+ transform: { translation: [0, 0, 5] }
+ material: *black
+ children:
+ - name: "pivot"
+ transform: { translation: [0, 0, 10] }
+ zx_pivot:
+ spacing: 1
+ target: { anchor: tower.secondary.hyperbol.image_point }
+ children:
+ - name: "reflector"
+ transform: { rotation: [-90, 0, 0] }
+ primary: 1
+ geometry: *primary150
+
+- entity:
+ name: "tower"
+ children:
+ - name: secondary
+ children: [ *hyperbol ]
+ transform: { translation: [ 0, 0, 100 ] }
+ - name: receptor
+ geometry: *target
+ primary: 0
+ - name: "building"
+ primary: 0
+ geometry:
+ - cylinder: { radius: 1, height: 110 }
+ transform: { translation: [-4, 0, 55] }
+ material: *black
+
+- entity:
+ name: "heliostat1"
+ transform: { translation: [100, -30, 0] }
+ children: [ *temp_heliostat150 ]
+- entity:
+ name: "heliostat2"
+ transform: { translation: [101, -15, 0] }
+ children: [ *temp_heliostat150 ]
+- entity:
+ name: "heliostat3"
+ transform: { translation: [102, 0, 0] }
+ children: [ *temp_heliostat150 ]
+- entity:
+ name: "heliostat4"
+ transform: { translation: [101, 15, 0] }
+ children: [ *temp_heliostat150 ]
+- entity:
+ name: "heliostat5"
+ transform: { translation: [100, 30, 0] }
+ children: [ *temp_heliostat150 ]
+
+\ No newline at end of file
diff --git a/yaml/beam_down_receiver.yaml b/yaml/beam_down_receiver.yaml
@@ -0,0 +1,2 @@
+- { name: "tower.receptor", side: FRONT }
+- { name: "tower.secondary.hyperbol" }
+\ No newline at end of file
diff --git a/yaml/test01.ref b/yaml/test01.ref
@@ -0,0 +1,5 @@
+#--- Sun direction: 0 90 (-6.12323e-17 -0 -1)
+1 10000
+square_receiver 2 -1 -1 1 0 -1 -1 0 0 -1 -1 0 0 -1 -1 0 0 -1 -1 1 0
+0 0
+0 0
diff --git a/yaml/test01.yaml b/yaml/test01.yaml
@@ -0,0 +1,50 @@
+- sun: &sun
+ dni: 1
+ spectrum: [{wavelength: 1, data: 1}]
+
+- material: &specular
+ front:
+ mirror: { reflectivity: 1, roughness: 0 }
+ back:
+ mirror: { reflectivity: 1, roughness: 0 }
+
+
+- geometry: &small_square
+ - material: *specular
+ plane:
+ clip:
+ - operation: AND
+ vertices:
+ - [-0.50, -0.50]
+ - [-0.50, 0.50]
+ - [0.50, 0.50]
+ - [0.50, -0.50]
+
+- geometry: &big_square
+ - material: { virtual: }
+ plane:
+ clip:
+ - operation: AND
+ vertices:
+ - [-5.00, -5.00]
+ - [-5.00, 5.00]
+ - [5.00, 5.00]
+ - [5.00, -5.00]
+
+
+- entity:
+ name: "reflector"
+ primary: 1
+ transform: { rotation: [0, 0, 0], translation: [0, 0, 0] }
+ geometry: *small_square
+
+
+
+- entity:
+ name: "square_receiver"
+ primary: 0
+ transform: { rotation: [0, 0, 0], translation: [0, 0, 2] }
+ geometry: *big_square
+
+
+
diff --git a/yaml/test01_receiver.yaml b/yaml/test01_receiver.yaml
@@ -0,0 +1 @@
+- { name: "square_receiver", side: BACK }
diff --git a/yaml/test02.ref b/yaml/test02.ref
@@ -0,0 +1,5 @@
+#--- Sun direction: 0 90 (-6.12323e-17 -0 -1)
+1 100000
+square_receiver 2 -1 -1 1 0.0313065 -1 -1 0 0 -1 -1 0 0 -1 -1 0 0 -1 -1 0.01003 0.000315109
+0 0
+99 0.0313065
diff --git a/yaml/test02.yaml b/yaml/test02.yaml
@@ -0,0 +1,47 @@
+- sun: &sun
+ dni: 1
+ spectrum: [{wavelength: 1, data: 1}]
+
+- material: &specular
+ mirror: { reflectivity: 1, roughness: 0 }
+
+
+- geometry: &small_square
+ - material: { virtual: }
+ plane:
+ clip:
+ - operation: AND
+ vertices:
+ - [-0.50, -0.50]
+ - [-0.50, 0.50]
+ - [0.50, 0.50]
+ - [0.50, -0.50]
+
+- geometry: &big_square
+ - material: *specular
+ plane:
+ clip:
+ - operation: AND
+ vertices:
+ - [-5.00, -5.00]
+ - [-5.00, 5.00]
+ - [5.00, 5.00]
+ - [5.00, -5.00]
+
+
+- entity:
+ name: "reflector"
+ primary: 1
+ transform: { rotation: [0, 0, 0], translation: [0, 0, 0] }
+ geometry: *big_square
+
+
+
+- entity:
+ name: "square_receiver"
+ primary: 0
+ transform: { rotation: [0, 0, 0], translation: [0, 0, 2] }
+ geometry: *small_square
+
+
+
diff --git a/yaml/test02_receiver.yaml b/yaml/test02_receiver.yaml
@@ -0,0 +1 @@
+- { name: "square_receiver", side: BACK }
diff --git a/yaml/test03.ref b/yaml/test03.ref
@@ -0,0 +1,5 @@
+#--- Sun direction: 0 45 (-0.707107 -0 -0.707107)
+1 10000
+square_receiver 2 -1 -1 0.707107 0 -1 -1 0 0 -1 -1 0 0 -1 -1 0.292893 0 -1 -1 0.707107 0
+0 0
+0 0
diff --git a/yaml/test03.yaml b/yaml/test03.yaml
@@ -0,0 +1,49 @@
+- sun: &sun
+ dni: 1
+ spectrum: [{wavelength: 1, data: 1}]
+
+- material: &specular
+ front:
+ mirror: { reflectivity: 1, roughness: 0 }
+ back:
+ mirror: { reflectivity: 1, roughness: 0 }
+
+- geometry: &small_square
+ - material: *specular
+ plane:
+ clip:
+ - operation: AND
+ vertices:
+ - [-0.50, -0.50]
+ - [-0.50, 0.50]
+ - [0.50, 0.50]
+ - [0.50, -0.50]
+
+- geometry: &big_square
+ - material: { virtual: }
+ plane:
+ clip:
+ - operation: AND
+ vertices:
+ - [-5.00, -5.00]
+ - [-5.00, 5.00]
+ - [5.00, 5.00]
+ - [5.00, -5.00]
+
+
+- entity:
+ name: "reflector"
+ primary: 1
+ transform: { rotation: [0, 0, 0], translation: [0, 0, 0] }
+ geometry: *small_square
+
+
+
+- entity:
+ name: "square_receiver"
+ primary: 0
+ transform: { rotation: [0, 0, 0], translation: [-2, 0, 2] }
+ geometry: *big_square
+
+
+
diff --git a/yaml/test03_receiver.yaml b/yaml/test03_receiver.yaml
@@ -0,0 +1 @@
+- { name: "square_receiver", side: BACK }
diff --git a/yaml/test04.ref b/yaml/test04.ref
@@ -0,0 +1,4 @@
+#--- Sun direction: 0 45 (-0.707107 -0 -0.707107)
+1 10000
+square_receiver 2 0 0 0.707107 0 0 0 0 0 0 0 0 0 0 0 0.292893 0 0 0 0.707107 0
+0 0
diff --git a/yaml/test04.yaml b/yaml/test04.yaml
@@ -0,0 +1,52 @@
+- sun: &sun
+ dni: 1
+ spectrum: [{wavelength: 1, data: 1}]
+
+- material: &specular
+ front:
+ mirror: { reflectivity: 1, roughness: 0 }
+ back:
+ mirror: { reflectivity: 1, roughness: 0 }
+
+- material: &black
+ matte: { reflectivity: 0 }
+
+- geometry: &small_square
+ - material: *specular
+ plane:
+ clip:
+ - operation: AND
+ vertices:
+ - [-0.50, -0.50]
+ - [-0.50, 0.50]
+ - [0.50, 0.50]
+ - [0.50, -0.50]
+
+- geometry: &big_square
+ - material: { virtual: }
+ plane:
+ clip:
+ - operation: AND
+ vertices:
+ - [-5.00, -5.00]
+ - [-5.00, 5.00]
+ - [5.00, 5.00]
+ - [5.00, -5.00]
+
+
+- entity:
+ name: "reflector"
+ primary: 1
+ transform: { rotation: [0, 0, 0], translation: [0, 0, 0] }
+ geometry: *small_square
+
+
+
+- entity:
+ name: "square_receiver"
+ primary: 0
+ transform: { rotation: [0, -45, 0], translation: [-2, 0, 2] }
+ geometry: *big_square
+
+
+
diff --git a/yaml/test04_receiver.yaml b/yaml/test04_receiver.yaml
@@ -0,0 +1 @@
+- { name: "square_receiver", side: FRONT_AND_BACK }
diff --git a/yaml/test05.ref b/yaml/test05.ref
@@ -0,0 +1,5 @@
+#--- Sun direction: 0 90 (-6.12323e-17 -0 -1)
+1 10000
+spherical_receiver 2 -1 -1 1 0 -1 -1 0 0 -1 -1 0 0 -1 -1 0 0 -1 -1 1 0
+0 0
+0 0
diff --git a/yaml/test05.yaml b/yaml/test05.yaml
@@ -0,0 +1,44 @@
+- sun: &sun
+ dni: 1
+ spectrum: [{wavelength: 1, data: 1}]
+
+- material: &lambertian
+ front:
+ matte: { reflectivity: 1 }
+ back:
+ matte: { reflectivity: 1 }
+
+- geometry: &small_square
+ - material: *lambertian
+ plane:
+ clip:
+ - operation: AND
+ vertices:
+ - [-0.50, -0.50]
+ - [-0.50, 0.50]
+ - [0.50, 0.50]
+ - [0.50, -0.50]
+
+- geometry: &big_sphere
+ - material: { virtual: }
+ sphere:
+ radius: 2.0
+ slices: 128
+
+
+- entity:
+ name: "reflector"
+ primary: 1
+ transform: { rotation: [0, 0, 0], translation: [0, 0, 0] }
+ geometry: *small_square
+
+
+
+- entity:
+ name: "spherical_receiver"
+ primary: 0
+ transform: { rotation: [0, 0, 0], translation: [0, 0, 0] }
+ geometry: *big_sphere
+
+
+
diff --git a/yaml/test05_receiver.yaml b/yaml/test05_receiver.yaml
@@ -0,0 +1 @@
+- { name: "spherical_receiver", side: BACK }