Author: gegorbet Date: 2019-06-03 17:45:41 +0000 (Mon, 03 Jun 2019) New Revision: 2782 Modified: trunk/programs/us_2dsa/us_2dsa.cpp trunk/programs/us_fematch/us_fematch.cpp trunk/utils/us_settings.cpp trunk/utils/us_settings.h trunk/utils/us_simparms.cpp Log: See initial apparent constant speed zones as part of acceleration when TimeState shows zone less than 5 minutes in duration or empty of scan times Modified: trunk/programs/us_2dsa/us_2dsa.cpp =================================================================== --- trunk/programs/us_2dsa/us_2dsa.cpp 2019-05-31 17:02:15 UTC (rev 2781) +++ trunk/programs/us_2dsa/us_2dsa.cpp 2019-06-03 17:45:41 UTC (rev 2782) @@ -1116,14 +1116,16 @@ // Do a quick test of the speed step implied by TimeState int tf_scan = dset.simparams.speed_step[ 0 ].time_first; int accel1 = dset.simparams.speed_step[ 0 ].acceleration; + QString svalu = US_Settings::debug_value( "SetSpeedLowA" ); + int lo_ss_acc = svalu.isEmpty() ? 250 : svalu.toInt(); int rspeed = dset.simparams.speed_step[ 0 ].rotorspeed; int tf_aend = ( rspeed + accel1 - 1 ) / accel1; int accel2 = dset.simparams.sim_speed_prof[ 0 ].acceleration; DbgLv(1)<<"2dsa : ssck: rspeed accel1 tf_aend tf_scan" << rspeed << accel1 << tf_aend << tf_scan - << "accel2" << accel2; + << "accel2" << accel2 << "lo_ss_acc" << lo_ss_acc; //x0 1 2 3 4 5 - if ( accel1 < 250 || tf_aend > ( tf_scan - 6 ) ) + if ( accel1 < lo_ss_acc || tf_aend > ( tf_scan - 6 ) ) { QString wmsg = tr( "The TimeState used is likely bad:<br/>" "The acceleration implied is %1 rpm/sec.<br/>" Modified: trunk/programs/us_fematch/us_fematch.cpp =================================================================== --- trunk/programs/us_fematch/us_fematch.cpp 2019-05-31 17:02:15 UTC (rev 2781) +++ trunk/programs/us_fematch/us_fematch.cpp 2019-06-03 17:45:41 UTC (rev 2782) @@ -2201,12 +2201,15 @@ // Do a quick test of the speed step implied by TimeState int tf_scan = simparams.speed_step[ 0 ].time_first; int accel1 = simparams.speed_step[ 0 ].acceleration; + QString svalu = US_Settings::debug_value( "SetSpeedLowA" ); + int lo_ss_acc = svalu.isEmpty() ? 250 : svalu.toInt(); int rspeed = simparams.speed_step[ 0 ].rotorspeed; int tf_aend = ( rspeed + accel1 - 1 ) / accel1; -DbgLv(1) << "SimMdl: ssck: rspeed accel1 tf_aend tf_scan" - << rspeed << accel1 << tf_aend << tf_scan; +DbgLv(1) << "SimMdl: ssck: rspeed accel1 lo_ss_acc" + << rspeed << accel1 << lo_ss_acc << "tf_aend tf_scan" + << tf_aend << tf_scan; //x0 1 2 3 4 5 - if ( accel1 < 250 || tf_aend > ( tf_scan - 6 ) ) + if ( accel1 < lo_ss_acc || tf_aend > ( tf_scan - 6 ) ) { QString wmsg = tr( "The TimeState computed/used is likely bad:<br/>" "The acceleration implied is %1 rpm/sec.<br/>" Modified: trunk/utils/us_settings.cpp =================================================================== --- trunk/utils/us_settings.cpp 2019-05-31 17:02:15 UTC (rev 2781) +++ trunk/utils/us_settings.cpp 2019-06-03 17:45:41 UTC (rev 2782) @@ -253,7 +253,23 @@ return debug_text().contains( match, Qt::CaseInsensitive ); } +QString US_Settings::debug_value( QString match ) +{ + QStringList dbgtxt = debug_text(); + QString dbgval( "" ); + for ( int ii = 0; ii < dbgtxt.count(); ii++ ) + { + if ( dbgtxt[ ii ].startsWith( match, Qt::CaseInsensitive ) ) + { + dbgval = QString( dbgtxt[ ii ] ).section( "=", 1, 1 ); + break; + } + } + + return dbgval; +} + // Investigator QString US_Settings::us_inv_name( void ) { Modified: trunk/utils/us_settings.h =================================================================== --- trunk/utils/us_settings.h 2019-05-31 17:02:15 UTC (rev 2781) +++ trunk/utils/us_settings.h 2019-06-03 17:45:41 UTC (rev 2782) @@ -113,6 +113,8 @@ static QStringList debug_text( void ); //! \brief Get a flag if given string matches any in debug text static bool debug_match( QString ); + //! \brief Get the string value for a match in debug_text + static QString debug_value( QString ); //! \brief Set the Debug text setting as a string list static void set_debug_text( QStringList ); Modified: trunk/utils/us_simparms.cpp =================================================================== --- trunk/utils/us_simparms.cpp 2019-05-31 17:02:15 UTC (rev 2781) +++ trunk/utils/us_simparms.cpp 2019-06-03 17:45:41 UTC (rev 2782) @@ -1181,14 +1181,13 @@ if ( ! have_keys ) return -1; // Do not have needed keys - int ss_reso = 100; // If debug_text so directs, change set_speed_resolution - QStringList dbgtxt = US_Settings::debug_text(); - for ( int ii = 0; ii < dbgtxt.count(); ii++ ) - { // If debug text modifies ss_reso, apply it - if ( dbgtxt[ ii ].startsWith( "SetSpeedReso" ) ) - ss_reso = QString( dbgtxt[ ii ] ).section( "=", 1, 1 ).toInt(); - } + // and/or set_speed_low_rpm + QString dbgval = US_Settings::debug_value( "SetSpeedReso" ); + int ss_reso = dbgval.isEmpty() ? 100 : dbgval.toInt(); + dbgval = US_Settings::debug_value( "SetSpeedLowR" ); + int ss_lo_rpm = dbgval.isEmpty() ? 1500 : dbgval.toInt(); + int nrec = tsobj->time_count(); // Total time record count QList< int > cspeeds; // Constant speeds list @@ -1206,9 +1205,7 @@ (int)qRound( tsobj->time_dvalue( "SetSpeed" ) ) : tsobj->time_ivalue( "SetSpeed" ); // Current set speed - //if ( ss3 == ss2 && ss2 == ss1 && ss3 > 0 ) - //if ( ss3 == ss2 && ss2 == ss1 && ss3 > 3500 ) - if ( ss3 == ss2 && ss2 == ss1 && ss3 > 1500 ) + if ( ss3 == ss2 && ss2 == ss1 && ss3 > ss_lo_rpm ) { // This non-zero set-speed and both previous are the same if ( ! cspeeds.contains( ss3 ) ) cspeeds << ss3; // Save it if first time encountered @@ -1355,6 +1352,23 @@ DbgLv(1) << "Sim parms:ssProf: const-end ss_p ss_c" << ss_p << ss_c << "ndtimes" << ndtimes << "tm_c" << tm_c << "rs_p rs_c" << rs_p << rs_c << "ss_c_ts" << ss_c_ts; + + // But, wait a minute! If the "constant zone" just ending is less than + // 5 minutes long or contains no scans, then add it to the current + // speed step's acceleration zone and resume looking for an end + // to the acceleration zone + if ( ndtimes < 300 || ssp.time_f_scan < 1 ) + { + in_accel = true; + naintvs += ndtimes; + sum_speed = ssp.avg_speed * (double)ndtimes; + sum_accel = ssp.acceleration * (double)( naintvs - 1 ); +DbgLv(1) << "Sim parms:ssProf: BACK-to-ACCEL: naintvs" << naintvs + << "ndtimes" << ndtimes << "sum_accel" << sum_accel << "sum_speed" << sum_speed; + continue; + } + + // End to a true constant zone: save a speed step ssp.avg_speed = sum_speed / (double)( ndtimes ); ssp.w2t_e_step = w2_p; ssp.time_e_step = tm_p;