Skip to content

Retrieving Computed Results

Elad Salomons edited this page Sep 25, 2015 · 2 revisions

The ENgetnodevalue and ENgetlinkvalue functions are used to retrieve the results of hydraulic and water quality simulations. The computed parameters (and their Toolkit codes) that can be retrieved are as follows:

For Nodes For Links
EN_DEMAND (demand) EN_FLOW (flow rate)
EN_HEAD (hydraulic head) EN_VELOCITY (flow velocity)
EN_PRESSURE (pressure) EN_HEADLOSS (headloss)
EN_QUALITY (water quality) EN_STATUS (link status)
EN_SOURCEMASS (water quality source mass inflow) EN_SETTING (pump speed or valve setting)

The following code shows how to retrieve the pressure at each node of the network after each time step of a hydraulic analysis (writetofile is a user-defined function that will write a record to a file):

int   i, NumNodes; 
long  t, tstep; 
float p; 
char  id[32]; 
ENgetcount(EN_NODECOUNT, &NumNodes); 
ENopenH(); 
ENinitH(0); 
do { 
  ENrunH(&t); 
  for (i = 1; i <= NumNodes; i++) { 
    ENgetnodevalue(i, EN_PRESSURE, &p); 
    ENgetnodeid(i, id); 
    writetofile(t, id, p); 
  } 
  ENnextH(&tstep); 
} while (tstep > 0); 
ENcloseH();    
Clone this wiki locally
You can’t perform that action at this time.