@@ -148,12 +148,12 @@ var analyzeGPResults = function(elevProfileResult,watershedResult) {
148
148
var firstZ = coords [ 0 ] [ 2 ] ;
149
149
var lastZ = coords [ coords . length - 1 ] [ 2 ] ;
150
150
// save the difference
151
- var head = lastZ - firstZ ;
152
- // check result. It must be a positive number
151
+ var head = Math . abs ( lastZ - firstZ ) ;
152
+
153
153
154
154
$ ( '#msg-text' ) . append ( '<h3><small>Head:</small> ' + _round ( head , 2 ) + ' <small>meters</small></h3>' ) ;
155
155
156
-
156
+ /*
157
157
// calculate power
158
158
var Qavail = (area * 1.6);
159
159
//where x is a range from 0.1 to 0.5 with default value of 0.3 (edited)
@@ -164,7 +164,31 @@ var analyzeGPResults = function(elevProfileResult,watershedResult) {
164
164
var e = 0.7;
165
165
var p = Quseable * head * (0.084) * e;
166
166
var power = _round(p, 2);
167
-
167
+ */
168
+ var envflow = 0 , efficiency = 0 ;
169
+ calcRequestURL = Flask . url_for ( "api" , {
170
+ "area" : area , "head" : head , "envflow" : envflow , "efficiency" : efficiency
171
+ } ) ;
172
+
173
+ $ . get ( {
174
+ url : calcRequestURL ,
175
+ success : function ( data ) {
176
+ if ( head < 0 ) {
177
+ $ ( '#msg-status' ) . html ( makeAlert ( "The head calculation returned a negative value. Make sure the line was drawn downstream→upstream." , 'warning' ) ) ;
178
+ } else {
179
+ //$('#msg-status').html(makeAlert(null,'success'));
180
+ $ ( '#msg-status' ) . hide ( ) ;
181
+ }
182
+
183
+ $ ( '#msg-text' ) . append ( '<h2><small>Power:</small> ' + data . result . power + ' <small>kW/year</small></h2>' ) ;
184
+ $ ( '#msg-status-power' ) . html ( makeAlert ( "Power Generation Est.: Complete" , 'success' ) ) ;
185
+ $ ( '#analyze-button-item' ) . html ( clearButton ) ;
186
+ $ ( '#msg-text' ) . show ( ) ;
187
+ }
188
+ } ) ;
189
+
190
+ /*
191
+ //check result. It must be a positive number
168
192
if (head < 0) {
169
193
$('#msg-status').html(makeAlert("The head calculation returned a negative value. Make sure the line was drawn downstream→upstream.", 'warning'));
170
194
} else {
@@ -176,4 +200,5 @@ var analyzeGPResults = function(elevProfileResult,watershedResult) {
176
200
$('#msg-status-power').html(makeAlert("Power Generation Est.: Complete", 'success'));
177
201
$('#analyze-button-item').html(clearButton);
178
202
$('#msg-text').show();
203
+ */
179
204
} ;
0 commit comments