private double internalPipeVerify ( int k , double [ ] cDelays , double [ ] [ ] net , double [ ] [ ] timeDischarge , double [ ] [ ] timeFillDegree , int tp ) { int num ; double localdelay , olddelay , qMax , B , known , theta , u ; double [ ] [ ] qPartial ; qPartial = new double [ timeDischarge . length ] [ timeDischarge [ 0 ] . length ] ; calculateDelays ( k , cDelays , net ) ; // First attempt local delay [min] localdelay = 1 ; double accuracy = networkPipes [ 0 ] . getAccuracy ( ) ; int jMax = networkPipes [ 0 ] . getjMax ( ) ; double minG = networkPipes [ 0 ] . getMinG ( ) ; double maxtheta = networkPipes [ 0 ] . getMaxTheta ( ) ; double tolerance = networkPipes [ 0 ] . getTolerance ( ) ; int count = 0 ; do { olddelay = localdelay ; qMax = 0 ; // Updates delays for ( int i = 0 ; i < net . length ; i ++ ) { net [ i ] [ 2 ] += localdelay ; } ; for ( int j = 0 ; j < net . length ; ++ j ) { num = ( int ) net [ j ] [ 0 ] ; getHydrograph ( num , qPartial , olddelay , net [ j ] [ 2 ] , tp ) ; } getHydrograph ( k , qPartial , olddelay , 0 , tp ) ; qMax = ModelsEngine . sumDoublematrixColumns ( k , qPartial , timeDischarge , 0 , qPartial [ 0 ] . length - 1 , pm ) ; if ( qMax <= 1 ) qMax = 1 ; // Resets delays for ( int i = 0 ; i < net . length ; i ++ ) { net [ i ] [ 2 ] -= localdelay ; } calculateFillDegree ( k , timeDischarge , timeFillDegree ) ; B = qMax / ( CUBICMETER2LITER * networkPipes [ k ] . getKs ( ) * sqrt ( networkPipes [ k ] . verifyPipeSlope / METER2CM ) ) ; known = ( B * TWO_THIRTEENOVERTHREE ) / pow ( networkPipes [ k ] . diameterToVerify / METER2CM , EIGHTOVERTHREE ) ; theta = Utility . thisBisection ( maxtheta , known , TWOOVERTHREE , minG , accuracy , jMax , pm , strBuilder ) ; // Average velocity in pipe [ m / s ] u = qMax * 80 / ( pow ( networkPipes [ k ] . diameterToVerify , 2 ) * ( theta - sin ( theta ) ) ) ; localdelay = networkPipes [ k ] . getLenght ( ) / ( celerityfactor1 * u * MINUTE2SEC ) ; count ++ ; // verify if it's an infiniteloop. if ( count > MAX_NUMBER_ITERATION ) { infiniteLoop = true ; throw new ArithmeticException ( ) ; } } while ( abs ( localdelay - olddelay ) / olddelay >= tolerance ) ; cDelays [ k ] = localdelay ; return qMax ; }
verify of the no - head pipes .