121 lines
6.3 KiB
HTML
121 lines
6.3 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.16"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>EPANET: Hydrant Rating Curve Example</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
<div id="projectname">EPANET
|
|
 <span id="projectnumber">2.2.0</span>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.16 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
/* @license-end */
|
|
</script>
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
/* @license-end */</script>
|
|
<div id="main-nav"></div>
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div id="nav-path" class="navpath">
|
|
<ul>
|
|
<li class="navelem"><a class="el" href="_toolkit_examples.html">Examples</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="PageDoc"><div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">Hydrant Rating Curve Example </div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<div class="textblock"><p>This example illustrates how the Toolkit could be used to develop a hydrant rating curve used in fire flow studies. This curve shows the amount of flow available at a node in the system as a function of pressure. The curve is generated by running a number of steady state hydraulic analyses with the node of interest subjected to a different demand in each analysis. For this example we assume that the ID label of the node of interest is <code>MyNode</code> and that <code>N</code> different demand levels stored in the array <code>D</code> need to be examined. The corresponding pressures will be stored in <code>P</code>. To keep the code more readable, no error checking is made on the results returned from the Toolkit function calls.</p>
|
|
<div class="fragment"><div class="line"><span class="preprocessor">#include "epanet2_2.h"</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="keywordtype">void</span> HydrantRating(<span class="keywordtype">char</span> *MyNode, <span class="keywordtype">int</span> N, <span class="keywordtype">double</span> D[], <span class="keywordtype">double</span> P[])</div>
|
|
<div class="line">{</div>
|
|
<div class="line"> EN_Project ph;</div>
|
|
<div class="line"> <span class="keywordtype">int</span> i, nodeindex;</div>
|
|
<div class="line"> <span class="keywordtype">long</span> t;</div>
|
|
<div class="line"> <span class="keywordtype">double</span> pressure;</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">// Create a project</span></div>
|
|
<div class="line"> EN_createproject(&ph);</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">// Retrieve network data from an input file</span></div>
|
|
<div class="line"> EN_open(ph, <span class="stringliteral">"example2.inp"</span>, <span class="stringliteral">"example2.rpt"</span>, <span class="stringliteral">""</span>);</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">// Open the hydraulic solver</span></div>
|
|
<div class="line"> EN_openH(ph);</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">// Get the index of the node of interest</span></div>
|
|
<div class="line"> EN_getnodeindex(ph, MyNode, &nodeindex);</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">// Iterate over all demands</span></div>
|
|
<div class="line"> <span class="keywordflow">for</span> (i=1; i<N; i++)</div>
|
|
<div class="line"> {</div>
|
|
<div class="line"> <span class="comment">// Set nodal demand, initialize hydraulics, make a</span></div>
|
|
<div class="line"> <span class="comment">// single period run, and retrieve pressure</span></div>
|
|
<div class="line"> EN_setnodevalue(ph, nodeindex, EN_BASEDEMAND, D[i]);</div>
|
|
<div class="line"> EN_initH(ph, 0);</div>
|
|
<div class="line"> EN_runH(ph, &t);</div>
|
|
<div class="line"> EN_getnodevalue(ph, nodeindex, EN_PRESSURE, &pressure);</div>
|
|
<div class="line"> P[i] = pressure;</div>
|
|
<div class="line"> }</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">// Close hydraulics solver & delete the project</span></div>
|
|
<div class="line"> EN_closeH(ph);</div>
|
|
<div class="line"> EN_deleteproject(ph);</div>
|
|
<div class="line">}</div>
|
|
</div><!-- fragment --> </div></div><!-- contents -->
|
|
</div><!-- PageDoc -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.16
|
|
</small></address>
|
|
</body>
|
|
</html>
|