From a984ac1a4d72b7fda82784428b32d38e39e4b916 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 2 Jul 2021 10:51:44 -0400 Subject: [PATCH] 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. --- VERSION | 2 +- base/netcmp.c | 16 ++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/VERSION b/VERSION index af0cfc2..03367c8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.191 +1.5.192 diff --git a/base/netcmp.c b/base/netcmp.c index 4ea9003..1508353 100644 --- a/base/netcmp.c +++ b/base/netcmp.c @@ -5020,11 +5020,8 @@ int PropertyOptimize(struct objlist *ob, struct nlist *tp, int run, int series, for (p = 1; p < pcount; p++) { vl = vlist[p][i]; ctype = clist[p][i]; + 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 */ if (cvl && (cvl->type == PROP_INTEGER)) { @@ -5042,26 +5039,25 @@ int PropertyOptimize(struct objlist *ob, struct nlist *tp, int run, int series, else cvl->value.dval += vl->value.dval; } - changed += mult; } 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) { vl->type = PROP_DOUBLE; 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)) { cvl->type = PROP_DOUBLE; cvl->value.dval = (double)cvl->value.ival; } - if ((cvl && vl->type == PROP_DOUBLE)) { + if ((cvl && (vl->type == PROP_DOUBLE))) { cvl->value.dval = sqrt(cvl->value.dval * cvl->value.dval + vl->value.dval * vl->value.dval); } - changed += mult; } } }