Read and write demand categories names

Fixes #290
This commit is contained in:
Elad Salomons
2018-09-22 11:19:05 +03:00
parent 054c48c48a
commit cc21b55b68
3 changed files with 8 additions and 4 deletions

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