Network building enhancements

This commit is contained in:
Lew Rossman
2020-02-04 10:01:23 -05:00
parent 77243b1607
commit 80f9acfe4d
16 changed files with 188 additions and 93 deletions

View File

@@ -7,7 +7,7 @@
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 11/15/2019
Last Updated: 02/03/2020
******************************************************************************
*/
@@ -795,6 +795,34 @@ int valvecheck(Project *pr, int index, int type, int j1, int j2)
return 0;
}
int unlinked(Project *pr)
/*
**--------------------------------------------------------------
** Input: none
** Output: returns error code if any unlinked junctions found
** Purpose: checks for unlinked junctions in network
**
** NOTE: unlinked tanks have no effect on computations.
**--------------------------------------------------------------
*/
{
Network *net = &pr->network;
int i, count = 0;
for (i = 1; i <= net->Njuncs; i++)
{
if (pr->network.Adjlist[i] == NULL)
{
count++;
sprintf(pr->Msg, "Error 233: %s %s", geterrmsg(233, pr->Msg), net->Node[i].ID);
writeline(pr, pr->Msg);
}
if (count >= 10) break;
}
if (count > 0) return 233;
return 0;
}
int findnode(Network *network, char *id)
/*----------------------------------------------------------------
** Input: id = node ID
@@ -912,8 +940,8 @@ void adjustpattern(int *pat, int index)
**----------------------------------------------------------------
*/
{
if (*pat == index) *pat = 0;
else if (*pat > index) (*pat)--;
if (*pat == index) *pat = 0;
else if (*pat > index) (*pat)--;
}
void adjustpatterns(Network *network, int index)