Merge pull request #291 from eladsal/dev-dem-cat

Read and write the demand categories names
This commit is contained in:
Elad Salomons
2018-09-25 16:38:51 +03:00
committed by GitHub
4 changed files with 73 additions and 4 deletions

View File

@@ -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

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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 */