From cc21b55b6883fea01832d41eebe8048c42765993 Mon Sep 17 00:00:00 2001 From: Elad Salomons Date: Sat, 22 Sep 2018 11:19:05 +0300 Subject: [PATCH 1/2] Read and write demand categories names Fixes #290 --- src/inpfile.c | 2 +- src/input3.c | 3 +++ src/types.h | 7 ++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/inpfile.c b/src/inpfile.c index 1d7c11e..5948f9d 100644 --- a/src/inpfile.c +++ b/src/inpfile.c @@ -333,7 +333,7 @@ int saveinpfile(EN_Project *pr, const char *fname) sprintf(s1, " %s", net->Pattern[j].ID); else strcpy(s1, ""); - fprintf(f, "\n%s %s", s, s1); + fprintf(f, "\n%s %s ;%s", s, s1, demand->Name); } } diff --git a/src/input3.c b/src/input3.c index 58f9ce2..4ba7f04 100644 --- a/src/input3.c +++ b/src/input3.c @@ -111,6 +111,7 @@ int juncdata(EN_Project *pr) } demand->Base = y; demand->Pat = p; + strncpy(demand->Name, "", MAXMSG); demand->next = NULL; node->D = demand; hyd->NodeDemand[Njuncs] = y; @@ -775,6 +776,7 @@ int demanddata(EN_Project *pr) // with what is specified in this section demand->Base = y; demand->Pat = p; + strncpy(demand->Name, par->Comment, MAXMSG); hyd->NodeDemand[j] = MISSING; // marker - next iteration will append a new category. } else { // add new demand to junction @@ -787,6 +789,7 @@ int demanddata(EN_Project *pr) return (101); demand->Base = y; demand->Pat = p; + strncpy(demand->Name, par->Comment, MAXMSG); demand->next = NULL; cur_demand->next = demand; } diff --git a/src/types.h b/src/types.h index 61c2cdb..278d98c 100755 --- a/src/types.h +++ b/src/types.h @@ -359,9 +359,10 @@ typedef struct /* Coord OBJECT */ struct Sdemand /* DEMAND CATEGORY OBJECT */ { - double Base; /* Baseline demand */ - int Pat; /* Pattern index */ - struct Sdemand *next; /* Next record */ + double Base; /* Baseline demand */ + int Pat; /* Pattern index */ + char Name[MAXMSG+1]; /* Demand category name */ + struct Sdemand *next; /* Next record */ }; typedef struct Sdemand *Pdemand; /* Pointer to demand object */ From fbaf2a6061b216c88c0653cbda6df9c5f3e4fb90 Mon Sep 17 00:00:00 2001 From: Elad Salomons Date: Sat, 22 Sep 2018 11:29:56 +0300 Subject: [PATCH 2/2] Update release notes Added placeholders for new API functions, general changes, new definitions and list of contributing authors --- ReleaseNotes2_2.md | 65 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/ReleaseNotes2_2.md b/ReleaseNotes2_2.md index 65f1574..4ee31d3 100644 --- a/ReleaseNotes2_2.md +++ b/ReleaseNotes2_2.md @@ -96,3 +96,68 @@ for the thread-safe API. Some additional points regarding the new **PDA** option - `hydcoeffs.c` computes values of the matrix coefficients (derived from link head losses and their gradients) used by the hydraulic solver. - `hydstatus.c` checks for status changes in valves and pumps as requested by the hydraulic solver. - The Multiple Minimum Degree re-ordering algorithm appears in a new file named `genmmd.c`. This is 1990's legacy code that is readily available on the web and can be found in several linear equation solver libraries. + +## General changes + - Read and write demand categories names + +## New API functions +|Function|Description| +|--|--| +|`ENaddlink`| | +|`ENaddnode`| | +|`ENgetcurvetype`| | +|`ENgetdemandmodel`|| +|`ENsetdemandmodel`|| +|`ENsetflowunits`|| +|`ENaddcontrol`|| +|`ENsetdemandpattern`|| +|`ENgetrule`|| +|`ENsetrulepriority`|| +|`ENgetpremise`|| +|`ENsetpremise`|| +|`ENsetpremiseindex`|| +|`ENsetpremisestatus`|| +|`ENsetpremisevalue`|| +|`ENgettrueaction`|| +|`ENsettrueaction`|| +|`ENgetfalseaction`|| +|`ENsetfalseaction`|| +|`ENgetruleID`|| +|`ENinit`|| +|`ENsetheadcurveindex`|| +|`ENsetlinktype`|| +|`ENaddnode`|| +|`ENaddlink`|| +|`ENdeletelink`|| +|`ENdeletenode`|| + + +## API Extensions (additional definitions) +### Link value types: +- `EN_EFFICIENCY` +- `EN_HEADCURVE` +- `EN_EFFICIENCYCURVE` +- `EN_PRICEPATTERN` +- `EN_STATE` +- `EN_CONST_POWER` +- `EN_SPEED` +### Count types: + - `EN_RULECOUNT` +### Head loss formula: + - `EN_HW` + - `EN_DW` + - `EN_CM` +### Misc. options: + - `EN_HEADERROR` + - `EN_FLOWCHANGE` + - `EN_DEMANDDEFPAT` +### Curve types: + - `EN_V_CURVE` + - `EN_P_CURVE` + - `EN_E_CURVE` + - `EN_H_CURVE` + - `EN_G_CURVE` + +## Authors contributing to this release: + - List item +