Set status for new links in EN_addlink

Status is OPEN for pumps\pipes\CV and ACTIVE for valves. Closes #173
This commit is contained in:
Elad Salomons
2018-08-29 22:31:28 +03:00
parent bcd6877935
commit dbdafd6352

View File

@@ -4806,6 +4806,7 @@ int DLLEXPORT EN_addlink(EN_ProjectHandle ph, char *id, EN_LinkType linkType, ch
link->Type = linkType; link->Type = linkType;
link->N1 = N1; link->N1 = N1;
link->N2 = N2; link->N2 = N2;
link->Stat = OPEN;
if (linkType == EN_PUMP) { if (linkType == EN_PUMP) {
link->Kc = 1.0; // Speed factor 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->Kc = 0.0; // Valve setting.
link->Km = 0.0; // Loss coeff link->Km = 0.0; // Loss coeff
link->Len = 0.0; link->Len = 0.0;
link->Stat = ACTIVE;
} }
// link->Len = 0.0;
// link->Kc = 0.01;
// link->Km = 0;
link->Kb = 0; link->Kb = 0;
link->Kw = 0; link->Kw = 0;
link->R = 0; link->R = 0;
link->Rc = 0; link->Rc = 0;
link->Rpt = 0; link->Rpt = 0;
if (linkType == EN_CVPIPE) {
link->Stat = OPEN;
}
else {
link->Stat = CLOSED;
}
ENHashTableInsert(net->LinkHashTable, link->ID, n); ENHashTableInsert(net->LinkHashTable, link->ID, n);
return set_error(p->error_handle, 0); return set_error(p->error_handle, 0);
} }