Corrected an error in a recent update that handles the case where

a final parallel or series combination needs to be done but there
are still multiple property records.  The multiplier was being
incorrectly applied twice, causing an automatic mismatch in
parameter values.
This commit is contained in:
Tim Edwards 2021-07-02 10:51:44 -04:00
parent 738c1f7b37
commit a984ac1a4d
2 changed files with 7 additions and 11 deletions

View File

@ -1 +1 @@
1.5.191 1.5.192

View File

@ -5020,11 +5020,8 @@ int PropertyOptimize(struct objlist *ob, struct nlist *tp, int run, int series,
for (p = 1; p < pcount; p++) { for (p = 1; p < pcount; p++) {
vl = vlist[p][i]; vl = vlist[p][i];
ctype = clist[p][i]; ctype = clist[p][i];
if (ctype & (MERGE_S_ADD | MERGE_P_ADD)) { if (ctype & (MERGE_S_ADD | MERGE_P_ADD)) {
if (vl->type == PROP_INTEGER)
vl->value.ival *= mult;
else if (vl->type == PROP_DOUBLE)
vl->value.dval *= (double)mult;
vlist[0][i]->value.ival = 0; /* set M to 0 */ vlist[0][i]->value.ival = 0; /* set M to 0 */
if (cvl && (cvl->type == PROP_INTEGER)) if (cvl && (cvl->type == PROP_INTEGER))
{ {
@ -5042,26 +5039,25 @@ int PropertyOptimize(struct objlist *ob, struct nlist *tp, int run, int series,
else else
cvl->value.dval += vl->value.dval; cvl->value.dval += vl->value.dval;
} }
changed += mult;
} }
else if (ctype & (MERGE_S_PAR | MERGE_P_PAR)) { else if (ctype & (MERGE_S_PAR | MERGE_P_PAR)) {
vlist[0][i]->value.ival = 0; /* set M to 0 */
/* To do parallel combination, both types need to
* be double, so recast them if they are integer.
*/
if (vl->type == PROP_INTEGER) { if (vl->type == PROP_INTEGER) {
vl->type = PROP_DOUBLE; vl->type = PROP_DOUBLE;
vl->value.dval = (double)(vl->value.ival); vl->value.dval = (double)(vl->value.ival);
} }
if (vl->type == PROP_DOUBLE)
vl->value.dval /= (double)mult;
vlist[0][i]->value.ival = 0; /* set M to 0 */
if (cvl && (cvl->type == PROP_INTEGER)) { if (cvl && (cvl->type == PROP_INTEGER)) {
cvl->type = PROP_DOUBLE; cvl->type = PROP_DOUBLE;
cvl->value.dval = (double)cvl->value.ival; cvl->value.dval = (double)cvl->value.ival;
} }
if ((cvl && vl->type == PROP_DOUBLE)) { if ((cvl && (vl->type == PROP_DOUBLE))) {
cvl->value.dval = cvl->value.dval =
sqrt(cvl->value.dval * cvl->value.dval sqrt(cvl->value.dval * cvl->value.dval
+ vl->value.dval * vl->value.dval); + vl->value.dval * vl->value.dval);
} }
changed += mult;
} }
} }
} }