commit 9343141199b4fddada96c800ddd43dd7decbbb8c
parent 2e6152dbb79cd296e20ea4826a972c496a59902f
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Fri, 24 Mar 2017 17:16:02 +0100
Adapt to last solver changes; ref files for tests still to be adapted.
Diffstat:
11 files changed, 92 insertions(+), 34 deletions(-)
diff --git a/src/solstice.h b/src/solstice.h
@@ -40,7 +40,6 @@ struct solstice_receiver {
struct solstice_primary {
struct solstice_node* node;
- double n[3];
};
#define DARRAY_NAME nodes
diff --git a/src/solstice_entity.c b/src/solstice_entity.c
@@ -30,20 +30,13 @@ update_instance_transform
{
res_T res = RES_OK;
struct solstice_node* node;
- struct solstice_primary* prim;
- struct solstice* solstice = data;
ASSERT(n && transform && data);
-
+ (void)data;
node = CONTAINER_OF(n, struct solstice_node, anim);
if(node->type != SOLSTICE_NODE_GEOMETRY) return RES_OK;
res = ssol_instance_set_transform(node->instance, transform);
if(res != RES_OK) goto error;
- prim = htable_primary_find(&solstice->primaries, &node->name);
- if(prim) {
- SSOL(instance_get_normal(prim->node->instance, prim->n));
- d3_normalize(prim->n, prim->n);
- }
exit:
return res;
error:
diff --git a/src/solstice_solve.c b/src/solstice_solve.c
@@ -30,7 +30,7 @@ write_mc_global(struct solstice* solstice, struct ssol_estimator* estimator)
struct htable_primary_iterator p_it, p_end;
const struct solparser_sun* solparser_sun = NULL;
size_t nexperiments, nfailed, nprimary;
- double irradiance_factor;
+ double area, potential, irradiance_factor;
ASSERT(solstice && estimator);
#define MC_RCV_NONE { \
@@ -46,25 +46,34 @@ write_mc_global(struct solstice* solstice, struct ssol_estimator* estimator)
SSOL(estimator_get_realisation_count(estimator, &nexperiments));
SSOL(estimator_get_sampled_count(estimator, &nprimary));
SSOL(estimator_get_failed_count(estimator, &nfailed));
- SSOL(estimator_get_sampled_area(estimator, &irradiance_factor));
+ SSOL(estimator_get_sampled_area(estimator, &area));
solparser_sun = solparser_get_sun(solstice->parser);
- irradiance_factor = 1.0 / (solparser_sun->dni * irradiance_factor);
+ potential = solparser_sun->dni * area;
+ irradiance_factor = 1 / potential;
/* Counts */
fprintf(solstice->output, "%lu %lu %lu %lu %lu\n",
- 3, /* #global results count */
+ 7, /* #global results count */
(unsigned long)htable_receiver_size_get(&solstice->receivers),
(unsigned long)nprimary,
(unsigned long)nexperiments,
(unsigned long)nfailed);
/* Global data */
+ fprintf(solstice->output, "%g %g # Potential\n",
+ potential, 0.);
+ fprintf(solstice->output, "%g %g # Absorbed\n",
+ mc_global.absorbed.E, mc_global.absorbed.SE);
+ fprintf(solstice->output, "%g %g # Cos\n",
+ mc_global.cos_factor.E, mc_global.cos_factor.SE);
fprintf(solstice->output, "%g %g # Shadowing\n",
mc_global.shadowed.E, mc_global.shadowed.SE);
fprintf(solstice->output, "%g %g # Missing\n",
mc_global.missing.E, mc_global.missing.SE);
- fprintf(solstice->output, "%g %g # Cos\n",
- mc_global.cos_factor.E, mc_global.cos_factor.SE);
+ fprintf(solstice->output, "%g %g # Atmosphere\n",
+ mc_global.atmosphere.E, mc_global.atmosphere.SE);
+ fprintf(solstice->output, "%g %g # Reflectivity\n",
+ mc_global.reflectivity.E, mc_global.reflectivity.SE);
/* Receivers' data */
htable_receiver_begin(&solstice->receivers, &r_it);
@@ -102,11 +111,12 @@ write_mc_global(struct solstice* solstice, struct ssol_estimator* estimator)
default: FATAL("Unreachable code.\n"); break;
}
SSOL(instance_get_id(inst, &id));
+ SSOL(instance_get_area(inst, &area));
fprintf(solstice->output,
- "%s %u "
+ "%s %u %g "
"FRONT: %g %g %g %g %g %g %g %g %g %g "
"BACK: %g %g %g %g %g %g %g %g %g %g\n",
- str_cget(name), (unsigned)id,
+ str_cget(name), (unsigned)id, area,
front.integrated_absorbed_irradiance.E, front.integrated_absorbed_irradiance.SE,
front.integrated_irradiance.E, front.integrated_irradiance.SE,
front.reflectivity_loss.E, front.reflectivity_loss.SE,
@@ -126,20 +136,17 @@ write_mc_global(struct solstice* solstice, struct ssol_estimator* estimator)
const struct str* name = htable_primary_iterator_key_get(&p_it);
struct solstice_primary* prim = htable_primary_iterator_data_get(&p_it);
struct ssol_mc_sampled sampled;
- double a, c, sun[3];
uint32_t id;
- SSOL(sun_get_direction(solstice->sun, sun));
- c = -d3_dot(prim->n, sun);
htable_primary_iterator_next(&p_it);
SSOL(estimator_get_mc_sampled(estimator, prim->node->instance, &sampled));
SSOL(instance_get_id(prim->node->instance, &id));
- SSOL(instance_get_area(prim->node->instance, &a));
+ SSOL(instance_get_area(prim->node->instance, &area));
fprintf(solstice->output,
- "%s %u "
- "%g %g %lu %g %g\n",
- str_cget(name), (unsigned) id,
- a, c, (unsigned long)sampled.nb_samples,
+ "%s %u %g %lu "
+ "%g %g %g %g\n",
+ str_cget(name), (unsigned) id, area, (unsigned long)sampled.nb_samples,
+ sampled.cos_factor.E, sampled.cos_factor.SE,
sampled.shadowed.E, sampled.shadowed.SE
);
}
diff --git a/src/test_solstice_simulation.c b/src/test_solstice_simulation.c
@@ -39,6 +39,7 @@ enum side {
};
enum global_result_type {
+ GLOBAL_POTENTIAL,
GLOBAL_SHADOW,
GLOBAL_MISSING,
GLOBAL_COS,
diff --git a/yaml/beam_down.ref b/yaml/beam_down.ref
@@ -1,10 +1,11 @@
#--- Sun direction: 90 90 (-3.7494e-33 -6.12323e-17 -1)
-3 2 5 10000 0
+4 2 5 10000 0
+500 0 # Potential
0 0 # Shadowing
0 0 # Missing
0.92387953251128675612818318939679 0.1 # Cos
tower.secondary.hyperbol 10 FRONT: 0 0 465.464 0.00509812 0 0 0 0 0 0 BACK: 0 0 0 0 0 0 0 0 0 0
-tower.receptor 14 FRONT: 465.464 0.00509812 465.464 0.00509812 0 0 0 0 0.930847 1.01954e-05 BACK: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
+tower.receptor 14 FRONT: 465.464 0.00509812 465.464 0.00509812 0 0 0 0 0.930928 1.01962e-05 BACK: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
heliostat4.temp-heliostat150.pivot.reflector 6 100.009 0.931729 1999 0 0
heliostat5.temp-heliostat150.pivot.reflector 30 100.009 0.929682 1986 0 0
heliostat3.temp-heliostat150.pivot.reflector 22 100.009 0.931826 1997 0 0
@@ -20,8 +21,35 @@ heliostat1.temp-heliostat150.pivot.reflector 34 100.009 0.929682 2024 0 0
14 22 FRONT: 93.0428 1.8626 93.0428 1.8626 0 0 0 0 BACK: -1 -1 -1 -1 -1 -1 -1 -1
14 26 FRONT: 92.8934 1.86136 92.8934 1.86136 0 0 0 0 BACK: -1 -1 -1 -1 -1 -1 -1 -1
14 34 FRONT: 94.0838 1.86768 94.0838 1.86768 0 0 0 0 BACK: -1 -1 -1 -1 -1 -1 -1 -1
+
+
+#--- Sun direction: 90 90 (-3.7494e-33 -6.12323e-17 -1)
+4 2 5 10000 0
+500 0 # Potential
+0 0 # Shadowing
+0 0 # Missing
+0.930928 1.01962e-05 # Cos
+tower.secondary.hyperbol 10 FRONT: 0 0 465.464 0.00509812 0 0 0 0 0 0 BACK: 0 0 0 0 0 0 0 0 0 0
+tower.receptor 14 FRONT: 465.464 0.00509812 465.464 0.00509812 0 0 0 0 0.930928 1.01962e-05 BACK: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
+heliostat4.temp-heliostat150.pivot.reflector 6 100.009 0.931729 1999 0 0
+heliostat5.temp-heliostat150.pivot.reflector 30 100.009 0.929682 1986 0 0
+heliostat3.temp-heliostat150.pivot.reflector 22 100.009 0.931826 1997 0 0
+heliostat2.temp-heliostat150.pivot.reflector 26 100.009 0.931729 1994 0 0
+heliostat1.temp-heliostat150.pivot.reflector 34 100.009 0.929682 2024 0 0
+10 6 FRONT: 0 0 93.1263 1.86311 0 0 0 0 BACK: 0 0 0 0 0 0 0 0
+10 30 FRONT: 0 0 92.3174 1.85447 0 0 0 0 BACK: 0 0 0 0 0 0 0 0
+10 22 FRONT: 0 0 93.0428 1.8626 0 0 0 0 BACK: 0 0 0 0 0 0 0 0
+10 26 FRONT: 0 0 92.8934 1.86136 0 0 0 0 BACK: 0 0 0 0 0 0 0 0
+10 34 FRONT: 0 0 94.0838 1.86768 0 0 0 0 BACK: 0 0 0 0 0 0 0 0
+14 6 FRONT: 93.1263 1.86311 93.1263 1.86311 0 0 0 0 BACK: -1 -1 -1 -1 -1 -1 -1 -1
+14 30 FRONT: 92.3174 1.85447 92.3174 1.85447 0 0 0 0 BACK: -1 -1 -1 -1 -1 -1 -1 -1
+14 22 FRONT: 93.0428 1.8626 93.0428 1.8626 0 0 0 0 BACK: -1 -1 -1 -1 -1 -1 -1 -1
+14 26 FRONT: 92.8934 1.86136 92.8934 1.86136 0 0 0 0 BACK: -1 -1 -1 -1 -1 -1 -1 -1
+14 34 FRONT: 94.0838 1.86768 94.0838 1.86768 0 0 0 0 BACK: -1 -1 -1 -1 -1 -1 -1 -1
+
#--- Sun direction: 50 50 (-0.413176 -0.492404 -0.766044)
-3 2 5 10000 0
+4 2 5 10000 0
+500 0 # Potential
0 0 # Shadowing
0 0 # Missing
0.8 0.1 # Cos
@@ -42,3 +70,27 @@ heliostat1.temp-heliostat150.pivot.reflector 34 100.009 0.830503 2002 0 0
14 22 FRONT: 24.7182 0.963099 24.7182 0.963099 0 0 0 0 BACK: -1 -1 -1 -1 -1 -1 -1 -1
14 26 FRONT: 33.4127 1.1187 33.4127 1.1187 0 0 0 0 BACK: -1 -1 -1 -1 -1 -1 -1 -1
14 34 FRONT: 37.871 1.19548 37.871 1.19548 0 0 0 0 BACK: -1 -1 -1 -1 -1 -1 -1 -1
+
+#--- Sun direction: 50 50 (-0.413176 -0.492404 -0.766044)
+4 2 5 10000 0
+500 0 # Potential
+0 0 # Shadowing
+0 0 # Missing
+0.800401 0.000214106 # Cos
+tower.secondary.hyperbol 10 FRONT: 0 0 400.201 0.107053 0 0 0 0 0 0 BACK: 0 0 0 0 0 0 0 0 0 0
+tower.receptor 14 FRONT: 139.122 1.91583 139.122 1.91583 0 0 0 0 0.278244 0.00383167 BACK: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
+heliostat4.temp-heliostat150.pivot.reflector 6 100.009 0.78531 2059 0 0
+heliostat5.temp-heliostat150.pivot.reflector 30 100.009 0.769863 1943 0 0
+heliostat3.temp-heliostat150.pivot.reflector 22 100.009 0.799943 2010 0 0
+heliostat2.temp-heliostat150.pivot.reflector 26 100.009 0.815939 1972 0 0
+heliostat1.temp-heliostat150.pivot.reflector 34 100.009 0.830503 2016 0 0
+10 6 FRONT: 0 0 80.8477 1.58773 0 0 0 0 BACK: 0 0 0 0 0 0 0 0
+10 30 FRONT: 0 0 74.7922 1.52302 0 0 0 0 BACK: 0 0 0 0 0 0 0 0
+10 22 FRONT: 0 0 80.3943 1.60288 0 0 0 0 BACK: 0 0 0 0 0 0 0 0
+10 26 FRONT: 0 0 80.4516 1.62325 0 0 0 0 BACK: 0 0 0 0 0 0 0 0
+10 34 FRONT: 0 0 83.7147 1.66597 0 0 0 0 BACK: 0 0 0 0 0 0 0 0
+14 6 FRONT: 23.0096 0.922247 23.0096 0.922247 0 0 0 0 BACK: -1 -1 -1 -1 -1 -1 -1 -1
+14 30 FRONT: 18.6692 0.826911 18.6692 0.826911 0 0 0 0 BACK: -1 -1 -1 -1 -1 -1 -1 -1
+14 22 FRONT: 25.6382 0.979654 25.6382 0.979654 0 0 0 0 BACK: -1 -1 -1 -1 -1 -1 -1 -1
+14 26 FRONT: 32.1072 1.09854 32.1072 1.09854 0 0 0 0 BACK: -1 -1 -1 -1 -1 -1 -1 -1
+14 34 FRONT: 39.6981 1.22101 39.6981 1.22101 0 0 0 0 BACK: -1 -1 -1 -1 -1 -1 -1 -1
diff --git a/yaml/test01.ref b/yaml/test01.ref
@@ -1,5 +1,6 @@
#--- Sun direction: 0 90 (-6.12323e-17 -0 -1)
-3 1 1 10000 0
+4 1 1 10000 0
+1 0 # Potential
0 0 # Shadowing
0 0 # Missing
1 0 # Cos
diff --git a/yaml/test02.ref b/yaml/test02.ref
@@ -1,5 +1,6 @@
#--- Sun direction: 0 90 (-6.12323e-17 -0 -1)
-3 1 1 100000 0
+4 1 1 100000 0
+100 0 # Potential
0 0 # Shadowing
99 0.0313065 # Missing
1 0 # Cos
diff --git a/yaml/test03.ref b/yaml/test03.ref
@@ -1,5 +1,6 @@
#--- Sun direction: 0 45 (-0.707107 -0 -0.707107)
-3 1 1 10000 0
+4 1 1 10000 0
+1 0 # Potential
0 0 # Shadowing
0 0 # Missing
0.707107 0 # Cos
diff --git a/yaml/test04.ref b/yaml/test04.ref
@@ -1,5 +1,6 @@
#--- Sun direction: 0 45 (-0.707107 -0 -0.707107)
-3 1 1 10000 0
+4 1 1 10000 0
+1 0 # Potential
0 0 # Shadowing
0 0 # Missing
0.707107 0 # Cos
diff --git a/yaml/test05.ref b/yaml/test05.ref
@@ -1,5 +1,6 @@
#--- Sun direction: 0 90 (-6.12323e-17 -0 -1)
-3 1 1 10000 0
+4 1 1 10000 0
+1 0 # Potential
0 0 # Shadowing
0 0 # Missing
1 0 # Cos
diff --git a/yaml/test06.ref b/yaml/test06.ref
@@ -1,5 +1,6 @@
#--- Sun direction: 0 63 (-0.45399 -0 -0.891007)
-3 1 1 10000 0
+4 1 1 10000 0
+100 0 # Potential
0 0 # Shadowing
0 0 # Missing
1 0 # Cos