Set status for new links in EN_addlink
Status is OPEN for pumps\pipes\CV and ACTIVE for valves. Closes
@@ -4806,6 +4806,7 @@ int DLLEXPORT EN_addlink(EN_ProjectHandle ph, char *id, EN_LinkType linkType, ch
link->Type = linkType;
link->N1 = N1;
link->N2 = N2;
+ link->Stat = OPEN;
if (linkType == EN_PUMP) {
link->Kc = 1.0; // Speed factor
@@ -4821,23 +4822,14 @@ int DLLEXPORT EN_addlink(EN_ProjectHandle ph, char *id, EN_LinkType linkType, ch
link->Kc = 0.0; // Valve setting.
link->Km = 0.0; // Loss coeff
link->Len = 0.0;
+ link->Stat = ACTIVE;
}
- // link->Len = 0.0;
- // link->Kc = 0.01;
- // link->Km = 0;
link->Kb = 0;
link->Kw = 0;
link->R = 0;
link->Rc = 0;
link->Rpt = 0;
- if (linkType == EN_CVPIPE) {
- link->Stat = OPEN;
- }
- else {
- link->Stat = CLOSED;
- }
-
ENHashTableInsert(net->LinkHashTable, link->ID, n);
return set_error(p->error_handle, 0);
}
