us-commits
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
April 2019
- 3 participants
- 16 discussions
Author: alexey
Date: 2019-04-30 23:47:36 +0000 (Tue, 30 Apr 2019)
New Revision: 2748
Modified:
trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
Log:
autoflow further updates on reattacjement
Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-04-30 23:31:05 UTC (rev 2747)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-04-30 23:47:36 UTC (rev 2748)
@@ -1795,9 +1795,9 @@
qDebug() << "SYS_STAT: After replot(), BEFORE CheExpStat!! ";
- //int exp_status = CheckExpComplete_auto( RunID_to_retrieve );
+ int exp_status = CheckExpComplete_auto( RunID_to_retrieve );
- if ( CheckExpComplete_auto( RunID_to_retrieve ) == 5 )
+ if ( exp_status == 5 )
{
timer_check_sysdata->stop();
disconnect(timer_check_sysdata, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
@@ -1828,7 +1828,7 @@
}
- if ( CheckExpComplete_auto( RunID_to_retrieve ) == 3 )
+ if ( exp_status == 3 )
{
timer_check_sysdata->stop();
disconnect(timer_check_sysdata, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
@@ -2326,7 +2326,52 @@
qDebug() << "CellChNumber, cellchans.count() " << CellChNumber.toInt() << ", " << cellchans.count();
qDebug() << "TripleNumber, ntriple " << TripleNumber.toInt() << ", " << ntriple;
+
+ //ALEXEY: Add Exp. Abortion Exception HERE...
+ if ( CheckExpComplete_auto( RunID_to_retrieve ) == 3 )
+ {
+ timer_all_data_avail->stop();
+ disconnect(timer_all_data_avail, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
+
+ if ( !timer_check_sysdata->isActive() ) // Check if sys_data Timer is stopped
+ {
+ // Ask if data retrived so far should be saved:
+
+ QMessageBox msgBox;
+ msgBox.setText(tr("Experiment was aborted!"));
+ msgBox.setInformativeText("The data retrieved so far can be saved or disregarded. If saved, the program will proceed to the next stage (Editing). Otherwise, it will return to the initial stage (Experiment).");
+ msgBox.setWindowTitle(tr("Experiment Abortion"));
+ QPushButton *Save = msgBox.addButton(tr("Save Data"), QMessageBox::YesRole);
+ QPushButton *Ignore = msgBox.addButton(tr("Ignore Data"), QMessageBox::RejectRole);
+
+ msgBox.setIcon(QMessageBox::Question);
+ msgBox.exec();
+
+ if (msgBox.clickedButton() == Save)
+ {
+ export_auc_auto();
+
+ QString mtitle_complete = tr( "Complete!" );
+ QString message_done = tr( "Experiment was completed. Optima data saved..." );
+ QMessageBox::information( this, mtitle_complete, message_done );
+
+ updateautoflow_record_atLiveUpdate();
+ emit experiment_complete_auto( currentDir, ProtocolName, invID_passed ); // Updtade later: what should be passed with signal ??
+ return;
+ }
+
+ else if (msgBox.clickedButton() == Ignore)
+ {
+ reset();
+ delete_autoflow_record();
+ emit return_to_experiment( ProtocolName );
+ return;
+ }
+ }
+ }
+
+
if ( cellchans.count() == CellChNumber.toInt() && ntriple == TripleNumber.toInt() ) // <--- Change to the values from the protocol
{
//stop timer
1
0
r2747 - in trunk: programs/us_com_project programs/us_convert programs/us_xpn_viewer sql
by svn@svn.aucsolutions.com April 30, 2019
by svn@svn.aucsolutions.com April 30, 2019
April 30, 2019
Author: alexey
Date: 2019-04-30 23:31:05 +0000 (Tue, 30 Apr 2019)
New Revision: 2747
Modified:
trunk/programs/us_com_project/us_com_project_gui.cpp
trunk/programs/us_convert/us_convert_gui.cpp
trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
trunk/sql/us3_autoflow_procs.sql
Log:
utoflow reattachement and related issues
Modified: trunk/programs/us_com_project/us_com_project_gui.cpp
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.cpp 2019-04-30 04:45:52 UTC (rev 2746)
+++ trunk/programs/us_com_project/us_com_project_gui.cpp 2019-04-30 23:31:05 UTC (rev 2747)
@@ -469,7 +469,7 @@
autoflowentry << id << runname << optimaname << time_created.toString(); // << time_started.toString(); // << local.toString( Qt::ISODate );
if ( time_started.toString().isEmpty() )
- autoflowentry << "not started";
+ autoflowentry << QString( tr( "NOT STARTED" ) );
else
autoflowentry << time_started.toString();
Modified: trunk/programs/us_convert/us_convert_gui.cpp
===================================================================
--- trunk/programs/us_convert/us_convert_gui.cpp 2019-04-30 04:45:52 UTC (rev 2746)
+++ trunk/programs/us_convert/us_convert_gui.cpp 2019-04-30 23:31:05 UTC (rev 2747)
@@ -1966,7 +1966,11 @@
tr( ": Define reference scans" ) );
if ( count == 1 )
- pb_reference->setEnabled( true );
+ {
+ pb_reference->setEnabled( true );
+ //ALEXEY <--- Save btn is disabled when Reference scan is NOT defined (for Absorbance)
+ completed = false;
+ }
}
// If we made it here, user can save
Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-04-30 04:45:52 UTC (rev 2746)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-04-30 23:31:05 UTC (rev 2747)
@@ -1425,7 +1425,8 @@
in_reload_data_init = true;
-
+ //msg_data_avail->accept();
+
// Ask for data directory
QString dbhost = xpnhost;
int dbport = xpnport.toInt();
@@ -1439,12 +1440,6 @@
qDebug() << "RunID_to_retrieve 1: " << RunID_to_retrieve;
-
- // //Test
- // ElapsedTimeOffset = read_timeElapsed_offset();
- // qDebug() << "TEST: Elapsed time from autoflow: " << ElapsedTimeOffset;
-
-
// runInfo.clear();
//xpn_data->scan_runs( runInfo ); // ALEXEY initial query (for us_comproject needs to be based on ExpId )
@@ -1480,7 +1475,9 @@
status_ok = true;
timer_data_init->stop();
disconnect(timer_data_init, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
- msg_data_avail->close();
+ msg_data_avail->accept();
+ //msg_data_avail->close();
+ //ok_msg_data->click();
//ALEXEY: need to update 'autoflow' table with the unique RunID_to_retrieve && Start Run Time fields !!!
//Conditional: Do it ONLY once !!!
@@ -1488,6 +1485,8 @@
//ALEXEY: retrieve startTime from autoflow table:
ElapsedTimeOffset = read_timeElapsed_offset();
+
+ qDebug() << "Elapsed Time Offset as read form autoflow table DB:" << ElapsedTimeOffset;
//ALEXEY: elapsed timer start
elapsed_timer = new QElapsedTimer;
@@ -1514,6 +1513,13 @@
rpm_data.clear();
time_data.clear();
+ // Check if all triple info is available
+ timer_all_data_avail = new QTimer;
+ connect(timer_all_data_avail, SIGNAL(timeout()), this, SLOT( retrieve_xpn_raw_auto ( ) ));
+ timer_all_data_avail->start(5000); // 5 sec
+
+
+
// timer_check_sysdata = new QTimer(this);
// connect(timer_check_sysdata, SIGNAL(timeout()), this, SLOT( check_for_sysdata( ) ));
// timer_check_sysdata->start(2000); //
@@ -1524,17 +1530,18 @@
timer_check_sysdata = new QTimer(0); // parent to 0 !
timer_check_sysdata->setInterval(2000);
timer_check_sysdata->moveToThread(sys_thread);
- connect( timer_check_sysdata, SIGNAL(timeout()), this, SLOT( check_for_sysdata( ) ), Qt::QueuedConnection ) ; //Qt::DirectConnection );
+ //connect( timer_check_sysdata, SIGNAL(timeout()), this, SLOT( check_for_sysdata( ) ), Qt::QueuedConnection ) ; //Qt::DirectConnection );
+ connect( timer_check_sysdata, SIGNAL(timeout()), this, SLOT( check_for_sysdata( ) ) ) ; //Qt::DirectConnection );
//QThread's started() SIGNAL: before the run()/exec() function is called!!! Is this a potential issue, timer is started from a thread???
connect( sys_thread, SIGNAL( started() ), timer_check_sysdata, SLOT( start() ));
sys_thread->start();
// How to stop sys_thread?
- // Check if all triple info is available
- timer_all_data_avail = new QTimer;
- connect(timer_all_data_avail, SIGNAL(timeout()), this, SLOT( retrieve_xpn_raw_auto ( ) ));
- timer_all_data_avail->start(5000); // 5 sec
+ // // Check if all triple info is available
+ // timer_all_data_avail = new QTimer;
+ // connect(timer_all_data_avail, SIGNAL(timeout()), this, SLOT( retrieve_xpn_raw_auto ( ) ));
+ // timer_all_data_avail->start(5000); // 5 sec
}
@@ -1703,11 +1710,11 @@
//RPM speed
double rpm_for_meter = double(rpm/1000.0);
rpm_box->setSpeed(rpm_for_meter);
- qApp->processEvents();
+ //qApp->processEvents();
//Temperature
temperature_box->setTemp(temperature);
- qApp->processEvents();
+ //qApp->processEvents();
//Running Time
QList< int > dhms_r;
@@ -1719,9 +1726,11 @@
//ALEXEY: hh:mm:ss - OR do we need dd:hh:mm instead ?
running_time_text = QString::number(dhms_r[1]) + ":" + QString::number(dhms_r[2]) + ":" + QString::number(dhms_r[3]);
le_running->setText( running_time_text );
- qApp->processEvents();
+ //qApp->processEvents();
//Elapsed Time
+ qDebug() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Elapsed Time Offset as read form autoflow table DB:" << ElapsedTimeOffset;
+
QList< int > dhms_e;
int elapsed_time = int( elapsed_timer->elapsed() / 1000 ) + ElapsedTimeOffset;
int elapsed_time_1 = elapsed_time;
@@ -1730,7 +1739,7 @@
//ALEXEY: hh:mm:ss - OR do we need dd:hh:mm instead ?
elapsed_time_text = QString::number(dhms_e[1]) + ":" + QString::number(dhms_e[2]) + ":" + QString::number(dhms_e[3]);
le_elapsed->setText( elapsed_time_text );
- qApp->processEvents();
+ // qApp->processEvents();
//Remaining Time
QList< int > dhms_remain;
@@ -1740,7 +1749,7 @@
//ALEXEY: hh:mm:ss - OR do we need dd:hh:mm instead ?
remaining_time_text = QString::number(dhms_remain[1]) + ":" + QString::number(dhms_remain[2]) + ":" + QString::number(dhms_remain[3]);
le_remaining->setText( remaining_time_text );
- qApp->processEvents();
+ // qApp->processEvents();
//RPM/Temp. Plots:
@@ -1771,7 +1780,8 @@
curv_temp->setSamples( d_time, d_temp, time_data.size() );
curv_rpm->setSamples( d_time, d_rpm, time_data.size() );
- data_plot_rpm->setAxisScale( QwtPlot::xBottom, 0.0, double(elapsed_time_1/60.0) ); // <-- HERE
+ //data_plot_rpm->setAxisScale( QwtPlot::xBottom, 0.0, double(elapsed_time_1/60.0) ); // <-- HERE
+ data_plot_rpm->setAxisScale( QwtPlot::xBottom, double(ElapsedTimeOffset/60.0), double(elapsed_time_1/60.0) ); //
//data_plot_rpm->setAxisScale( QwtPlot::xBottom, 0.0, double(exp_time/60.0 + counter_mins ) ); // for testing only
data_plot_rpm->setAxisScale( QwtPlot::yLeft, rpm_min, rpm_max ); //Y-RPM
data_plot_rpm->setAxisScale( QwtPlot::yRight, temp_min, temp_max ); //Y-Temp.
@@ -1781,13 +1791,13 @@
qDebug() << "SYS_STAT: BEFORE replot(), BEFORE CheExpStat!! ";
data_plot_rpm->replot();
- qApp->processEvents();
+ // qApp->processEvents();
qDebug() << "SYS_STAT: After replot(), BEFORE CheExpStat!! ";
- int exp_status = CheckExpComplete_auto( RunID_to_retrieve );
+ //int exp_status = CheckExpComplete_auto( RunID_to_retrieve );
- if ( exp_status == 5 )
+ if ( CheckExpComplete_auto( RunID_to_retrieve ) == 5 )
{
timer_check_sysdata->stop();
disconnect(timer_check_sysdata, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
@@ -1796,25 +1806,80 @@
rpm_box->setSpeed( 0 );
le_remaining->setText( "00:00:00" );
-
- expStatFive();
- return;
+
+ if ( !timer_all_data_avail->isActive() ) // Check if reload_data Timer is stopped
+ {
+ if ( !timer_data_reload->isActive() )
+ {
+ // ALEXEY Export AUC data: devise export_auc_auto() function which would return directory name with saved data - to pass to emit signal below...
+ export_auc_auto();
+
+ QString mtitle_complete = tr( "Complete!" );
+ QString message_done = tr( "Experiment was completed. Optima data saved..." );
+ QMessageBox::information( this, mtitle_complete, message_done );
+
+ updateautoflow_record_atLiveUpdate();
+ emit experiment_complete_auto( currentDir, ProtocolName, invID_passed ); // Updtade later: what should be passed with signal ??
+
+ return;
+ }
+ }
+ //expStatFive();
}
- if ( exp_status == 2 )
+
+ if ( CheckExpComplete_auto( RunID_to_retrieve ) == 3 )
{
-
timer_check_sysdata->stop();
disconnect(timer_check_sysdata, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
- qDebug() << "ExpStat: 2 - sys_timer STOPPED here: ";
+ qDebug() << "ExpStat: 3 - sys_timer STOPPED here: ";
rpm_box->setSpeed( 0 );
le_remaining->setText( "00:00:00" );
+
+ if ( !timer_all_data_avail->isActive() ) // Check if reload_data Timer is stopped
+ {
+ if ( !timer_data_reload->isActive() )
+ {
+ // Ask if data retrived so far should be saved:
+
+ QMessageBox msgBox;
+ msgBox.setText(tr("Experiment was aborted!"));
+ msgBox.setInformativeText("The data retrieved so far can be saved or disregarded. If saved, the program will proceed to the next stage (Editing). Otherwise, it will return to the initial stage (Experiment).");
+ msgBox.setWindowTitle(tr("Experiment Abortion"));
+ QPushButton *Save = msgBox.addButton(tr("Save Data"), QMessageBox::YesRole);
+ QPushButton *Ignore = msgBox.addButton(tr("Ignore Data"), QMessageBox::RejectRole);
+
+ msgBox.setIcon(QMessageBox::Question);
+ msgBox.exec();
+
+ if (msgBox.clickedButton() == Save)
+ {
+ export_auc_auto();
+
+ QString mtitle_complete = tr( "Complete!" );
+ QString message_done = tr( "Experiment was completed. Optima data saved..." );
+ QMessageBox::information( this, mtitle_complete, message_done );
+
+ updateautoflow_record_atLiveUpdate();
+ emit experiment_complete_auto( currentDir, ProtocolName, invID_passed ); // Updtade later: what should be passed with signal ??
+ return;
+ }
+
+ else if (msgBox.clickedButton() == Ignore)
+ {
+ reset();
+ delete_autoflow_record();
+ emit return_to_experiment( ProtocolName );
+ return;
+ }
+ }
- expStatTwo();
- return;
- }
+ //expStatThree();
+ }
+ }
+
qDebug() << "sys_timer RAN here: ";
in_reload_check_sysdata = false;
@@ -1852,13 +1917,13 @@
}
}
-// Stop/reset all system panels and pass to stage 3 when exp_Status == 2
-void US_XpnDataViewer::expStatTwo( void )
+// Stop/reset all system panels and pass to stage 3 when exp_Status == 3
+void US_XpnDataViewer::expStatThree( void )
{
// timer_check_sysdata->stop();
// disconnect(timer_check_sysdata, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
- // qDebug() << "ExpStat: 2 - sys_timer STOPPED here: ";
+ // qDebug() << "ExpStat: 3 - sys_timer STOPPED here: ";
// rpm_box->setSpeed( 0 );
// le_remaining->setText( "00:00:00" );
@@ -1952,23 +2017,29 @@
timer_data_init->start(5000); // 5 sec
msg_data_avail = new QMessageBox;
+ msg_data_avail->setIcon(QMessageBox::Information);
+
//msg_data_avail->setStandardButtons(0);
msg_data_avail->setWindowFlags ( Qt::CustomizeWindowHint | Qt::WindowTitleHint);
// QPushButton *okButton = msg_data_avail->addButton(tr("Ok"), QMessageBox::AcceptRole);
// okButton->hide();
- QPushButton *Close = msg_data_avail->addButton(tr("Close Program Now?"), QMessageBox::AcceptRole);
-
- msg_data_avail->setIcon(QMessageBox::Information);
- msg_data_avail->setText(tr( "Run named %1 was submitted to:\n\n"
- "%2 \n\n"
- "Please start this method scan from the instrument panel. \n\n\n"
- "You may close program now and reattach later by reopening and "
- "selecting among the list of Optima runs to follow. "
- "Alternatively, you can wait untill the method is started from "
- "the Optima panel and monitor the progress.")
- .arg(RunName).arg(OptimaName) );
+ QPushButton *Close = msg_data_avail->addButton(tr("Close Program Now?"), QMessageBox::RejectRole);
+ msg_data_avail->setText(tr( "Run named <b>%1</b> was submitted to: <br>"
+ "<br><b>%2</b> <br>"
+ "<br>Please start this method scan from the instrument panel. <br>"
+ "<br>You may close program now and reattach later by reopening and "
+ "selecting <b>%1</b> among the list of Optima runs to follow. "
+ "Alternatively, you can wait untill the method is started from "
+ "the Optima panel and monitor the progress.")
+ .arg(RunName).arg(OptimaName) );
+ //msg_data_avail->setText(tr( "Run named %1 was submitted to:\n\n"
+ // "%2 \n\n"
+ // "Please start this method scan from the instrument panel. \n\n\n")
+ //
+ // .arg(RunName).arg(OptimaName) );
+
msg_data_avail->exec();
if (msg_data_avail->clickedButton() == Close)
@@ -1978,6 +2049,7 @@
emit close_program();
}
+
}
//void US_XpnDataViewer::retrieve_xpn_raw_auto( QString & RunID )
@@ -3602,8 +3674,10 @@
}
}
+
/** Experiment Aborted ***/
- if ( statusExp == 2 )
+
+ if ( statusExp == 3 )
{
timer_data_reload->stop();
disconnect(timer_data_reload, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
@@ -3644,7 +3718,8 @@
}
}
}
-
+
+
in_reload_auto = false; // Flag no longer in the midst of reload
return; // Return with no change in AUC data
}
Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h 2019-04-30 04:45:52 UTC (rev 2746)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h 2019-04-30 23:31:05 UTC (rev 2747)
@@ -303,7 +303,7 @@
void updateautoflow_record_atLiveUpdate( void );
void expStatFive( void );
- void expStatTwo( void );
+ void expStatThree( void );
void load_auc_xpn ( void );
void plot_current ( void );
Modified: trunk/sql/us3_autoflow_procs.sql
===================================================================
--- trunk/sql/us3_autoflow_procs.sql 2019-04-30 04:45:52 UTC (rev 2746)
+++ trunk/sql/us3_autoflow_procs.sql 2019-04-30 23:31:05 UTC (rev 2747)
@@ -351,9 +351,9 @@
IF ( verify_user( p_personGUID, p_password ) = @OK ) THEN
IF ( count_records > 0 ) THEN
IF ( cur_runStarted IS NOT NULL ) THEN
-
- SELECT TIMESTAMPDIFF( SECOND, curr_runStarted, NOW() )
- INTO l_sec_difference;
+
+ SELECT TIMESTAMPDIFF( SECOND, runStarted, NOW() )
+ INTO l_sec_difference FROM autoflow WHERE runID = p_runID;
END IF;
END IF;
1
0
r2746 - in trunk: gui programs/us_com_project programs/us_com_project_academic programs/us_xpn_viewer
by svn@svn.aucsolutions.com April 29, 2019
by svn@svn.aucsolutions.com April 29, 2019
April 29, 2019
Author: alexey
Date: 2019-04-30 04:45:52 +0000 (Tue, 30 Apr 2019)
New Revision: 2746
Modified:
trunk/gui/us_select_item.cpp
trunk/programs/us_com_project/us_com_project_gui.cpp
trunk/programs/us_com_project/us_com_project_gui.h
trunk/programs/us_com_project/us_com_project_main.cpp
trunk/programs/us_com_project_academic/us_com_project_academic_main.cpp
trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
Log:
job reattachement in autoflow update...
Modified: trunk/gui/us_select_item.cpp
===================================================================
--- trunk/gui/us_select_item.cpp 2019-04-29 19:17:02 UTC (rev 2745)
+++ trunk/gui/us_select_item.cpp 2019-04-30 04:45:52 UTC (rev 2746)
@@ -143,14 +143,19 @@
// Button Row
QHBoxLayout* buttons = new QHBoxLayout;
- QString cancel_pb_label("Cancel");
+ QString cancel_pb_label( tr("Cancel") );
if ( autoflow_button )
cancel_pb_label = tr("Define Another Experiment");
QPushButton* pb_cancel = us_pushbutton( cancel_pb_label );
+
+ QString accept_pb_label( tr( "Select Item" ) );
+ if ( autoflow_button )
+ accept_pb_label = tr("Select Optima Run to Follow");
+
QPushButton* pb_accept = us_pushbutton( multi_sel ?
tr( "Select Item(s)" ) :
- tr( "Select Item" ) );
+ accept_pb_label );
QPushButton* pb_delete = us_pushbutton( tr( "Delete Item" ) );
Modified: trunk/programs/us_com_project/us_com_project_gui.cpp
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.cpp 2019-04-29 19:17:02 UTC (rev 2745)
+++ trunk/programs/us_com_project/us_com_project_gui.cpp 2019-04-30 04:45:52 UTC (rev 2746)
@@ -32,7 +32,8 @@
{
// dbg_level = US_Settings::us_debug();
curr_panx = 0;
-
+ window_closed = false;
+
us_mode_bool = true;
setWindowTitle( tr( "UltraScan Optima AUC Interface" ) );
@@ -147,7 +148,8 @@
connect( this, SIGNAL( import_data_us_convert( QString &, QString &, QString & ) ), epanPostProd, SLOT( import_data_us_convert( QString &, QString &, QString & ) ) );
connect( epanObserv, SIGNAL( switch_to_experiment( QString &) ), this, SLOT( switch_to_experiment( QString & ) ) );
connect( this, SIGNAL( clear_experiment( QString & ) ), epanExp, SLOT( clear_experiment( QString & ) ) );
-
+ connect( epanObserv, SIGNAL( close_everything() ), this, SLOT( close_all() ));
+
//connect( epanPostProd, SIGNAL( switch_to_analysis( QString &, QString &) ), this, SLOT( switch_to_analysis( QString &, QString & ) ) );
//connect( this, SIGNAL( pass_to_analysis( QString &, QString & ) ), epanAnalysis, SLOT( do_analysis( QString &, QString & ) ) );
@@ -169,6 +171,7 @@
// dbg_level = US_Settings::us_debug();
curr_panx = 0;
+ window_closed = false;
us_mode_bool = false;
setWindowTitle( tr( "UltraScan Optima AUC Interface" ) );
@@ -277,7 +280,8 @@
connect( this, SIGNAL( import_data_us_convert( QString &, QString &, QString & ) ), epanPostProd, SLOT( import_data_us_convert( QString &, QString &, QString & ) ) );
connect( epanObserv, SIGNAL( switch_to_experiment( QString &) ), this, SLOT( switch_to_experiment( QString & ) ) );
connect( this, SIGNAL( clear_experiment( QString & ) ), epanExp, SLOT( clear_experiment( QString & ) ) );
-
+ connect( epanObserv, SIGNAL( close_everything() ), this, SLOT( close_all() ));
+
connect( epanPostProd, SIGNAL( switch_to_analysis( QString &, QString &) ), this, SLOT( switch_to_analysis( QString &, QString & ) ) );
connect( this, SIGNAL( pass_to_analysis( QString &, QString & ) ), epanAnalysis, SLOT( do_analysis( QString &, QString & ) ) );
@@ -288,6 +292,14 @@
//check_current_stage();
}
+
+void US_ComProjectMain::closeEvent( QCloseEvent* event )
+{
+ window_closed = true;
+ emit us_comproject_closed();
+ event->accept();
+}
+
// Function that checks for current program stage based on US-lims DB entry
void US_ComProjectMain::check_current_stage( void )
{
@@ -554,6 +566,42 @@
emit pass_to_live_update( protocol_details );
}
+// Slot to pass submitted to Optima run info to the Live Update tab
+void US_ComProjectMain::close_all( void )
+{
+ tabWidget->setCurrentIndex( 0 );
+ qDebug() << "CLOSING PROGRAM !!!";
+
+ close();
+
+ // QProcess process;
+ // QString pgm("pgrep");
+ // QStringList args = QStringList() << "us_comproject";
+ // process.start(pgm, args);
+ // process.waitForReadyRead();
+ // if(!process.readAllStandardOutput().isEmpty())
+ // {
+ // //app still running
+ // //Linux
+ // system("pkill us_comproject");
+ // //Windows
+ // system("taskkill /im us_comproject /f");
+
+ // process.kill();
+ // }
+
+ //Linux
+ //system("pkill us_comproject");
+
+
+ //system("pkill us_comproject_academic");
+ //Windows//
+ //system("taskkill /im us_comproject /f");
+ //system("taskkill /im us_comproject_academic /f");
+ //Mac ??
+
+}
+
// Slot to switch from the Live Update to Editing tab
void US_ComProjectMain::switch_to_post_processing( QString & currDir, QString & protocolName, QString & invID_passed )
{
@@ -845,6 +893,9 @@
//ALEXEY: return to 1st panel when exp. aborted & no data saved..
connect( sdiag, SIGNAL( return_to_experiment( QString & ) ), this, SLOT( to_experiment ( QString &) ) );
+
+ //ALEXEY: close program, emitted from sdiag
+ connect( sdiag, SIGNAL( close_program() ), this, SLOT( to_close_program() ) );
offset = 0;
sdiag->move(offset, 2*offset);
@@ -910,6 +961,12 @@
emit switch_to_experiment( protocolName );
}
+void US_ObservGui::to_close_program( void )
+{
+ //sdiag->close();
+ emit close_everything();
+}
+
// US_PostProd
US_PostProdGui::US_PostProdGui( QWidget* topw )
: US_WidgetsDialog( topw, 0 )
Modified: trunk/programs/us_com_project/us_com_project_gui.h
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.h 2019-04-29 19:17:02 UTC (rev 2745)
+++ trunk/programs/us_com_project/us_com_project_gui.h 2019-04-30 04:45:52 UTC (rev 2746)
@@ -118,10 +118,12 @@
void process_protocol_details( QMap < QString, QString > & protocol_details );
void to_post_processing( QString & currDir, QString & protocolName, QString & invID_passed );
void to_experiment( QString & protocolName );
+ void to_close_program( void );
signals:
void to_xpn_viewer( QMap < QString, QString > & protocol_details );
void switch_to_post_processing( QString & currDir, QString & protocolName, QString & invID_passed );
void switch_to_experiment( QString & protocolName );
+ void close_everything( void );
};
@@ -224,6 +226,8 @@
QList< QStringList > autoflowdata;
void check_current_stage( void );
+
+ bool window_closed;
private:
US_ExperGui* epanExp; // US_Exp panel
@@ -257,12 +261,15 @@
void switch_to_analysis( QString & currDir, QString & protocolName );
void switch_to_experiment( QString & protocolName );
//void check_current_stage( void );
+ void close_all( void );
+ void closeEvent ( QCloseEvent* );
signals:
void pass_to_live_update( QMap < QString, QString > & protocol_details );
void import_data_us_convert( QString & currDir, QString & protocolName, QString & invID_passed );
void pass_to_analysis( QString & currDir, QString & protocolName );
void clear_experiment( QString & protocolName);
+ void us_comproject_closed( void );
};
Modified: trunk/programs/us_com_project/us_com_project_main.cpp
===================================================================
--- trunk/programs/us_com_project/us_com_project_main.cpp 2019-04-29 19:17:02 UTC (rev 2745)
+++ trunk/programs/us_com_project/us_com_project_main.cpp 2019-04-30 04:45:52 UTC (rev 2746)
@@ -18,7 +18,10 @@
w->show(); //!< \memberof QWidget
w->check_current_stage();
-
+
+ if ( w->window_closed )
+ return 0;
+
return application.exec(); //!< \memberof QApplication
}
Modified: trunk/programs/us_com_project_academic/us_com_project_academic_main.cpp
===================================================================
--- trunk/programs/us_com_project_academic/us_com_project_academic_main.cpp 2019-04-29 19:17:02 UTC (rev 2745)
+++ trunk/programs/us_com_project_academic/us_com_project_academic_main.cpp 2019-04-30 04:45:52 UTC (rev 2746)
@@ -19,6 +19,9 @@
w->check_current_stage();
+ if ( w->window_closed )
+ return 0;
+
return application.exec(); //!< \memberof QApplication
}
Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-04-29 19:17:02 UTC (rev 2745)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-04-30 04:45:52 UTC (rev 2746)
@@ -1954,14 +1954,30 @@
msg_data_avail = new QMessageBox;
//msg_data_avail->setStandardButtons(0);
msg_data_avail->setWindowFlags ( Qt::CustomizeWindowHint | Qt::WindowTitleHint);
- QPushButton *okButton = msg_data_avail->addButton(tr("Ok"), QMessageBox::AcceptRole);
- okButton->hide();
+ // QPushButton *okButton = msg_data_avail->addButton(tr("Ok"), QMessageBox::AcceptRole);
+ // okButton->hide();
+
+ QPushButton *Close = msg_data_avail->addButton(tr("Close Program Now?"), QMessageBox::AcceptRole);
msg_data_avail->setIcon(QMessageBox::Information);
msg_data_avail->setText(tr( "Run named %1 was submitted to:\n\n"
"%2 \n\n"
- "Please start this method scan from the instrument panel.").arg(RunName).arg(OptimaName) );
+ "Please start this method scan from the instrument panel. \n\n\n"
+ "You may close program now and reattach later by reopening and "
+ "selecting among the list of Optima runs to follow. "
+ "Alternatively, you can wait untill the method is started from "
+ "the Optima panel and monitor the progress.")
+ .arg(RunName).arg(OptimaName) );
+
msg_data_avail->exec();
+
+ if (msg_data_avail->clickedButton() == Close)
+ {
+ timer_data_init->stop();
+ disconnect(timer_data_init, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
+
+ emit close_program();
+ }
}
//void US_XpnDataViewer::retrieve_xpn_raw_auto( QString & RunID )
Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h 2019-04-29 19:17:02 UTC (rev 2745)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h 2019-04-30 04:45:52 UTC (rev 2746)
@@ -349,6 +349,7 @@
signals:
void experiment_complete_auto( QString &, QString &, QString & );
void return_to_experiment( QString & );
+ void close_program( void );
};
#endif
1
0
r2745 - in trunk: gui programs/us_astfem_sim programs/us_mpi_analysis utils
by svn@svn.aucsolutions.com April 29, 2019
by svn@svn.aucsolutions.com April 29, 2019
April 29, 2019
Author: gegorbet
Date: 2019-04-29 19:17:02 +0000 (Mon, 29 Apr 2019)
New Revision: 2745
Modified:
trunk/gui/us_editor.cpp
trunk/gui/us_editor_gui.cpp
trunk/programs/us_astfem_sim/us_astfem_sim.cpp
trunk/programs/us_mpi_analysis/us_mpi_analysis.cpp
trunk/utils/us_astfem_math.h
trunk/utils/us_astfem_rsa.cpp
trunk/utils/us_simparms.cpp
Log:
Mac mod for File menu, multi-speed bottom handling, fit-meniscus backend from old LIMS
Modified: trunk/gui/us_editor.cpp
===================================================================
--- trunk/gui/us_editor.cpp 2019-04-29 06:50:48 UTC (rev 2744)
+++ trunk/gui/us_editor.cpp 2019-04-29 19:17:02 UTC (rev 2745)
@@ -5,8 +5,8 @@
#include <QtPrintSupport>
#endif
-US_Editor::US_Editor( int menu, bool readonly, const QString& extension,
- QWidget* parent, Qt::WindowFlags flags ) : QMainWindow( parent, flags )
+US_Editor::US_Editor( int menu, bool readonly, const QString& extension,
+ QWidget* parent, Qt::WindowFlags flags ) : QMainWindow( parent, flags )
{
file_extension = extension;
file_directory = US_Settings::dataDir();
@@ -36,6 +36,7 @@
#else
#if QT_VERSION > 0x050000
edMenuBar = menuBar();
+ edMenuBar->setNativeMenuBar( false );
#else
edMenuBar = new QMenuBar( 0 );
#endif
@@ -85,13 +86,13 @@
fileMenu->addAction( clearAction );
}
- menuBar()->setPalette( US_GuiSettings::normalColor() );
- menuBar()->setFont ( QFont( US_GuiSettings::fontFamily(),
+ edMenuBar->setPalette( US_GuiSettings::normalColor() );
+ edMenuBar->setFont ( QFont( US_GuiSettings::fontFamily(),
US_GuiSettings::fontSize() ) );
- currentFont = QFont( "monospace", US_GuiSettings::fontSize() - 1,
+ currentFont = QFont( "monospace", US_GuiSettings::fontSize() - 1,
QFont::Bold );
-
+
e = new QTextEdit( this );
e->setFont ( currentFont );
e->setPalette ( US_GuiSettings::editColor() );
@@ -106,9 +107,9 @@
QString fn;
QString text;
- fn = QFileDialog::getOpenFileName( this,
+ fn = QFileDialog::getOpenFileName( this,
tr( "Open File" ),
- file_directory,
+ file_directory,
file_extension );
if ( fn == "" ) return;
@@ -136,7 +137,7 @@
void US_Editor::save( )
{
- if ( filename == "" )
+ if ( filename == "" )
saveAs();
else
saveFile();
@@ -147,7 +148,7 @@
QString fn;
fn = QFileDialog::getSaveFileName( this );
-
+
if ( ! fn.isEmpty( ) )
{
filename = fn;
@@ -158,7 +159,7 @@
void US_Editor::saveFile( void )
{
QString text = e->toPlainText();
-
+
QFile f( filename );
if ( f.open( QIODevice::WriteOnly | QIODevice::Text ) )
@@ -179,7 +180,7 @@
bool ok;
currentFont = e->font();
QFont newFont = QFontDialog::getFont( &ok, currentFont, this );
-
+
if ( ok )
{
currentFont = newFont;
@@ -193,7 +194,7 @@
QPrintDialog* dialog = new QPrintDialog( &printer, this );
dialog->setWindowTitle( tr( "Print Document" ) );
-
+
if ( dialog->exec() != QDialog::Accepted ) return;
QStringList text = e->toPlainText().split( "\n" );
@@ -201,10 +202,10 @@
p.begin( &printer ); // paint on printer
p.setFont( e->font() );
-
+
int yPos = 0; // y position for each line
QFontMetrics fm = p.fontMetrics();
-
+
const int MARGIN = 10;
for ( int i = 0; i < text.size(); i++ )
@@ -214,15 +215,15 @@
printer.newPage(); // no more room on this page
yPos = 0; // back to top of page
}
-
+
p.drawText( MARGIN, MARGIN + yPos,
printer.width(), fm.lineSpacing(),
Qt::TextExpandTabs, text[ i ] );
-
+
yPos = yPos + fm.lineSpacing();
}
p.end(); // send job to printer
}
-
+
Modified: trunk/gui/us_editor_gui.cpp
===================================================================
--- trunk/gui/us_editor_gui.cpp 2019-04-29 06:50:48 UTC (rev 2744)
+++ trunk/gui/us_editor_gui.cpp 2019-04-29 19:17:02 UTC (rev 2745)
@@ -19,4 +19,3 @@
main->addWidget( editor );
}
-
Modified: trunk/programs/us_astfem_sim/us_astfem_sim.cpp
===================================================================
--- trunk/programs/us_astfem_sim/us_astfem_sim.cpp 2019-04-29 06:50:48 UTC (rev 2744)
+++ trunk/programs/us_astfem_sim/us_astfem_sim.cpp 2019-04-29 19:17:02 UTC (rev 2745)
@@ -537,6 +537,12 @@
US_AstfemMath::writetimestate( tmst_tfpath, simparams, sim_data_all );
simparams.simSpeedsFromTimeState( tmst_tfpath );
+//*DEBUG*
+DbgLv(1) << "ASIM: === speed steps from SSprof ===";
+simparams.speedstepsFromSSprof();
+simparams.debug();
+DbgLv(1) << "ASIM: === speed steps from SSprof ===";
+//*DEBUG*
// Report simulation parameters
change_status();
Modified: trunk/programs/us_mpi_analysis/us_mpi_analysis.cpp
===================================================================
--- trunk/programs/us_mpi_analysis/us_mpi_analysis.cpp 2019-04-29 06:50:48 UTC (rev 2744)
+++ trunk/programs/us_mpi_analysis/us_mpi_analysis.cpp 2019-04-29 19:17:02 UTC (rev 2745)
@@ -306,7 +306,7 @@
fit_mb_select = parameters[ "fit_mb_select" ].toInt();
meniscus_range = parameters[ "meniscus_range" ].toDouble();
meniscus_points = parameters[ "meniscus_points" ].toInt();
- fit_mb_select = ( meniscus_points > 1 ) ? fit_mb_select : 0;
+ fit_mb_select = ( meniscus_points > 1 ) ? qMax( 1, fit_mb_select ) : 0;
fit_meni = ( ( fit_mb_select & 1 ) != 0 );
fit_bott = ( ( fit_mb_select & 2 ) != 0 );
fit_menbot = ( fit_meni && fit_bott );
Modified: trunk/utils/us_astfem_math.h
===================================================================
--- trunk/utils/us_astfem_math.h 2019-04-29 06:50:48 UTC (rev 2744)
+++ trunk/utils/us_astfem_math.h 2019-04-29 19:17:02 UTC (rev 2745)
@@ -409,6 +409,7 @@
double start_om2t; //!< start omega^2t of simulation
double current_meniscus; //!< actual meniscus for current speed
double current_bottom; //!< actual bottom for current speed
+ double bottom_pos; //!< centerpiece bottom (possibly adjusted)
int cdset_speed; //!< constant speed for current dataset
int rg_index; //!< reaction group index
Modified: trunk/utils/us_astfem_rsa.cpp
===================================================================
--- trunk/utils/us_astfem_rsa.cpp 2019-04-29 06:50:48 UTC (rev 2744)
+++ trunk/utils/us_astfem_rsa.cpp 2019-04-29 19:17:02 UTC (rev 2745)
@@ -146,6 +146,18 @@
af_params.omega_s = sq( s0speed * M_PI / 30.0 ); // omega_square
af_params.start_om2t = af_params.omega_s; // Starting omega square t
af_params.start_time = 0.0; // Starting time
+ af_params.bottom_pos = simparams.bottom_position; // Centerpiece bottom
+ if ( simparams.bottom > simparams.bottom_position )
+ {
+ double stretch_val = stretch( simparams.rotorcoeffs,
+ (int)af_params.cdset_speed );
+ double bottom_clc = simparams.bottom_position + stretch_val;
+ double bott_diff = simparams.bottom - bottom_clc;
+ if ( qAbs( bott_diff ) > 1.e-5 )
+ {
+ af_params.bottom_pos = simparams.bottom_position + bott_diff;
+ }
+ }
#if 1
adjust_limits( af_params.cdset_speed ); // Does rotor stretch
#endif
@@ -1217,8 +1229,8 @@
void US_Astfem_RSA::adjust_limits( int speed )
{
// First correct meniscus to theoretical position at rest:
- double stretch_value = stretch( simparams.rotorcoeffs,
- (int)af_params.cdset_speed );
+ int icset_speed = (int)af_params.cdset_speed;
+ double stretch_value = stretch( simparams.rotorcoeffs, icset_speed );
DbgLv(1)<< "RSA:adjlim stretch1" << stretch_value << "speed" << af_params.cdset_speed;
// This is the meniscus at rest
@@ -1237,10 +1249,17 @@
#endif
#if 1
// Either use current bottom or add current stretch to bottom at rest
- if ( simparams.bottom > simparams.bottom_position )
+ if ( icset_speed == speed &&
+ simparams.bottom > simparams.bottom_position )
+ { // If the current speed step matches the dataset speed step
+ // and a specific bottom was given, then use that bottom value.
af_params.current_bottom = simparams.bottom;
+ }
else
- af_params.current_bottom = simparams.bottom_position + stretch_value;
+ { // If no bottom was given or we are at a speed step preceding the
+ // current dataset's, then calculate the bottom value.
+ af_params.current_bottom = af_params.bottom_pos + stretch_value;
+ }
#endif
}
Modified: trunk/utils/us_simparms.cpp
===================================================================
--- trunk/utils/us_simparms.cpp 2019-04-29 06:50:48 UTC (rev 2744)
+++ trunk/utils/us_simparms.cpp 2019-04-29 19:17:02 UTC (rev 2745)
@@ -1206,8 +1206,8 @@
(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 > 0 )
+ //if ( ss3 == ss2 && ss2 == ss1 && ss3 > 3500 )
{ // This non-zero set-speed and both previous are the same
if ( ! cspeeds.contains( ss3 ) )
cspeeds << ss3; // Save it if first time encountered
1
0
r2744 - in trunk: gui programs/us_com_project programs/us_com_project_academic
by svn@svn.aucsolutions.com April 29, 2019
by svn@svn.aucsolutions.com April 29, 2019
April 29, 2019
Author: alexey
Date: 2019-04-29 06:50:48 +0000 (Mon, 29 Apr 2019)
New Revision: 2744
Modified:
trunk/gui/us_select_item.cpp
trunk/gui/us_select_item.h
trunk/programs/us_com_project/us_com_project_gui.cpp
trunk/programs/us_com_project/us_com_project_gui.h
trunk/programs/us_com_project/us_com_project_main.cpp
trunk/programs/us_com_project_academic/us_com_project_academic_main.cpp
Log:
ojb reattachement, minpor updates
Modified: trunk/gui/us_select_item.cpp
===================================================================
--- trunk/gui/us_select_item.cpp 2019-04-29 03:44:16 UTC (rev 2743)
+++ trunk/gui/us_select_item.cpp 2019-04-29 06:50:48 UTC (rev 2744)
@@ -19,6 +19,7 @@
{
multi_sel = false;
deleted_button = false;
+ autoflow_button = false;
selxP = aselxP;
selxsP = NULL;
sort_ord = ( def_sort < 0 ) ? Qt::DescendingOrder
@@ -34,15 +35,23 @@
// Alternate constructor to enable selecting a single item with Delete button
US_SelectItem::US_SelectItem( QList< QStringList >& items,
- QStringList& hdrs, const QString titl, int* aselxP, QString deleted,
+ QStringList& hdrs, const QString titl, int* aselxP, QString add_label,
const int def_sort )
: US_WidgetsDialog( 0, 0 ), items( items ), hdrs( hdrs )
{
multi_sel = false;
-
- if ( !deleted.isEmpty() )
- deleted_button = true;
+ deleted_button = false;
+ autoflow_button = false;
+
+ if ( !add_label.isEmpty() )
+ {
+ if ( add_label == "DELETE" )
+ deleted_button = true;
+ if ( add_label == "AUTOFLOW" )
+ autoflow_button = true;
+ }
+
selxP = aselxP;
selxsP = NULL;
sort_ord = ( def_sort < 0 ) ? Qt::DescendingOrder
@@ -52,7 +61,7 @@
build_layout( titl );
tw_data->setSelectionMode( QAbstractItemView::SingleSelection );
-
+
show();
}
@@ -134,7 +143,11 @@
// Button Row
QHBoxLayout* buttons = new QHBoxLayout;
- QPushButton* pb_cancel = us_pushbutton( tr( "Cancel" ) );
+ QString cancel_pb_label("Cancel");
+ if ( autoflow_button )
+ cancel_pb_label = tr("Define Another Experiment");
+
+ QPushButton* pb_cancel = us_pushbutton( cancel_pb_label );
QPushButton* pb_accept = us_pushbutton( multi_sel ?
tr( "Select Item(s)" ) :
tr( "Select Item" ) );
Modified: trunk/gui/us_select_item.h
===================================================================
--- trunk/gui/us_select_item.h 2019-04-29 03:44:16 UTC (rev 2743)
+++ trunk/gui/us_select_item.h 2019-04-29 06:50:48 UTC (rev 2744)
@@ -61,6 +61,7 @@
bool multi_sel; //!< Flag: multiple selections enabled?
bool deleted_button; //If Delete button is present
+ bool autoflow_button; //If autoflow, Cancel becomes define another Experiment
Qt::SortOrder sort_ord; //!< Default sort order flag
int sort_col; //!< Default sort column
int nitems; //!< Number of items (rows)
Modified: trunk/programs/us_com_project/us_com_project_gui.cpp
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.cpp 2019-04-29 03:44:16 UTC (rev 2743)
+++ trunk/programs/us_com_project/us_com_project_gui.cpp 2019-04-29 06:50:48 UTC (rev 2744)
@@ -157,7 +157,7 @@
adjustSize();
/* Check for current stage & redirect to specific tab */
- check_current_stage();
+ //check_current_stage();
}
@@ -285,10 +285,7 @@
adjustSize();
/* Check for current stage & redirect to specific tab */
- check_current_stage();
-
- //connect( epanExp, SIGNAL( check_stage() ), this, SLOT( check_current_stage() ) );
- //emit check_stage();
+ //check_current_stage();
}
// Function that checks for current program stage based on US-lims DB entry
@@ -346,7 +343,7 @@
// --------------------------------------------------------------------------------------------
-
+
// Query 'autoflow': get cout of records
int autoflow_records = get_autoflow_records();
@@ -370,10 +367,18 @@
<< "Created"
<< "Started";
- US_SelectItem pdiag( autoflowdata, hdrs, pdtitle, &prx, -2 );
+ QString autoflow_btn = "AUTOFLOW";
+
+ //US_SelectItem pdiag( autoflowdata, hdrs, pdtitle, &prx, autoflow_btn, -2 );
+ US_SelectItem* pdiag = new US_SelectItem( autoflowdata, hdrs, pdtitle, &prx, autoflow_btn, -2 );
+
+ pdiag->setParent(this, Qt::Window);
+ pdiag->setWindowFlags(Qt::Dialog | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint );
+ //pdiag->setWindowFlags(Qt::Window | Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint );
+
QString autoflow_id_selected("");
- if ( pdiag.exec() == QDialog::Accepted )
+ if ( pdiag->exec() == QDialog::Accepted )
autoflow_id_selected = autoflowdata[ prx ][ 0 ];
else
return;
@@ -1097,5 +1102,6 @@
// assemble main
main->addLayout(genL);
main->addStretch();
+
}
Modified: trunk/programs/us_com_project/us_com_project_gui.h
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.h 2019-04-29 03:44:16 UTC (rev 2743)
+++ trunk/programs/us_com_project/us_com_project_gui.h 2019-04-29 06:50:48 UTC (rev 2744)
@@ -94,7 +94,6 @@
void switch_to_live_update( QMap < QString, QString > & protocol_details );
void set_auto_mode( void );
void reset_experiment( QString & protocolName);
- void check_stage( void );
};
@@ -200,7 +199,6 @@
signals:
-
};
@@ -224,7 +222,9 @@
bool us_mode_bool;
QList< QStringList > autoflowdata;
-
+
+ void check_current_stage( void );
+
private:
US_ExperGui* epanExp; // US_Exp panel
US_ObservGui* epanObserv; // US_Observ panel
@@ -240,7 +240,8 @@
int get_autoflow_records( void );
QMap < QString, QString > read_autoflow_record( int );
static int list_all_autoflow_records( QList< QStringList >&, US_DB2* );
-
+
+
private slots:
//void reset ( void );
//void newPanel ( int ); // Move to a new panel
@@ -255,14 +256,13 @@
void switch_to_post_processing( QString & currDir, QString & protocolName, QString & invID_passed );
void switch_to_analysis( QString & currDir, QString & protocolName );
void switch_to_experiment( QString & protocolName );
- void check_current_stage( void );
+ //void check_current_stage( void );
signals:
void pass_to_live_update( QMap < QString, QString > & protocol_details );
void import_data_us_convert( QString & currDir, QString & protocolName, QString & invID_passed );
void pass_to_analysis( QString & currDir, QString & protocolName );
void clear_experiment( QString & protocolName);
- //void check_stage( void );
};
Modified: trunk/programs/us_com_project/us_com_project_main.cpp
===================================================================
--- trunk/programs/us_com_project/us_com_project_main.cpp 2019-04-29 03:44:16 UTC (rev 2743)
+++ trunk/programs/us_com_project/us_com_project_main.cpp 2019-04-29 06:50:48 UTC (rev 2744)
@@ -16,6 +16,9 @@
//w.setFrameShape( QFrame::Box);
//w.setLineWidth(1);
w->show(); //!< \memberof QWidget
+
+ w->check_current_stage();
+
return application.exec(); //!< \memberof QApplication
}
Modified: trunk/programs/us_com_project_academic/us_com_project_academic_main.cpp
===================================================================
--- trunk/programs/us_com_project_academic/us_com_project_academic_main.cpp 2019-04-29 03:44:16 UTC (rev 2743)
+++ trunk/programs/us_com_project_academic/us_com_project_academic_main.cpp 2019-04-29 06:50:48 UTC (rev 2744)
@@ -16,6 +16,9 @@
//w.setFrameShape( QFrame::Box);
//w.setLineWidth(1);
w->show(); //!< \memberof QWidget
+
+ w->check_current_stage();
+
return application.exec(); //!< \memberof QApplication
}
1
0
April 28, 2019
Author: alexey
Date: 2019-04-29 03:44:16 +0000 (Mon, 29 Apr 2019)
New Revision: 2743
Modified:
trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
trunk/sql/us3_autoflow_procs.sql
Log:
Update on job reattachement
Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-04-28 17:43:16 UTC (rev 2742)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-04-29 03:44:16 UTC (rev 2743)
@@ -1066,6 +1066,7 @@
reset();
adjustSize();
+
}
@@ -1417,7 +1418,6 @@
// Load Optima raw (.postgres) data
bool US_XpnDataViewer::load_xpn_raw_auto( )
{
-
bool status_ok = false;
if ( in_reload_data_init ) // If already doing a reload,
@@ -1439,10 +1439,12 @@
qDebug() << "RunID_to_retrieve 1: " << RunID_to_retrieve;
+
+ // //Test
// ElapsedTimeOffset = read_timeElapsed_offset();
- // qDebug() << "Elapsed Time Offset: " << ElapsedTimeOffset;
+ // qDebug() << "TEST: Elapsed time from autoflow: " << ElapsedTimeOffset;
+
-
// runInfo.clear();
//xpn_data->scan_runs( runInfo ); // ALEXEY initial query (for us_comproject needs to be based on ExpId )
@@ -1581,11 +1583,14 @@
tr( "Read protocol: Could not connect to database \n" ) + db->lastError() );
return time_offset;
}
-
+
QStringList qry;
- qry << "read_autoflow_times"
+ qry << "read_autoflow_times_mod"
<< RunID_to_retrieve;
-
+
+ // //Test only
+ // qry << "read_autoflow_times_mod_test";
+
time_offset = db->functionQuery( qry );
return time_offset;
@@ -2255,6 +2260,7 @@
// Load Optima raw (.postgres) data
void US_XpnDataViewer::load_xpn_raw( )
{
+
// Ask for data directory
QString dbhost = xpnhost;
int dbport = xpnport.toInt();
Modified: trunk/sql/us3_autoflow_procs.sql
===================================================================
--- trunk/sql/us3_autoflow_procs.sql 2019-04-28 17:43:16 UTC (rev 2742)
+++ trunk/sql/us3_autoflow_procs.sql 2019-04-29 03:44:16 UTC (rev 2743)
@@ -208,7 +208,7 @@
END$$
--- Update autoflow record with Optima's RunID
+-- Update autoflow record with Optima's RunID (ONLY once, first time )
DROP PROCEDURE IF EXISTS update_autoflow_runid_starttime$$
CREATE PROCEDURE update_autoflow_runid_starttime ( p_personGUID CHAR(36),
p_password VARCHAR(80),
@@ -309,10 +309,99 @@
SELECT TIMESTAMPDIFF( SECOND, runStarted, NOW() )
INTO l_sec_difference
- FROM autoflow WHERE runID = p_runID;
+ FROM autoflow WHERE runID = p_runID AND runStarted IS NOT NULL;
RETURN( l_sec_difference );
END$$
+
+
+---- get initial elapsed time upon reattachment -----------------------------
+DROP FUNCTION IF EXISTS read_autoflow_times_mod$$
+CREATE FUNCTION read_autoflow_times_mod ( p_personGUID CHAR(36),
+ p_password VARCHAR(80),
+ p_runID INT )
+
+ RETURNS INT
+ READS SQL DATA
+
+BEGIN
+ DECLARE count_records INT;
+ DECLARE l_sec_difference INT;
+ DECLARE cur_runStarted TIMESTAMP;
+
+ SET l_sec_difference = 0;
+
+ CALL config();
+ SET @US3_LAST_ERRNO = @OK;
+ SET @US3_LAST_ERROR = '';
+
+ SELECT COUNT(*)
+ INTO count_records
+ FROM autoflow
+ WHERE runID = p_runID;
+
+ SELECT runStarted
+ INTO cur_runStarted
+ FROM autoflow
+ WHERE runID = p_runID;
+
+ IF ( verify_user( p_personGUID, p_password ) = @OK ) THEN
+ IF ( count_records > 0 ) THEN
+ IF ( cur_runStarted IS NOT NULL ) THEN
+
+ SELECT TIMESTAMPDIFF( SECOND, curr_runStarted, NOW() )
+ INTO l_sec_difference;
+
+ END IF;
+ END IF;
+ END IF;
+
+ RETURN( l_sec_difference );
+
+END$$
+
+---- TEST: TO BE DELETED: get initial elapsed time upon reattachment -----------------------------
+DROP FUNCTION IF EXISTS read_autoflow_times_mod_test$$
+CREATE FUNCTION read_autoflow_times_mod_test ( p_personGUID CHAR(36),
+ p_password VARCHAR(80) )
+
+
+ RETURNS INT
+ READS SQL DATA
+
+BEGIN
+ DECLARE count_records INT;
+ DECLARE l_sec_difference INT;
+ DECLARE cur_runStarted TIMESTAMP;
+
+ SET l_sec_difference = 0;
+
+ CALL config();
+ SET @US3_LAST_ERRNO = @OK;
+ SET @US3_LAST_ERROR = '';
+
+ SELECT COUNT(*)
+ INTO count_records
+ FROM autoflow;
+
+ SELECT created
+ INTO cur_runStarted
+ FROM autoflow LIMIT 1;
+
+ IF ( verify_user( p_personGUID, p_password ) = @OK ) THEN
+ IF ( count_records > 0 ) THEN
+ IF ( cur_runStarted IS NOT NULL ) THEN
+
+ SELECT TIMESTAMPDIFF( SECOND, cur_runStarted, NOW() )
+ INTO l_sec_difference;
+
+ END IF;
+ END IF;
+ END IF;
+
+ RETURN( l_sec_difference );
+
+END$$
1
0
April 28, 2019
Author: alexey
Date: 2019-04-28 17:43:16 +0000 (Sun, 28 Apr 2019)
New Revision: 2742
Modified:
trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
trunk/sql/us3_autoflow_procs.sql
Log:
Updates on job reattachement in autoflow...
Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-04-27 09:50:16 UTC (rev 2741)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-04-28 17:43:16 UTC (rev 2742)
@@ -242,6 +242,8 @@
in_reload_data_init = false;
in_reload_check_sysdata = false;
+ ElapsedTimeOffset = 0;
+
//ALEXEY: new way
US_Passwd pw;
US_DB2* dbP = new US_DB2( pw.getPasswd() );
@@ -1436,6 +1438,11 @@
RunID_to_retrieve = QString::number(xpn_data->get_runid( ExpID_to_use ));
qDebug() << "RunID_to_retrieve 1: " << RunID_to_retrieve;
+
+ // ElapsedTimeOffset = read_timeElapsed_offset();
+ // qDebug() << "Elapsed Time Offset: " << ElapsedTimeOffset;
+
+
// runInfo.clear();
//xpn_data->scan_runs( runInfo ); // ALEXEY initial query (for us_comproject needs to be based on ExpId )
@@ -1473,8 +1480,13 @@
disconnect(timer_data_init, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
msg_data_avail->close();
- //ALEXEY: need to update 'autoflow' table with the unique RunID_to_retrieve && Start Run Time fields !!!
-
+ //ALEXEY: need to update 'autoflow' table with the unique RunID_to_retrieve && Start Run Time fields !!!
+ //Conditional: Do it ONLY once !!!
+ update_autoflow_runId_timeStarted();
+
+ //ALEXEY: retrieve startTime from autoflow table:
+ ElapsedTimeOffset = read_timeElapsed_offset();
+
//ALEXEY: elapsed timer start
elapsed_timer = new QElapsedTimer;
elapsed_timer->start();
@@ -1529,6 +1541,129 @@
}
+// When Optima run started & runID aqcuried, update 'autoflow' table
+void US_XpnDataViewer::update_autoflow_runId_timeStarted( void )
+{
+ // Check DB connection
+ US_Passwd pw;
+ QString masterpw = pw.getPasswd();
+ US_DB2* db = new US_DB2( masterpw );
+
+ if ( db->lastErrno() != US_DB2::OK )
+ {
+ QMessageBox::warning( this, tr( "Connection Problem" ),
+ tr( "Read protocol: Could not connect to database \n" ) + db->lastError() );
+ return;
+ }
+
+ QStringList qry;
+ qry << "update_autoflow_runid_starttime"
+ << ExpID_to_use
+ << RunID_to_retrieve;
+
+ db->query( qry );
+ //ALEXEY: Updates with runID && timeStarted only once, when runID && runStarttime IS NULL
+}
+
+// Read diffference btw started tiem and NOW() as an offset for Elapsed time
+int US_XpnDataViewer::read_timeElapsed_offset( void )
+{
+ // Check DB connection
+ US_Passwd pw;
+ QString masterpw = pw.getPasswd();
+ US_DB2* db = new US_DB2( masterpw );
+
+ int time_offset = 0;
+
+ if ( db->lastErrno() != US_DB2::OK )
+ {
+ QMessageBox::warning( this, tr( "Connection Problem" ),
+ tr( "Read protocol: Could not connect to database \n" ) + db->lastError() );
+ return time_offset;
+ }
+
+ QStringList qry;
+ qry << "read_autoflow_times"
+ << RunID_to_retrieve;
+
+ time_offset = db->functionQuery( qry );
+
+ return time_offset;
+}
+
+//Delete autoflow record upon Run abortion
+void US_XpnDataViewer::delete_autoflow_record( void )
+{
+ // Check DB connection
+ US_Passwd pw;
+ QString masterpw = pw.getPasswd();
+ US_DB2* db = new US_DB2( masterpw );
+
+ if ( db->lastErrno() != US_DB2::OK )
+ {
+ QMessageBox::warning( this, tr( "Connection Problem" ),
+ tr( "Read protocol: Could not connect to database \n" ) + db->lastError() );
+ return;
+ }
+
+ QStringList qry;
+ qry << "delete_autoflow_record"
+ << RunID_to_retrieve;
+
+ //db->query( qry );
+
+ // OR
+
+ int status = db->statusQuery( qry );
+
+ if ( status == US_DB2::NO_AUTOFLOW_RECORD )
+ {
+ QMessageBox::warning( this,
+ tr( "Autoflow Record Not Deleted" ),
+ tr( "No autoflow record\n"
+ "associated with this experiment." ) );
+ return;
+ }
+}
+
+
+//Delete autoflow record upon Run abortion
+void US_XpnDataViewer::updateautoflow_record_atLiveUpdate( void )
+{
+ // Check DB connection
+ US_Passwd pw;
+ QString masterpw = pw.getPasswd();
+ US_DB2* db = new US_DB2( masterpw );
+
+ if ( db->lastErrno() != US_DB2::OK )
+ {
+ QMessageBox::warning( this, tr( "Connection Problem" ),
+ tr( "Read protocol: Could not connect to database \n" ) + db->lastError() );
+ return;
+ }
+
+ QStringList qry;
+ qry << "update_autoflow_at_live_update"
+ << RunID_to_retrieve
+ << currentDir;
+
+ //db->query( qry );
+
+ // OR
+
+ int status = db->statusQuery( qry );
+
+ if ( status == US_DB2::NO_AUTOFLOW_RECORD )
+ {
+ QMessageBox::warning( this,
+ tr( "Autoflow Record Not Updated" ),
+ tr( "No autoflow record\n"
+ "associated with this experiment." ) );
+ return;
+ }
+}
+
+
// Check periodically for SysData
void US_XpnDataViewer::check_for_sysdata( void )
{
@@ -1581,10 +1716,9 @@
le_running->setText( running_time_text );
qApp->processEvents();
-
//Elapsed Time
QList< int > dhms_e;
- int elapsed_time = int( elapsed_timer->elapsed() / 1000 );
+ int elapsed_time = int( elapsed_timer->elapsed() / 1000 ) + ElapsedTimeOffset;
int elapsed_time_1 = elapsed_time;
timeToList( elapsed_time, dhms_e );
QString elapsed_time_text;
@@ -1705,6 +1839,7 @@
QString message_done = tr( "Experiment was completed. Optima data saved..." );
QMessageBox::information( this, mtitle_complete, message_done );
+ updateautoflow_record_atLiveUpdate();
emit experiment_complete_auto( currentDir, ProtocolName, invID_passed ); // Updtade later: what should be passed with signal ??
return;
@@ -1746,6 +1881,8 @@
QString mtitle_complete = tr( "Complete!" );
QString message_done = tr( "Experiment was completed. Optima data saved..." );
QMessageBox::information( this, mtitle_complete, message_done );
+
+ updateautoflow_record_atLiveUpdate();
emit experiment_complete_auto( currentDir, ProtocolName, invID_passed ); // Updtade later: what should be passed with signal ??
return;
}
@@ -1753,6 +1890,7 @@
else if (msgBox.clickedButton() == Ignore)
{
reset();
+ delete_autoflow_record();
emit return_to_experiment( ProtocolName );
return;
}
@@ -1790,6 +1928,7 @@
xpn_data->setEtimOffZero(); //ALEXEY: intialize etimoff to zero for the first time
counter_mins = 0;
+ ElapsedTimeOffset = 0;
ExpID_to_use = protocol_details["experimentId"];
ProtocolName = protocol_details["protocolName"];
@@ -3430,6 +3569,8 @@
QString mtitle_complete = tr( "Complete!" );
QString message_done = tr( "Experiment was completed. Optima data saved..." );
QMessageBox::information( this, mtitle_complete, message_done );
+
+ updateautoflow_record_atLiveUpdate();
emit experiment_complete_auto( currentDir, ProtocolName, invID_passed ); // Updtade later: what should be passed with signal ??
//QString temp_protname("DemchukA_exosomes40K_111418");
@@ -3462,10 +3603,12 @@
if (msgBox.clickedButton() == Save)
{
export_auc_auto();
-
+
QString mtitle_complete = tr( "Complete!" );
QString message_done = tr( "Experiment was completed. Optima data saved..." );
QMessageBox::information( this, mtitle_complete, message_done );
+
+ updateautoflow_record_atLiveUpdate();
emit experiment_complete_auto( currentDir, ProtocolName, invID_passed ); // Updtade later: what should be passed with signal ??
return;
}
@@ -3473,6 +3616,7 @@
else if (msgBox.clickedButton() == Ignore)
{
reset();
+ delete_autoflow_record();
emit return_to_experiment( ProtocolName );
return;
}
Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h 2019-04-27 09:50:16 UTC (rev 2741)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h 2019-04-28 17:43:16 UTC (rev 2742)
@@ -279,7 +279,8 @@
QString TripleNumber;
QString OptimaName; //New
QString TotalDuration; //New
- QString invID_passed;
+ QString invID_passed;
+ int ElapsedTimeOffset;
void timeToList( int&, QList< int >& );
@@ -296,6 +297,10 @@
void retrieve_xpn_raw_auto ( void );
void reloadData_auto ( void );
int CheckExpComplete_auto( QString & );
+ void update_autoflow_runId_timeStarted( void );
+ int read_timeElapsed_offset( void );
+ void delete_autoflow_record( void );
+ void updateautoflow_record_atLiveUpdate( void );
void expStatFive( void );
void expStatTwo( void );
Modified: trunk/sql/us3_autoflow_procs.sql
===================================================================
--- trunk/sql/us3_autoflow_procs.sql 2019-04-27 09:50:16 UTC (rev 2741)
+++ trunk/sql/us3_autoflow_procs.sql 2019-04-28 17:43:16 UTC (rev 2742)
@@ -217,23 +217,20 @@
MODIFIES SQL DATA
BEGIN
- DECLARE count_records INT;
+ DECLARE curr_runid INT;
CALL config();
SET @US3_LAST_ERRNO = @OK;
SET @US3_LAST_ERROR = '';
-SELECT COUNT(*)
- INTO count_records
+ SELECT runID
+ INTO curr_runid
FROM autoflow
WHERE expID = p_expID;
+
IF ( verify_user( p_personGUID, p_password ) = @OK ) THEN
- IF ( count_records = 0 ) THEN
- SET @US3_LAST_ERRNO = @NO_AUTOFLOW_RECORD;
- SET @US3_LAST_ERROR = 'MySQL: no rows returned';
-
- ELSE
+ IF ( curr_runid IS NULL ) THEN
UPDATE autoflow
SET runID = p_runid, runStarted = NOW()
WHERE expID = p_expID;
@@ -242,7 +239,7 @@
END IF;
- SELECT @US3_LAST_ERRNO AS status;
+ -- SELECT @US3_LAST_ERRNO AS status;
END$$
@@ -262,7 +259,7 @@
SET @US3_LAST_ERRNO = @OK;
SET @US3_LAST_ERROR = '';
-SELECT COUNT(*)
+ SELECT COUNT(*)
INTO count_records
FROM autoflow
WHERE runID = p_runID AND status = 'LIVE_UPDATE';
1
0
r2741 - in trunk: programs/us_com_project programs/us_convert programs/us_experiment programs/us_xpn_viewer sql utils
by svn@svn.aucsolutions.com April 27, 2019
by svn@svn.aucsolutions.com April 27, 2019
April 27, 2019
Author: alexey
Date: 2019-04-27 09:50:16 +0000 (Sat, 27 Apr 2019)
New Revision: 2741
Added:
trunk/sql/us3_autoflow_procs.sql
Modified:
trunk/programs/us_com_project/us_com_project_gui.cpp
trunk/programs/us_com_project/us_com_project_gui.h
trunk/programs/us_convert/us_convert_gui.cpp
trunk/programs/us_convert/us_convert_gui.h
trunk/programs/us_convert/us_experiment.cpp
trunk/programs/us_convert/us_experiment.h
trunk/programs/us_experiment/us_experiment_gui_optima.cpp
trunk/programs/us_experiment/us_experiment_gui_optima.h
trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
trunk/sql/us3.sql
trunk/utils/us_db2.h
trunk/utils/us_protocol_util.cpp
trunk/utils/us_protocol_util.h
Log:
First hit on job reattachement for us_Comproject/data_aqcuisition
Limited test and appl. to uslims3_CCH
Modified: trunk/programs/us_com_project/us_com_project_gui.cpp
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.cpp 2019-04-25 14:13:07 UTC (rev 2740)
+++ trunk/programs/us_com_project/us_com_project_gui.cpp 2019-04-27 09:50:16 UTC (rev 2741)
@@ -13,6 +13,7 @@
#include "us_crypto.h"
#include "us_select_item.h"
#include "us_images.h"
+#include "us_select_item.h"
#if QT_VERSION < 0x050000
#define setSamples(a,b,c) setData(a,b,c)
@@ -142,8 +143,8 @@
connect( epanExp, SIGNAL( switch_to_live_update( QMap < QString, QString > &) ), this, SLOT( switch_to_live_update( QMap < QString, QString > & ) ) );
connect( this , SIGNAL( pass_to_live_update( QMap < QString, QString > &) ), epanObserv, SLOT( process_protocol_details( QMap < QString, QString > & ) ) );
- connect( epanObserv, SIGNAL( switch_to_post_processing( QString &, QString &) ), this, SLOT( switch_to_post_processing( QString &, QString & ) ) );
- connect( this, SIGNAL( import_data_us_convert( QString &, QString & ) ), epanPostProd, SLOT( import_data_us_convert( QString &, QString & ) ) );
+ connect( epanObserv, SIGNAL( switch_to_post_processing( QString &, QString &, QString &) ), this, SLOT( switch_to_post_processing( QString &, QString &, QString &) ) );
+ connect( this, SIGNAL( import_data_us_convert( QString &, QString &, QString & ) ), epanPostProd, SLOT( import_data_us_convert( QString &, QString &, QString & ) ) );
connect( epanObserv, SIGNAL( switch_to_experiment( QString &) ), this, SLOT( switch_to_experiment( QString & ) ) );
connect( this, SIGNAL( clear_experiment( QString & ) ), epanExp, SLOT( clear_experiment( QString & ) ) );
@@ -156,7 +157,7 @@
adjustSize();
/* Check for current stage & redirect to specific tab */
- //check_current_stage();
+ check_current_stage();
}
@@ -272,8 +273,8 @@
connect( epanExp, SIGNAL( switch_to_live_update( QMap < QString, QString > &) ), this, SLOT( switch_to_live_update( QMap < QString, QString > & ) ) );
connect( this , SIGNAL( pass_to_live_update( QMap < QString, QString > &) ), epanObserv, SLOT( process_protocol_details( QMap < QString, QString > & ) ) );
- connect( epanObserv, SIGNAL( switch_to_post_processing( QString &, QString &) ), this, SLOT( switch_to_post_processing( QString &, QString & ) ) );
- connect( this, SIGNAL( import_data_us_convert( QString &, QString & ) ), epanPostProd, SLOT( import_data_us_convert( QString &, QString & ) ) );
+ connect( epanObserv, SIGNAL( switch_to_post_processing( QString &, QString &, QString & ) ), this, SLOT( switch_to_post_processing( QString &, QString &, QString & )));
+ connect( this, SIGNAL( import_data_us_convert( QString &, QString &, QString & ) ), epanPostProd, SLOT( import_data_us_convert( QString &, QString &, QString & ) ) );
connect( epanObserv, SIGNAL( switch_to_experiment( QString &) ), this, SLOT( switch_to_experiment( QString & ) ) );
connect( this, SIGNAL( clear_experiment( QString & ) ), epanExp, SLOT( clear_experiment( QString & ) ) );
@@ -284,11 +285,12 @@
adjustSize();
/* Check for current stage & redirect to specific tab */
- //check_current_stage();
-
+ check_current_stage();
+
+ //connect( epanExp, SIGNAL( check_stage() ), this, SLOT( check_current_stage() ) );
+ //emit check_stage();
}
-
// Function that checks for current program stage based on US-lims DB entry
void US_ComProjectMain::check_current_stage( void )
{
@@ -298,46 +300,247 @@
// (3) Identify currDir where .auc data have been saved (unique name based on protocolName + runID)
// * this maybe an 'autoflow' table field recorded after stage 1 (Live Update); DEFAULT empty
- /*
- QString currDir = QString("");
+ /*
+
+ 1. Query 'autoflow' table - proc. 'count_autoflow_records()':
+ if 0 - return;
+ else
+ sort by OptimaName:
+ list active Optima machines:
+ identify which Optima is running via autoflow, which is free & offer to chose - either monitor existing run, OR submit new run on free machine
+ When to consider Optima "free" ? (after stage 'LIVE_UPDATE' passed ?)
+
+ 2. If autoflow record exists:
+ proc. 'read_autoflow_record()'
+
+ */
- currDir = curDirr_query.isEmprty() ? curDir : curDirr_query;
+ // // Ling's exp. Optima 1!!!
+ // QMap < QString, QString > protocol_details;
+ // protocol_details[ "experimentId" ] = QString("465");
+ // protocol_details[ "protocolName" ] = QString("CCLing-PZ5077-27k-021519");
+ // protocol_details[ "experimentName" ] = QString("some_name");
+ // protocol_details[ "CellChNumber" ] = QString("2");
+ // protocol_details[ "TripleNumber" ] = QString("2");
+ // protocol_details[ "OptimaName" ] = QString("Optima 1"); // <-- Optima 1
+ // protocol_details[ "duration" ] = QString("27000");
+ // protocol_details[ "invID_passed" ] = QString("34"); //Ling's ID
+ // -------------------------------------------------------------------------------------------
+
+ // // Nemetchek's exp. Optima 2 !!!
+ // QMap < QString, QString > protocol_details;
+ // protocol_details["experimentId"] = QString("287");
+ // protocol_details["protocolName"] = QString("RxRPPARhet-PPRE-MWL_180419");
+ // protocol_details[ "experimentName" ] = QString("some_name");
+ // protocol_details[ "CellChNumber" ] = QString("8");
+ // protocol_details[ "TripleNumber" ] = QString("38");
+ // protocol_details[ "OptimaName" ] = QString("Optima 2"); // <-- Optima 2
+ // protocol_details[ "duration" ] = QString("36000");
+ // protocol_details[ "invID_passed" ] = QString("41"); //Nemetchek's ID
+
+ // QString stage = "LIVE_UPDATE";
+ // QString currDir = "";
+ // QString ProtName = "";
+ // QString invID_passed = protocol_details[ "invID_passed" ];
+
+ // --------------------------------------------------------------------------------------------
+
+
+ // Query 'autoflow': get cout of records
+ int autoflow_records = get_autoflow_records();
+
+ qDebug() << "Autoflow record #: " << autoflow_records;
+
+ if ( autoflow_records < 1 )
+ return;
+
+
+ // Dialog of aexisting autoflow records
+ US_Passwd pw;
+ US_DB2* dbP = new US_DB2( pw.getPasswd() );
+ list_all_autoflow_records( autoflowdata, dbP );
+
+ QString pdtitle( tr( "Select Optima Run to Follow" ) );
+ QStringList hdrs;
+ int prx;
+ hdrs << "ID"
+ << "Run Name"
+ << "Optima"
+ << "Created"
+ << "Started";
+
+ US_SelectItem pdiag( autoflowdata, hdrs, pdtitle, &prx, -2 );
+ QString autoflow_id_selected("");
+
+ if ( pdiag.exec() == QDialog::Accepted )
+ autoflow_id_selected = autoflowdata[ prx ][ 0 ];
+ else
+ return;
+
+
+ // -------------------------------------------------------------------------------------------------
+ // Get detailed info on the autoflow record
QMap < QString, QString > protocol_details;
- protocol_details[ "experimentId" ] = ExpID;
- protocol_details[ "protocolName" ] = ProtName;
- protocol_details[ "CellChNumber" ] = CellChNumber;
- protocol_details[ "TripleNumber" ] = TprileNumber;;
+ int autoflowID = autoflow_id_selected.toInt();
+ protocol_details = read_autoflow_record( autoflowID );
+
+ QString stage = protocol_details[ "status" ];
+ QString currDir = protocol_details[ "dataPath" ];
+ QString invID_passed = protocol_details[ "invID_passed" ];
+ QString ProtName = protocol_details[ "protocolName" ];
+
+
+ if ( stage == "LIVE_UPDATE" )
+ {
+ //do something
+ switch_to_live_update( protocol_details );
+ return;
+ }
- switch ( stageNumber )
+ if ( stage == "EDITING" )
{
- case 0: //Experiment submit
- {
- break;
- }
- case 1: //Live Update / us_xpn_viwer
- {
- //do something
- switch_to_live_update( protocol_details );
- break;
- }
- case 2: //PostProd / us_convert
- {
- //do something
- switch_to_post_processing( currDir, ProtName);
- break;
- }
- //and so on...
- }
- */
+ //do something
+ switch_to_post_processing( currDir, ProtName, invID_passed );
+
+ //ALEXEY: should pass investigator as well: should be saved in 'autoflow'
+ /*
+ switch_to_post_processing( currDir, ProtName, invID_passed );
+ see us_convert:
+ void US_ConvertGui::import_data_auto( QString &currDir, QString &protocolName )
+ {
+ assign investigator HERE passed in (QString &currDir, QString &protocolName, QString &invID_passed) as 3rd parameter; saved in 'autoflow' table
+ ExpData.invID = invID_passed.toInt();
+ ....
+
+ in us_convert: use function read_record_auto( ProtocolName_auto, &xmlstr, NULL, &db );
+ */
+
+ return;
+ }
+ //and so on...
+
+
}
+// Query autoflow for # records
+int US_ComProjectMain::list_all_autoflow_records( QList< QStringList >& autoflowdata, US_DB2* dbP )
+{
+ int nrecs = 0;
+ autoflowdata.clear();
+ QStringList qry;
+ qry << "get_autoflow_desc";
+ dbP->query( qry );
+
+ if ( dbP->lastErrno() != US_DB2::OK )
+ return nrecs;
+
+ while ( dbP->next() )
+ {
+ QStringList autoflowentry;
+ QString id = dbP->value( 0 ).toString();
+ QString runname = dbP->value( 5 ).toString();
+ QString optimaname = dbP->value( 10 ).toString();
+
+ QDateTime time_started = dbP->value( 11 ).toDateTime().toUTC();
+
+ QDateTime time_created = dbP->value( 13 ).toDateTime().toUTC();
+ QDateTime local(QDateTime::currentDateTime());
+
+ autoflowentry << id << runname << optimaname << time_created.toString(); // << time_started.toString(); // << local.toString( Qt::ISODate );
+
+ if ( time_started.toString().isEmpty() )
+ autoflowentry << "not started";
+ else
+ autoflowentry << time_started.toString();
+
+ autoflowdata << autoflowentry;
+ nrecs++;
+ }
+
+ return nrecs;
+}
+
+
+// Query autoflow for # records
+int US_ComProjectMain::get_autoflow_records( void )
+{
+ // Check DB connection
+ US_Passwd pw;
+ QString masterpw = pw.getPasswd();
+ US_DB2* db = new US_DB2( masterpw );
+
+ int record_number = 0;
+
+ if ( db->lastErrno() != US_DB2::OK )
+ {
+ QMessageBox::warning( this, tr( "Connection Problem" ),
+ tr( "Read protocol: Could not connect to database \n" ) + db->lastError() );
+ return record_number;
+ }
+
+ QStringList qry;
+ qry << "count_autoflow_records";
+
+ record_number = db->functionQuery( qry );
+
+ return record_number;
+}
+
+
+// Query autoflow for # records
+QMap< QString, QString> US_ComProjectMain::read_autoflow_record( int autoflowID )
+{
+ // Check DB connection
+ US_Passwd pw;
+ QString masterpw = pw.getPasswd();
+ US_DB2* db = new US_DB2( masterpw );
+
+ QMap <QString, QString> protocol_details;
+
+ if ( db->lastErrno() != US_DB2::OK )
+ {
+ QMessageBox::warning( this, tr( "Connection Problem" ),
+ tr( "Read protocol: Could not connect to database \n" ) + db->lastError() );
+ return protocol_details;
+ }
+
+ QStringList qry;
+ qry << "read_autoflow_record"
+ << QString::number( autoflowID );
+
+ db->query( qry );
+
+ if ( db->lastErrno() == US_DB2::OK ) // Autoflow record exists
+ {
+ while ( db->next() )
+ {
+ protocol_details[ "protocolName" ] = db->value( 0 ).toString();
+ protocol_details[ "CellChNumber" ] = db->value( 1 ).toString();
+ protocol_details[ "TripleNumber" ] = db->value( 2 ).toString();
+ protocol_details[ "duration" ] = db->value( 3 ).toString();
+ protocol_details[ "experimentName" ] = db->value( 4 ).toString();
+ protocol_details[ "experimentId" ] = db->value( 5 ).toString();
+ protocol_details[ "runID" ] = db->value( 6 ).toString();
+ protocol_details[ "status" ] = db->value( 7 ).toString();
+ protocol_details[ "dataPath" ] = db->value( 8 ).toString();
+ protocol_details[ "OptimaName" ] = db->value( 9 ).toString();
+ protocol_details[ "runStarted" ] = db->value( 10 ).toString();
+ protocol_details[ "invID_passed" ] = db->value( 11 ).toString();
+ }
+ }
+
+ return protocol_details;
+}
+
+
+
// Slot to pass submitted to Optima run info to the Live Update tab
void US_ComProjectMain::switch_to_live_update( QMap < QString, QString > & protocol_details)
{
- tabWidget->setCurrentIndex( 1 ); // Maybe lock this panel from now on? i.e. tabWidget->tabBar()-setEnabled(false) ??
+ tabWidget->setCurrentIndex( 1 ); // Maybe lock this panel from now on? i.e. tabWidget->tabBar()-setEnabled(false) ??
// ALEXEY:
// (1) Make a record to 'autoflow' table - stage# = 1;
@@ -347,22 +550,22 @@
}
// Slot to switch from the Live Update to Editing tab
-void US_ComProjectMain::switch_to_post_processing( QString & currDir, QString & protocolName)
+void US_ComProjectMain::switch_to_post_processing( QString & currDir, QString & protocolName, QString & invID_passed )
{
tabWidget->setCurrentIndex( 2 ); // Maybe lock this panel from now on? i.e. tabWidget->tabBar()-setEnabled(false) ??
// ALEXEY: Make a record to 'autoflow' table: stage# = 2;
- emit import_data_us_convert( currDir, protocolName );
+ emit import_data_us_convert( currDir, protocolName, invID_passed );
}
// Slot to switch back from the Live Update to Experiment tab
-void US_ComProjectMain::switch_to_experiment( QString & protocolName)
+void US_ComProjectMain::switch_to_experiment( QString & protocolName )
{
tabWidget->setCurrentIndex( 0 ); // Maybe lock this panel from now on? i.e. tabWidget->tabBar()-setEnabled(false) ??
- // ALEXEY: Make a record to 'autoflow' table: stage# = 2;
-
+ //delete_autoflow_record( runID );
+
emit clear_experiment( protocolName );
}
@@ -454,7 +657,6 @@
// Open US_Experiment without button...
//US_ExperimentMain* sdiag = new US_ExperimentMain;
-
sdiag = new US_ExperimentMain;
sdiag->setParent(this, Qt::Widget);
@@ -480,6 +682,7 @@
sdiag->us_mode_passed();
sdiag->show();
+
}
@@ -633,7 +836,7 @@
connect( this, SIGNAL( to_xpn_viewer( QMap < QString, QString > &) ), sdiag, SLOT( check_for_data ( QMap < QString, QString > & ) ) );
//ALEXEY: devise SLOT saying what to do upon completion of experiment and exporting AUC data to hard drive - Import Experimental Data !!!
- connect( sdiag, SIGNAL( experiment_complete_auto( QString &, QString & ) ), this, SLOT( to_post_processing ( QString &, QString &) ) );
+ connect( sdiag, SIGNAL( experiment_complete_auto( QString &, QString &, QString & ) ), this, SLOT( to_post_processing ( QString &, QString &, QString &) ) );
//ALEXEY: return to 1st panel when exp. aborted & no data saved..
connect( sdiag, SIGNAL( return_to_experiment( QString & ) ), this, SLOT( to_experiment ( QString &) ) );
@@ -692,9 +895,9 @@
emit to_xpn_viewer( protocol_details );
}
-void US_ObservGui::to_post_processing( QString & currDir, QString & protocolName )
+void US_ObservGui::to_post_processing( QString & currDir, QString & protocolName, QString & invID_passed )
{
- emit switch_to_post_processing( currDir, protocolName );
+ emit switch_to_post_processing( currDir, protocolName, invID_passed );
}
void US_ObservGui::to_experiment( QString & protocolName )
@@ -745,7 +948,7 @@
sdiag = new US_ConvertGui("AUTO");
sdiag->setParent(this, Qt::Widget);
- connect( this, SIGNAL( to_post_prod( QString &, QString & ) ), sdiag, SLOT( import_data_auto ( QString &, QString & ) ) );
+ connect( this, SIGNAL( to_post_prod( QString &, QString &, QString & ) ), sdiag, SLOT( import_data_auto ( QString &, QString &, QString & ) ) );
//ALEXEY: switch to Analysis
connect( sdiag, SIGNAL( saving_complete_auto( QString &, QString & ) ), this, SLOT( to_analysis ( QString &, QString &) ) );
@@ -759,9 +962,9 @@
}
-void US_PostProdGui::import_data_us_convert( QString & currDir, QString & protocolName )
+void US_PostProdGui::import_data_us_convert( QString & currDir, QString & protocolName, QString & invID_passed )
{
- emit to_post_prod( currDir, protocolName );
+ emit to_post_prod( currDir, protocolName, invID_passed );
}
void US_PostProdGui::to_analysis( QString & currDir, QString & protocolName )
Modified: trunk/programs/us_com_project/us_com_project_gui.h
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.h 2019-04-25 14:13:07 UTC (rev 2740)
+++ trunk/programs/us_com_project/us_com_project_gui.h 2019-04-27 09:50:16 UTC (rev 2741)
@@ -94,7 +94,7 @@
void switch_to_live_update( QMap < QString, QString > & protocol_details );
void set_auto_mode( void );
void reset_experiment( QString & protocolName);
-
+ void check_stage( void );
};
@@ -117,11 +117,11 @@
private slots:
void process_protocol_details( QMap < QString, QString > & protocol_details );
- void to_post_processing( QString & currDir, QString & protocolName );
+ void to_post_processing( QString & currDir, QString & protocolName, QString & invID_passed );
void to_experiment( QString & protocolName );
signals:
void to_xpn_viewer( QMap < QString, QString > & protocol_details );
- void switch_to_post_processing( QString & currDir, QString & protocolName );
+ void switch_to_post_processing( QString & currDir, QString & protocolName, QString & invID_passed );
void switch_to_experiment( QString & protocolName );
};
@@ -145,11 +145,11 @@
void resizeEvent(QResizeEvent *event) override;
private slots:
- void import_data_us_convert( QString & currDir, QString & protocolName );
+ void import_data_us_convert( QString & currDir, QString & protocolName, QString & invID_passed );
void to_analysis( QString & currDir, QString & protocolName );
signals:
- void to_post_prod( QString & currDir, QString & protocolName );
+ void to_post_prod( QString & currDir, QString & protocolName, QString & invID_passed );
void switch_to_analysis( QString & currDir, QString & protocolName );
};
@@ -222,7 +222,9 @@
QString icon_path;
bool us_mode_bool;
-
+
+ QList< QStringList > autoflowdata;
+
private:
US_ExperGui* epanExp; // US_Exp panel
US_ObservGui* epanObserv; // US_Observ panel
@@ -234,8 +236,10 @@
//int dbg_level; // Debug print flag
int curr_panx; // Current panel index (0-7)
- void check_current_stage( void );
-
+ //void check_current_stage( void );
+ int get_autoflow_records( void );
+ QMap < QString, QString > read_autoflow_record( int );
+ static int list_all_autoflow_records( QList< QStringList >&, US_DB2* );
private slots:
//void reset ( void );
@@ -248,18 +252,18 @@
//void unable_tabs_buttons( void); // Slot to unable Tabs and Buttons when user level is low
//void enable_tabs_buttons( void); // Slot to enable Tabs and Buttons after protocol is loaded
void switch_to_live_update( QMap < QString, QString > & protocol_details );
- void switch_to_post_processing( QString & currDir, QString & protocolName );
+ void switch_to_post_processing( QString & currDir, QString & protocolName, QString & invID_passed );
void switch_to_analysis( QString & currDir, QString & protocolName );
void switch_to_experiment( QString & protocolName );
+ void check_current_stage( void );
signals:
void pass_to_live_update( QMap < QString, QString > & protocol_details );
- void import_data_us_convert( QString & currDir, QString & protocolName );
+ void import_data_us_convert( QString & currDir, QString & protocolName, QString & invID_passed );
void pass_to_analysis( QString & currDir, QString & protocolName );
void clear_experiment( QString & protocolName);
+ //void check_stage( void );
};
-
-
#endif
Modified: trunk/programs/us_convert/us_convert_gui.cpp
===================================================================
--- trunk/programs/us_convert/us_convert_gui.cpp 2019-04-25 14:13:07 UTC (rev 2740)
+++ trunk/programs/us_convert/us_convert_gui.cpp 2019-04-27 09:50:16 UTC (rev 2741)
@@ -1104,9 +1104,20 @@
reimport();
}
-void US_ConvertGui::import_data_auto( QString &currDir, QString &protocolName )
+void US_ConvertGui::import_data_auto( QString &currDir, QString &protocolName, QString &invID_passed )
{
// ALEXEY TO BE ADDED...
+ /*
+ assign investigator HERE passed in (QString &currDir, QString &protocolName, QString &invID_passed) as 3rd parameter; saved in 'autoflow' table
+
+ ExpData.invID = invID_passed.toInt();
+ */
+
+ //ExpData.invID = 41; // Nemetchek's ID
+ ExpData.invID = invID_passed.toInt();
+
+ qDebug() << "US_CONVERT: ExpData.invID, invID_passed: " << ExpData.invID << ", " << invID_passed;
+
int impType = getImports_auto( currDir );
ProtocolName_auto = protocolName;
@@ -1830,6 +1841,139 @@
pb_saveUS3 ->setEnabled( completed );
}
+
+// copy of :enableSaveBtn for autoflow
+void US_ConvertGui::enableSaveBtn_auto( void )
+{
+ lw_todoinfo->clear();
+ int count = 0;
+ bool completed = true;
+DbgLv(1) << " enabCtl: tLx infsz" << tripListx << out_chaninfo.count();
+ cb_centerpiece->setLogicalIndex( out_chaninfo[ tripListx ].centerpiece );
+
+ if ( allData.size() == 0 )
+ {
+ count++;
+ lw_todoinfo->addItem( QString::number( count )
+ + tr( ": Load or import some AUC data" ) );
+ completed = false;
+ }
+
+ // Do we have any triples?
+ if ( all_tripinfo.size() == 0 )
+ {
+ count++;
+ lw_todoinfo->addItem( QString::number( count )
+ + tr( ": Load or import some AUC data" ) );
+ completed = false;
+ }
+
+ // Is the run info defined?
+ QRegExp rx( "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" );
+
+ // Not checking operator on disk -- defined as "Local"
+ if ( ( ExpData.rotorID == 0 ) ||
+ ( ExpData.calibrationID == 0 ) ||
+ ( ExpData.labID == 0 ) ||
+ ( ExpData.instrumentID == 0 ) ||
+ ( ExpData.label.isEmpty() ) ||
+ ( ! rx.exactMatch( ExpData.project.projectGUID ) ) )
+ {
+ if ( ! referenceDefined )
+ {
+ count++;
+ lw_todoinfo->addItem( QString::number( count )
+ + tr( ": Modify run ID (optional)" ) );
+ }
+ count++;
+ lw_todoinfo->addItem( QString::number( count )
+ + tr( ": Edit run information" ) );
+ completed = false;
+ }
+
+ // Have we filled out all the c/c/w info?
+ // Check GUIDs, because solutionID's may not be present yet.
+ foreach ( US_Convert::TripleInfo tripinfo, out_chaninfo )
+ {
+ if ( ! rx.exactMatch( tripinfo.solution.solutionGUID ) )
+ {
+ count++;
+ lw_todoinfo->addItem( QString::number( count ) +
+ tr( ": Select solution for triple " ) +
+ tripinfo.tripleDesc );
+ completed = false;
+ }
+ }
+
+ foreach ( US_Convert::TripleInfo tripinfo, out_chaninfo )
+ {
+ if ( tripinfo.centerpiece == 0 )
+ {
+ count++;
+ lw_todoinfo->addItem( QString::number( count ) +
+ tr( ": Select centerpiece for triple " ) +
+ tripinfo.tripleDesc );
+ completed = false;
+ }
+ }
+
+ if ( disk_controls->db() )
+ {
+ // Verify connectivity
+ US_Passwd pw;
+ QString masterPW = pw.getPasswd();
+ US_DB2 db( masterPW );
+
+ if ( db.lastErrno() != US_DB2::OK )
+ {
+ count++;
+ lw_todoinfo->addItem( QString::number( count ) +
+ tr( ": Verify database connectivity" ) );
+ completed = false;
+ }
+
+ // Information is there, but we need to see if the runID exists in the
+ // DB. If we didn't load it from there, then we shouldn't be able to sync
+ int recStatus = ExpData.checkRunID_auto( ExpData.invID, &db );
+
+ // if a record is found but saveStatus==BOTH,
+ // then we are editing that record
+ if ( ( recStatus == US_DB2::OK ) && ( saveStatus != BOTH ) ) // ||
+ // ( ! ExpData.syncOK ) )
+ {
+ count++;
+ lw_todoinfo->addItem( QString::number( count ) +
+ tr( ": Select a different runID" ) );
+ completed = false;
+ }
+
+ // Not checking operator on disk -- defined as "Local"
+ if ( ExpData.operatorID == 0 )
+ {
+ count++;
+ lw_todoinfo->addItem( QString::number( count )
+ + tr( ": Select operator in run information" ) );
+ completed = false;
+ }
+
+ }
+
+ // This can go on the todo list, but should not prevent user from saving
+ if ( ( runType == "RI" ) && ( ! referenceDefined ) )
+ {
+ count++;
+ lw_todoinfo->addItem( QString::number( count ) +
+ tr( ": Define reference scans" ) );
+
+ if ( count == 1 )
+ pb_reference->setEnabled( true );
+ }
+
+ // If we made it here, user can save
+ pb_saveUS3 ->setEnabled( completed );
+}
+
+
// Process when the user changes the runID
void US_ConvertGui::runIDChanged( void )
{
@@ -1894,8 +2038,8 @@
QString xmlstr( "" );
- //US_ProtocolUtil::read_record( pname, &xmlstr, NULL, &db );
- US_ProtocolUtil::read_record( ProtocolName_auto, &xmlstr, NULL, &db );
+ //US_ProtocolUtil::read_record( ProtocolName_auto, &xmlstr, NULL, &db );
+ US_ProtocolUtil::read_record_auto( ProtocolName_auto, ExpData.invID, &xmlstr, NULL, &db );
qDebug() << "Protocol READ !!! ";
@@ -2069,9 +2213,11 @@
//Investigator
- ExpData.invID = US_Settings::us_inv_ID(); // just to be sure
+ // ExpData.invID = US_Settings::us_inv_ID(); // just to be sure
ExpData.name = US_Settings::us_inv_name();
+ qDebug() << "Investigator ID: " << ExpData.invID;
+
if ( db.lastErrno() == US_DB2::OK )
{
QStringList q( "get_person_info" );
@@ -2397,7 +2543,7 @@
//le_centerpieceDesc ->setText( QString::number(out_chaninfo[ tripListx ].centerpiece) );
le_centerpieceDesc ->setText( out_chaninfo[ tripListx ].centerpieceName );
- enableSaveBtn();
+ enableSaveBtn_auto();
}
// Function to generate a new guid for experiment, and associate with DB
@@ -2939,8 +3085,9 @@
}
// Check if the run ID already exists in the DB
- int recStatus = ExpData.checkRunID( &db );
-
+ //int recStatus = ExpData.checkRunID( &db );
+ int recStatus = ExpData.checkRunID_auto( ExpData.invID, &db );
+
// if saveStatus == BOTH, then we are editing the record from the database
if ( ( recStatus == US_DB2::OK ) && ( saveStatus != BOTH ) )
{
Modified: trunk/programs/us_convert/us_convert_gui.h
===================================================================
--- trunk/programs/us_convert/us_convert_gui.h 2019-04-25 14:13:07 UTC (rev 2740)
+++ trunk/programs/us_convert/us_convert_gui.h 2019-04-27 09:50:16 UTC (rev 2741)
@@ -247,7 +247,8 @@
void enableRunIDControl( bool );
void enableScanControls( void );
void enableSaveBtn ( void );
-
+ void enableSaveBtn_auto ( void );
+
void getExpInfo ( void );
void readProtocol_auto ( void );
bool readProtocolRotor_auto ( QXmlStreamReader& );
@@ -295,7 +296,7 @@
*/
void assign_investigator( int );
- void import_data_auto (QString &, QString &);
+ void import_data_auto (QString &, QString &, QString &);
void import ( void );
void reimport ( void );
Modified: trunk/programs/us_convert/us_experiment.cpp
===================================================================
--- trunk/programs/us_convert/us_experiment.cpp 2019-04-25 14:13:07 UTC (rev 2740)
+++ trunk/programs/us_convert/us_experiment.cpp 2019-04-27 09:50:16 UTC (rev 2741)
@@ -40,6 +40,24 @@
return US_DB2::OK;
}
+// Copy of checkRunID when invID propagated in autoflow
+int US_Experiment::checkRunID_auto( int invID_passed, US_DB2* db )
+{
+ // Let's see if we can find the run ID
+ expID = 0;
+ QStringList q( "get_experiment_info_by_runID" );
+ q << runID
+ << QString::number( invID_passed );
+ db->query( q );
+ if ( db->lastErrno() == US_DB2::NOROWS )
+ return US_DB2::NOROWS;
+
+ // Ok, let's update the experiment ID
+ db->next();
+ expID = db->value( 1 ).toString().toInt();
+ return US_DB2::OK;
+}
+
int US_Experiment::saveToDB( bool update, US_DB2* db,
QVector< SP_SPEEDPROFILE >& speedsteps )
{
Modified: trunk/programs/us_convert/us_experiment.h
===================================================================
--- trunk/programs/us_convert/us_experiment.h 2019-04-25 14:13:07 UTC (rev 2740)
+++ trunk/programs/us_convert/us_experiment.h 2019-04-27 09:50:16 UTC (rev 2741)
@@ -83,6 +83,7 @@
\param db For database access, an open database connection
*/
int checkRunID( US_DB2* = 0 );
+ int checkRunID_auto( int invID_passed, US_DB2* = 0 );
/*! \brief Function to save the experiment information to db
Modified: trunk/programs/us_experiment/us_experiment_gui_optima.cpp
===================================================================
--- trunk/programs/us_experiment/us_experiment_gui_optima.cpp 2019-04-25 14:13:07 UTC (rev 2740)
+++ trunk/programs/us_experiment/us_experiment_gui_optima.cpp 2019-04-27 09:50:16 UTC (rev 2741)
@@ -5303,6 +5303,7 @@
protocol_details[ "protocolName" ] = currProto->protoname; // pass also to Live Update/PostProd protocol name
protocol_details[ "CellChNumber" ] = QString::number(rpSolut->nschan); // this can be read from protocol in US-lims DB
protocol_details[ "duration" ] = QString::number(Total_duration);
+ protocol_details[ "invID_passed" ] = QString::number(US_Settings::us_inv_ID());
int nwavl_tot = 0;
for ( int kk = 0; kk < rpRange->nranges; kk++ )
@@ -5335,10 +5336,6 @@
}
//submitted = true;
- // Make DB record on what protocol was submitted and what runname it's associated with ...
- // suggested table name is 'protocolExperiment';
- //
-
ck_sub_done->setChecked( true );
if ( !mainw->automode )
@@ -5347,10 +5344,46 @@
QString message_done = tr( "Protocol has been successfully submitted to Optima DB." );
QMessageBox::information( this, mtitle_done, message_done );
}
+
+ //Make 'autoflow' table record:
+ if ( mainw->automode )
+ add_autoflow_record( protocol_details );
emit expdef_submitted( protocol_details );
}
+// Read Protocol details
+void US_ExperGuiUpload::add_autoflow_record( QMap< QString, QString> & protocol_details )
+{
+ // Check DB connection
+ US_Passwd pw;
+ QString masterpw = pw.getPasswd();
+ US_DB2* db = new US_DB2( masterpw );
+
+ if ( db->lastErrno() != US_DB2::OK )
+ {
+ QMessageBox::warning( this, tr( "Connection Problem" ),
+ tr( "Read protocol: Could not connect to database \n" ) + db->lastError() );
+ return;
+ }
+
+ if ( db != NULL )
+ {
+ QStringList qry;
+ qry << "add_autoflow_record"
+ << protocol_details[ "protocolName" ]
+ << protocol_details[ "CellChNumber" ]
+ << protocol_details[ "TripleNumber" ]
+ << protocol_details[ "duration" ]
+ << protocol_details[ "experimentName" ]
+ << protocol_details[ "experimentId" ]
+ << protocol_details[ "OptimaName" ]
+ << protocol_details[ "invID_passed" ];
+
+ db->query( qry );
+ }
+}
+
// Function to build a Json object and document holding experiment controls
QString US_ExperGuiUpload::buildJson( void )
{
Modified: trunk/programs/us_experiment/us_experiment_gui_optima.h
===================================================================
--- trunk/programs/us_experiment/us_experiment_gui_optima.h 2019-04-25 14:13:07 UTC (rev 2740)
+++ trunk/programs/us_experiment/us_experiment_gui_optima.h 2019-04-27 09:50:16 UTC (rev 2741)
@@ -799,7 +799,8 @@
void submitExperiment( void ); // Submit the experiment
void saveRunProtocol ( void ); // Save the Run Protocol
QString buildJson ( void ); // Build the JSON
-
+ void add_autoflow_record( QMap< QString, QString> &protocol_details );
+
signals:
void expdef_submitted( QMap < QString, QString > &protocol_details );
};
Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-04-25 14:13:07 UTC (rev 2740)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-04-27 09:50:16 UTC (rev 2741)
@@ -711,6 +711,19 @@
// protocol_details[ "OptimaName" ] = QString("Optima 1");
// protocol_details[ "duration" ] = QString("27000");
+ //3. Temporary test - Harmen's experiment: ExpID = 286 (ExperimentDefinition, Postgres, Optima 2); ProtocolID = 286 (Us-lims, Mysql);
+ // description = HarmenS_20180417_Purity_Run_6;
+ // 8 cells (16 channels); 29 wvls; 29 triples - for absorbance ONLY!!
+ // QMap < QString, QString > protocol_details;
+ // protocol_details["experimentId"] = QString("286");
+ // protocol_details["protocolName"] = QString("HarmenS_20180417_Purity_Run_6");
+ // protocol_details[ "experimentName" ] = QString("some_name");
+ // protocol_details[ "CellChNumber" ] = QString("16");
+ // protocol_details[ "TripleNumber" ] = QString("29");
+ // protocol_details[ "OptimaName" ] = QString("Optima 2");
+ // protocol_details[ "duration" ] = QString("43200");
+
+
// check_for_data( protocol_details );
// End of test
@@ -1459,6 +1472,9 @@
timer_data_init->stop();
disconnect(timer_data_init, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
msg_data_avail->close();
+
+ //ALEXEY: need to update 'autoflow' table with the unique RunID_to_retrieve && Start Run Time fields !!!
+
//ALEXEY: elapsed timer start
elapsed_timer = new QElapsedTimer;
elapsed_timer->start();
@@ -1494,14 +1510,13 @@
timer_check_sysdata = new QTimer(0); // parent to 0 !
timer_check_sysdata->setInterval(2000);
timer_check_sysdata->moveToThread(sys_thread);
- connect( timer_check_sysdata, SIGNAL(timeout()), this, SLOT( check_for_sysdata( ) ) );
+ connect( timer_check_sysdata, SIGNAL(timeout()), this, SLOT( check_for_sysdata( ) ), Qt::QueuedConnection ) ; //Qt::DirectConnection );
//QThread's started() SIGNAL: before the run()/exec() function is called!!! Is this a potential issue, timer is started from a thread???
connect( sys_thread, SIGNAL( started() ), timer_check_sysdata, SLOT( start() ));
sys_thread->start();
// How to stop sys_thread?
-
-
+
// Check if all triple info is available
timer_all_data_avail = new QTimer;
connect(timer_all_data_avail, SIGNAL(timeout()), this, SLOT( retrieve_xpn_raw_auto ( ) ));
@@ -1518,6 +1533,7 @@
void US_XpnDataViewer::check_for_sysdata( void )
{
qDebug() << "sys_timer IS RUNNING here: ";
+ qDebug() << "sys_timer IS RUNNING here: in_reload_check_sysdata " << in_reload_check_sysdata;
if ( in_reload_check_sysdata ) // If already doing a reload,
return; // skip starting a new one
@@ -1547,10 +1563,12 @@
//RPM speed
double rpm_for_meter = double(rpm/1000.0);
rpm_box->setSpeed(rpm_for_meter);
-
+ qApp->processEvents();
+
//Temperature
temperature_box->setTemp(temperature);
-
+ qApp->processEvents();
+
//Running Time
QList< int > dhms_r;
int running_time = exp_time;// + etimoff; //ALEXEY: OR elapsed_time + etimoff? OR just exp_time ???? //ALEXEY: etimoff < 0 ?
@@ -1561,7 +1579,9 @@
//ALEXEY: hh:mm:ss - OR do we need dd:hh:mm instead ?
running_time_text = QString::number(dhms_r[1]) + ":" + QString::number(dhms_r[2]) + ":" + QString::number(dhms_r[3]);
le_running->setText( running_time_text );
+ qApp->processEvents();
+
//Elapsed Time
QList< int > dhms_e;
int elapsed_time = int( elapsed_timer->elapsed() / 1000 );
@@ -1571,7 +1591,8 @@
//ALEXEY: hh:mm:ss - OR do we need dd:hh:mm instead ?
elapsed_time_text = QString::number(dhms_e[1]) + ":" + QString::number(dhms_e[2]) + ":" + QString::number(dhms_e[3]);
le_elapsed->setText( elapsed_time_text );
-
+ qApp->processEvents();
+
//Remaining Time
QList< int > dhms_remain;
int remaining_time = TotalDuration.toInt() - ( exp_time ); //+ etimoff );
@@ -1580,7 +1601,8 @@
//ALEXEY: hh:mm:ss - OR do we need dd:hh:mm instead ?
remaining_time_text = QString::number(dhms_remain[1]) + ":" + QString::number(dhms_remain[2]) + ":" + QString::number(dhms_remain[3]);
le_remaining->setText( remaining_time_text );
-
+ qApp->processEvents();
+
//RPM/Temp. Plots:
//counter_mins += 500; //temporary for testing only
@@ -1616,36 +1638,61 @@
data_plot_rpm->setAxisScale( QwtPlot::yRight, temp_min, temp_max ); //Y-Temp.
//ALEXEY: no plot rescaling to bounds...
+
+ qDebug() << "SYS_STAT: BEFORE replot(), BEFORE CheExpStat!! ";
+
data_plot_rpm->replot();
+ qApp->processEvents();
+ qDebug() << "SYS_STAT: After replot(), BEFORE CheExpStat!! ";
+
int exp_status = CheckExpComplete_auto( RunID_to_retrieve );
if ( exp_status == 5 )
{
+ timer_check_sysdata->stop();
+ disconnect(timer_check_sysdata, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
+
+ qDebug() << "ExpStat: 5 - sys_timer STOPPED here: ";
+
+ rpm_box->setSpeed( 0 );
+ le_remaining->setText( "00:00:00" );
+
expStatFive();
return;
}
+
if ( exp_status == 2 )
{
+
+ timer_check_sysdata->stop();
+ disconnect(timer_check_sysdata, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
+
+ qDebug() << "ExpStat: 2 - sys_timer STOPPED here: ";
+
+ rpm_box->setSpeed( 0 );
+ le_remaining->setText( "00:00:00" );
+
expStatTwo();
return;
}
+
+ qDebug() << "sys_timer RAN here: ";
+ in_reload_check_sysdata = false;
- in_reload_check_sysdata = false;
-
- qDebug() << "sys_timer RAN here: ";
+ //qDebug() << "sys_timer RAN here: ";
}
// Stop/reset all system panels and pass to stage 3 when exp_Status == 5
void US_XpnDataViewer::expStatFive( void )
{
- timer_check_sysdata->stop();
- disconnect(timer_check_sysdata, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
+ // timer_check_sysdata->stop();
+ // disconnect(timer_check_sysdata, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
- qDebug() << "ExpStat: 5 - sys_timer STOPPED here: ";
+ // qDebug() << "ExpStat: 5 - sys_timer STOPPED here: ";
- rpm_box->setSpeed( 0 );
- le_remaining->setText( "00:00:00" );
+ // rpm_box->setSpeed( 0 );
+ // le_remaining->setText( "00:00:00" );
if ( !timer_all_data_avail->isActive() ) // Check if reload_data Timer is stopped
{
@@ -1658,7 +1705,7 @@
QString message_done = tr( "Experiment was completed. Optima data saved..." );
QMessageBox::information( this, mtitle_complete, message_done );
- emit experiment_complete_auto( currentDir, ProtocolName ); // Updtade later: what should be passed with signal ??
+ emit experiment_complete_auto( currentDir, ProtocolName, invID_passed ); // Updtade later: what should be passed with signal ??
return;
}
@@ -1668,13 +1715,13 @@
// Stop/reset all system panels and pass to stage 3 when exp_Status == 2
void US_XpnDataViewer::expStatTwo( void )
{
- timer_check_sysdata->stop();
- disconnect(timer_check_sysdata, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
+ // timer_check_sysdata->stop();
+ // disconnect(timer_check_sysdata, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
- qDebug() << "ExpStat: 2 - sys_timer STOPPED here: ";
+ // qDebug() << "ExpStat: 2 - sys_timer STOPPED here: ";
- rpm_box->setSpeed( 0 );
- le_remaining->setText( "00:00:00" );
+ // rpm_box->setSpeed( 0 );
+ // le_remaining->setText( "00:00:00" );
if ( !timer_all_data_avail->isActive() ) // Check if reload_data Timer is stopped
{
@@ -1699,7 +1746,7 @@
QString mtitle_complete = tr( "Complete!" );
QString message_done = tr( "Experiment was completed. Optima data saved..." );
QMessageBox::information( this, mtitle_complete, message_done );
- emit experiment_complete_auto( currentDir, ProtocolName ); // Updtade later: what should be passed with signal ??
+ emit experiment_complete_auto( currentDir, ProtocolName, invID_passed ); // Updtade later: what should be passed with signal ??
return;
}
@@ -1750,8 +1797,10 @@
CellChNumber = protocol_details[ "CellChNumber" ];
TripleNumber = protocol_details[ "TripleNumber" ];
OptimaName = protocol_details[ "OptimaName" ]; //New
- TotalDuration = protocol_details[ "duration" ];
+ TotalDuration = protocol_details[ "duration" ];
+ invID_passed = protocol_details[ "invID_passed" ];
+
selectOptimaByName_auto( OptimaName ); //New
timer_data_init = new QTimer;
@@ -3365,7 +3414,9 @@
DbgLv(1) << "RLd: NO CHANGE";
/*** Check Experiement Status: if completed, kill the timer, export the data into AUC format, return, signal to switch panels in US_comproject ***/
- if ( CheckExpComplete_auto( RunID_to_retrieve ) == 5 )
+ int statusExp = CheckExpComplete_auto( RunID_to_retrieve );
+
+ if ( statusExp == 5 )
{
timer_data_reload->stop();
disconnect(timer_data_reload, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
@@ -3380,7 +3431,7 @@
QString message_done = tr( "Experiment was completed. Optima data saved..." );
QMessageBox::information( this, mtitle_complete, message_done );
- emit experiment_complete_auto( currentDir, ProtocolName ); // Updtade later: what should be passed with signal ??
+ emit experiment_complete_auto( currentDir, ProtocolName, invID_passed ); // Updtade later: what should be passed with signal ??
//QString temp_protname("DemchukA_exosomes40K_111418");
//emit experiment_complete_auto( currentDir, temp_protname );
@@ -3389,7 +3440,7 @@
}
/** Experiment Aborted ***/
- if ( CheckExpComplete_auto( RunID_to_retrieve ) == 2 )
+ if ( statusExp == 2 )
{
timer_data_reload->stop();
disconnect(timer_data_reload, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
@@ -3415,7 +3466,7 @@
QString mtitle_complete = tr( "Complete!" );
QString message_done = tr( "Experiment was completed. Optima data saved..." );
QMessageBox::information( this, mtitle_complete, message_done );
- emit experiment_complete_auto( currentDir, ProtocolName ); // Updtade later: what should be passed with signal ??
+ emit experiment_complete_auto( currentDir, ProtocolName, invID_passed ); // Updtade later: what should be passed with signal ??
return;
}
@@ -3459,6 +3510,7 @@
in_reload_auto = false; // Flag no longer in the midst of reload
}
+
// Slot to respond to a timer event (auto-reload)
void US_XpnDataViewer::timerEvent( QTimerEvent *event )
{
Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h 2019-04-25 14:13:07 UTC (rev 2740)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h 2019-04-27 09:50:16 UTC (rev 2741)
@@ -279,6 +279,7 @@
QString TripleNumber;
QString OptimaName; //New
QString TotalDuration; //New
+ QString invID_passed;
void timeToList( int&, QList< int >& );
@@ -341,7 +342,7 @@
void test_optima_connection( void ); //New
signals:
- void experiment_complete_auto( QString &, QString & );
+ void experiment_complete_auto( QString &, QString &, QString & );
void return_to_experiment( QString & );
};
#endif
Modified: trunk/sql/us3.sql
===================================================================
--- trunk/sql/us3.sql 2019-04-25 14:13:07 UTC (rev 2740)
+++ trunk/sql/us3.sql 2019-04-27 09:50:16 UTC (rev 2741)
@@ -80,6 +80,32 @@
ENGINE = InnoDB;
+-----------------------------------------------------
+-- Table autoflow--
+-----------------------------------------------------
+
+DROP TABLE IF EXISTS autoflow;
+
+CREATE TABLE IF NOT EXISTS autoflow (
+ ID int(11) NOT NULL AUTO_INCREMENT ,
+ protName varchar(80) NULL,
+ cellChNum int(10) NULL,
+ tripleNum int(10) NULL,
+ duration int(10) NULL,
+ runName varchar(300) NULL,
+ expID int(10) NULL,
+ runID int(10) NULL,
+ status enum('LIVE_UPDATE','EDITING','ANALYSIS','REPORT') NOT NULL,
+ dataPath varchar(300) NULL,
+ optimaName varchar(300) NULL,
+ runStarted TIMESTAMP NULL,
+ invID INT NULL,
+ created TIMESTAMP NULL,
+ PRIMARY KEY (ID) )
+ENGINE = InnoDB;
+
+
+
-- -----------------------------------------------------
-- Table instrument
-- -----------------------------------------------------
Added: trunk/sql/us3_autoflow_procs.sql
===================================================================
--- trunk/sql/us3_autoflow_procs.sql (rev 0)
+++ trunk/sql/us3_autoflow_procs.sql 2019-04-27 09:50:16 UTC (rev 2741)
@@ -0,0 +1,321 @@
+--
+-- us3_autoflow_procs.sql
+--
+-- Script to set up the MySQL stored procedures for the US3 system
+-- These are related to various tables pertaining to autoflow
+-- Run as root
+--
+
+DELIMITER $$
+
+--
+-- Autoflow procedures
+--
+
+
+-- Returns the count of autoflow records in db
+DROP FUNCTION IF EXISTS count_autoflow_records$$
+CREATE FUNCTION count_autoflow_records ( p_personGUID CHAR(36),
+ p_password VARCHAR(80) )
+
+ RETURNS INT
+ READS SQL DATA
+
+BEGIN
+
+ DECLARE count_records INT;
+
+ CALL config();
+ SET count_records = 0;
+
+
+ IF ( verify_user( p_personGUID, p_password ) = @OK ) THEN
+ SELECT COUNT(*)
+ INTO count_records
+ FROM autoflow;
+
+ END IF;
+
+ RETURN( count_records );
+
+END$$
+
+-- adds autoflow record
+DROP PROCEDURE IF EXISTS add_autoflow_record$$
+CREATE PROCEDURE add_autoflow_record ( p_personGUID CHAR(36),
+ p_password VARCHAR(80),
+ p_protname VARCHAR(80),
+ p_cellchnum INT,
+ p_triplenum INT,
+ p_duration INT,
+ p_runname VARCHAR(80),
+ p_expid INT,
+ p_optimaname VARCHAR(80),
+ p_invID INT )
+
+ MODIFIES SQL DATA
+
+BEGIN
+ CALL config();
+ SET @US3_LAST_ERRNO = @OK;
+ SET @US3_LAST_ERROR = '';
+ SET @LAST_INSERT_ID = 0;
+
+ IF ( verify_user( p_personGUID, p_password ) = @OK ) THEN
+ INSERT INTO autoflow SET
+ protname = p_protname,
+ cellChNum = p_cellchnum,
+ tripleNum = p_triplenum,
+ duration = p_duration,
+ runName = p_runname,
+ expID = p_expid,
+ optimaName = p_optimaname,
+ invID = p_invID,
+ created = NOW();
+
+ SET @LAST_INSERT_ID = LAST_INSERT_ID();
+
+ END IF;
+
+ SELECT @US3_LAST_ERRNO AS status;
+
+END$$
+
+
+-- DELETE autoflow record ( when Optima run aborted manually )
+DROP PROCEDURE IF EXISTS delete_autoflow_record$$
+CREATE PROCEDURE delete_autoflow_record ( p_personGUID CHAR(36),
+ p_password VARCHAR(80),
+ p_runID INT )
+ MODIFIES SQL DATA
+
+BEGIN
+ DECLARE count_records INT;
+
+ CALL config();
+ SET @US3_LAST_ERRNO = @OK;
+ SET @US3_LAST_ERROR = '';
+
+ IF ( verify_user( p_personGUID, p_password ) = @OK ) THEN
+
+ -- Find out if record exists for associated runID
+ SELECT COUNT(*) INTO count_records
+ FROM autoflow
+ WHERE runID = p_runID;
+
+ IF ( count_records = 0 ) THEN
+ SET @US3_LAST_ERRNO = @NO_AUTOFLOW_RECORD;
+ SET @US3_LAST_ERROR = 'Record cannot be deleted as it does not exist for current experiment run';
+
+ ELSE
+ DELETE FROM autoflow
+ WHERE runID = p_runID;
+
+ END IF;
+
+ END IF;
+
+ SELECT @US3_LAST_ERRNO AS status;
+
+END$$
+
+
+
+-- Returns complete information about autoflow record
+DROP PROCEDURE IF EXISTS read_autoflow_record$$
+CREATE PROCEDURE read_autoflow_record ( p_personGUID CHAR(36),
+ p_password VARCHAR(80),
+ p_autoflowID INT )
+ READS SQL DATA
+
+BEGIN
+ DECLARE count_records INT;
+
+ CALL config();
+ SET @US3_LAST_ERRNO = @OK;
+ SET @US3_LAST_ERROR = '';
+
+ SELECT COUNT(*)
+ INTO count_records
+ FROM autoflow
+ WHERE ID = p_autoflowID;
+
+ IF ( verify_user( p_personGUID, p_password ) = @OK ) THEN
+ IF ( count_records = 0 ) THEN
+ SET @US3_LAST_ERRNO = @NO_AUTOFLOW_RECORD;
+ SET @US3_LAST_ERROR = 'MySQL: no rows returned';
+
+ SELECT @US3_LAST_ERRNO AS status;
+
+ ELSE
+ SELECT @OK AS status;
+
+ SELECT protName, cellChNum, tripleNum, duration, runName, expID,
+ runID, status, dataPath, optimaName, runStarted, invID, created
+ FROM autoflow
+ WHERE ID = p_autoflowID;
+
+ END IF;
+
+ ELSE
+ SELECT @US3_LAST_ERRNO AS status;
+
+ END IF;
+
+END$$
+
+
+-- Returns information about autoflow records for listing
+DROP PROCEDURE IF EXISTS get_autoflow_desc$$
+CREATE PROCEDURE get_autoflow_desc ( p_personGUID CHAR(36),
+ p_password VARCHAR(80) )
+
+ READS SQL DATA
+
+BEGIN
+ DECLARE count_records INT;
+
+ CALL config();
+ SET @US3_LAST_ERRNO = @OK;
+ SET @US3_LAST_ERROR = '';
+
+ SELECT COUNT(*)
+ INTO count_records
+ FROM autoflow;
+
+
+ IF ( verify_user( p_personGUID, p_password ) = @OK ) THEN
+ IF ( count_records = 0 ) THEN
+ SET @US3_LAST_ERRNO = @NO_AUTOFLOW_RECORD;
+ SET @US3_LAST_ERROR = 'MySQL: no rows returned';
+
+ SELECT @US3_LAST_ERRNO AS status;
+
+ ELSE
+ SELECT @OK AS status;
+
+ SELECT ID, protName, cellChNum, tripleNum, duration, runName, expID,
+ runID, status, dataPath, optimaName, runStarted, invID, created
+ FROM autoflow;
+
+ END IF;
+
+ ELSE
+ SELECT @US3_LAST_ERRNO AS status;
+
+ END IF;
+
+END$$
+
+
+-- Update autoflow record with Optima's RunID
+DROP PROCEDURE IF EXISTS update_autoflow_runid_starttime$$
+CREATE PROCEDURE update_autoflow_runid_starttime ( p_personGUID CHAR(36),
+ p_password VARCHAR(80),
+ p_expID INT,
+ p_runid INT )
+ MODIFIES SQL DATA
+
+BEGIN
+ DECLARE count_records INT;
+
+ CALL config();
+ SET @US3_LAST_ERRNO = @OK;
+ SET @US3_LAST_ERROR = '';
+
+SELECT COUNT(*)
+ INTO count_records
+ FROM autoflow
+ WHERE expID = p_expID;
+
+ IF ( verify_user( p_personGUID, p_password ) = @OK ) THEN
+ IF ( count_records = 0 ) THEN
+ SET @US3_LAST_ERRNO = @NO_AUTOFLOW_RECORD;
+ SET @US3_LAST_ERROR = 'MySQL: no rows returned';
+
+ ELSE
+ UPDATE autoflow
+ SET runID = p_runid, runStarted = NOW()
+ WHERE expID = p_expID;
+
+ END IF;
+
+ END IF;
+
+ SELECT @US3_LAST_ERRNO AS status;
+
+END$$
+
+
+-- Update autoflow record with next stage && curDir at LIVE_UPDATE
+DROP PROCEDURE IF EXISTS update_autoflow_at_live_update$$
+CREATE PROCEDURE update_autoflow_at_live_update ( p_personGUID CHAR(36),
+ p_password VARCHAR(80),
+ p_runID INT,
+ p_curDir VARCHAR(80) )
+ MODIFIES SQL DATA
+
+BEGIN
+ DECLARE count_records INT;
+
+ CALL config();
+ SET @US3_LAST_ERRNO = @OK;
+ SET @US3_LAST_ERROR = '';
+
+SELECT COUNT(*)
+ INTO count_records
+ FROM autoflow
+ WHERE runID = p_runID AND status = 'LIVE_UPDATE';
+
+ IF ( verify_user( p_personGUID, p_password ) = @OK ) THEN
+ IF ( count_records = 0 ) THEN
+ SET @US3_LAST_ERRNO = @NO_AUTOFLOW_RECORD;
+ SET @US3_LAST_ERROR = 'MySQL: no rows returned';
+
+ ELSE
+ UPDATE autoflow
+ SET dataPath = p_curDir, status = 'EDITING'
+ WHERE runID = p_runID AND status = 'LIVE_UPDATE';
+
+ END IF;
+
+ END IF;
+
+ SELECT @US3_LAST_ERRNO AS status;
+
+END$$
+
+
+---- get initial elapsed time upon reattachment -----------------------------
+DROP FUNCTION IF EXISTS read_autoflow_times$$
+CREATE FUNCTION read_autoflow_times ( p_personGUID CHAR(36),
+ p_password VARCHAR(80),
+ p_runID INT )
+
+ RETURNS INT
+ READS SQL DATA
+
+BEGIN
+ DECLARE count_records INT;
+ DECLARE l_sec_difference INT;
+
+ SET l_sec_difference = 0;
+
+ CALL config();
+ SET @US3_LAST_ERRNO = @OK;
+ SET @US3_LAST_ERROR = '';
+
+ SELECT COUNT(*)
+ INTO count_records
+ FROM autoflow
+ WHERE runID = p_runID;
+
+ SELECT TIMESTAMPDIFF( SECOND, runStarted, NOW() )
+ INTO l_sec_difference
+ FROM autoflow WHERE runID = p_runID;
+
+
+ RETURN( l_sec_difference );
+
+END$$
+
Modified: trunk/utils/us_db2.h
===================================================================
--- trunk/utils/us_db2.h 2019-04-25 14:13:07 UTC (rev 2740)
+++ trunk/utils/us_db2.h 2019-04-27 09:50:16 UTC (rev 2741)
@@ -92,7 +92,8 @@
NO_REPORT_DOCUMENT = 522, //!< No report document with the specified ID exists
INSTRUMENT_IN_USE = 553,
- PROTOCOL_IN_USE = 554,
+ PROTOCOL_IN_USE = 554,
+ NO_AUTOFLOW_RECORD = 555,
UNKNOWN_ERR = 999 //!< No project with the specified ID exists
};
Modified: trunk/utils/us_protocol_util.cpp
===================================================================
--- trunk/utils/us_protocol_util.cpp 2019-04-25 14:13:07 UTC (rev 2740)
+++ trunk/utils/us_protocol_util.cpp 2019-04-27 09:50:16 UTC (rev 2741)
@@ -398,6 +398,113 @@
return idprot;
}
+// Copy of the read_record for autoflow when inv_ID is propagated
+int US_ProtocolUtil::read_record_auto( const QString protname, int invID_passed, QString* xml,
+ QStringList* protentry, US_DB2* dbP )
+{
+ int idprot = -1;
+
+ if ( xml != NULL )
+ xml ->clear();
+ if ( protentry != NULL )
+ protentry->clear();
+
+ if ( dbP != NULL )
+ { // Find the record in the database with a matching name
+ QStringList qry;
+ qry << "get_protocol_desc" << QString::number( invID_passed );
+ dbP->query( qry );
+
+ if ( dbP->lastErrno() != US_DB2::OK )
+ return idprot; // Error exit: unable to read DB record
+
+ while ( dbP->next() )
+ {
+ QString pname = dbP->value( 2 ).toString();
+
+ if ( pname == protname )
+ { // Name match: store information and break out
+ QString pdbid = dbP->value( 0 ).toString();
+ QString pguid = dbP->value( 1 ).toString();
+ QDateTime date = dbP->value( 5 ).toDateTime().toUTC();
+ QString pdate = US_Util::toUTCDatetimeText( date
+ .toString( Qt::ISODate ), true )
+ .section( " ", 0, 0 ).simplified();
+
+ // Return entry, xml, and protocol ID
+ if ( protentry != NULL )
+ *protentry << pname << pdate << pdbid << pguid;
+ if ( xml != NULL )
+ *xml = dbP->value( 3 ).toString();
+
+ idprot = pdbid.toInt();
+ break;
+ }
+ } // END: db records
+ } // END: from database
+
+ else
+ { // Find the record in a local file with a matching name
+ QString datdir = US_Settings::dataDir() + "/projects/";
+ datdir.replace( "\\", "/" ); // Possible Windows fix
+ QStringList rfilt( "R*.xml" ); // "~/ultrascan/data/projects/R*.xml"
+ QStringList pfiles = QDir( datdir ).entryList(
+ rfilt, QDir::Files, QDir::Name );
+ int nfiles = pfiles.count();
+
+ for ( int ii = 0; ii < nfiles; ii++ )
+ { // Examine each "R000*.xml" file in the directory
+ QString pname;
+ QString pguid;
+ QString pfname = pfiles[ ii ];
+ QString pfpath = datdir + pfname;
+ QFile pfile( pfpath );
+ // Skip if there is a file-open problem
+ if ( ! pfile.open( QIODevice::ReadOnly ) ) continue;
+
+ // Capture the XML as a string and start XML reader
+ QTextStream tsi( &pfile );
+ QString xmlstr = tsi.readAll();
+ pfile.close();
+ QXmlStreamReader xmli( xmlstr );
+
+ while( ! xmli.atEnd() )
+ { // Parse XML for description and guid
+ xmli.readNext();
+ QString ename = xmli.name().toString();
+ if ( xmli.isStartElement() && ename == "protocol" )
+ {
+ QXmlStreamAttributes attr = xmli.attributes();
+ pname = attr.value( "description" ).toString();
+ pguid = attr.value( "guid" ).toString();
+ break;
+ }
+ }
+
+ if ( pname == protname )
+ { // Name match: store information and break out
+ QString fdate = US_Util::toUTCDatetimeText(
+ QFileInfo( pfpath ).lastModified().toUTC()
+ .toString( Qt::ISODate ), true )
+ .section( " ", 0, 0 ).simplified();
+
+ // Return entry, xml, and protocol ID (filename numeric)
+ if ( protentry != NULL )
+ *protentry << pname << fdate << pfname << pguid;
+ if ( xml != NULL )
+ *xml = xmlstr;
+
+ idprot = QString( pfname ).section( ".", 0, 0 ).mid( 1 ).toInt();
+ break;
+ }
+ } // END: file loop
+ } // END: local disk
+
+ return idprot;
+}
+
+
+
// Delete a protocol record from the database or local disk.
//
// This function uses a protocol ID (database record ID or "R*.xml"
Modified: trunk/utils/us_protocol_util.h
===================================================================
--- trunk/utils/us_protocol_util.h 2019-04-25 14:13:07 UTC (rev 2740)
+++ trunk/utils/us_protocol_util.h 2019-04-27 09:50:16 UTC (rev 2741)
@@ -66,6 +66,10 @@
static int read_record( const QString protname, QString* xml,
QStringList*, US_DB2* );
+ static int read_record_auto( const QString protname,
+ int invID_passed, QString* xml,
+ QStringList*, US_DB2* );
+
//! \brief Delete a protocol record from the database or local disk.
//!
//! This function uses a protocol DB ID (or GUID if local disk)
1
0
Author: gegorbet
Date: 2019-04-25 14:13:07 +0000 (Thu, 25 Apr 2019)
New Revision: 2740
Modified:
trunk/utils/us_astfem_rsa.cpp
Log:
further bottom-handling fix for cases of no bottom value in the edited data
Modified: trunk/utils/us_astfem_rsa.cpp
===================================================================
--- trunk/utils/us_astfem_rsa.cpp 2019-04-24 19:57:07 UTC (rev 2739)
+++ trunk/utils/us_astfem_rsa.cpp 2019-04-25 14:13:07 UTC (rev 2740)
@@ -146,10 +146,10 @@
af_params.omega_s = sq( s0speed * M_PI / 30.0 ); // omega_square
af_params.start_om2t = af_params.omega_s; // Starting omega square t
af_params.start_time = 0.0; // Starting time
-#if 0
+#if 1
adjust_limits( af_params.cdset_speed ); // Does rotor stretch
#endif
-#if 1
+#if 0
af_params.current_meniscus = simparams.meniscus; // Meniscus from simparams structure
af_params.current_bottom = simparams.bottom; // Bottom from simparams structure
#endif
@@ -501,7 +501,7 @@
omeg2 = w2t_end[ speed_step ];
DbgLv(1)<< "RSA:2-calc: meniscus bottom" << af_params.current_meniscus << af_params.current_bottom;
-#if 0
+#if 1
adjust_limits( sp->rotorspeed ); // Does rotor stretch
#endif
DbgLv(1)<< "RSA:3-calc: meniscus bottom" << af_params.current_meniscus << af_params.current_bottom;
@@ -867,7 +867,7 @@
ed = &af_data;
step_speed = (double)sp->rotorspeed;
-#if 0
+#if 1
adjust_limits( sp->rotorspeed );
#endif
@@ -957,7 +957,7 @@
// Time left to be simulated after accelaration zone
duration = time2 - current_time;
-#if 0
+#if 1
adjust_limits( sp->rotorspeed ); // Does rotor stretch
#endif
@@ -1231,8 +1231,17 @@
// Add current stretch to meniscus at rest
af_params.current_meniscus += stretch_value;
+#if 0
// Add current stretch to bottom at rest
af_params.current_bottom = simparams.bottom_position + stretch_value;
+#endif
+#if 1
+ // Either use current bottom or add current stretch to bottom at rest
+ if ( simparams.bottom > simparams.bottom_position )
+ af_params.current_bottom = simparams.bottom;
+ else
+ af_params.current_bottom = simparams.bottom_position + stretch_value;
+#endif
}
// Calculates stretch for rotor coefficients array and rpm
1
0
r2739 - in trunk: programs/us_fematch programs/us_mpi_analysis utils
by svn@svn.aucsolutions.com April 24, 2019
by svn@svn.aucsolutions.com April 24, 2019
April 24, 2019
Author: gegorbet
Date: 2019-04-24 19:57:07 +0000 (Wed, 24 Apr 2019)
New Revision: 2739
Modified:
trunk/programs/us_fematch/us_fematch.cpp
trunk/programs/us_mpi_analysis/2dsa_master.cpp
trunk/programs/us_mpi_analysis/2dsa_worker.cpp
trunk/programs/us_mpi_analysis/us_mpi_analysis.cpp
trunk/programs/us_mpi_analysis/us_mpi_analysis.h
trunk/utils/us_astfem_rsa.cpp
Log:
mods to backend mpi_analysis to do fit-bottom and fit-meniscus+bottom
Modified: trunk/programs/us_fematch/us_fematch.cpp
===================================================================
--- trunk/programs/us_fematch/us_fematch.cpp 2019-04-24 06:11:54 UTC (rev 2738)
+++ trunk/programs/us_fematch/us_fematch.cpp 2019-04-24 19:57:07 UTC (rev 2739)
@@ -2087,7 +2087,8 @@
simparams.radial_resolution = (double)( radhi - radlo ) / ( nconc - 1 );
// simparams.bottom = simparams.bottom_position;
DbgLv(1) << "SimMdl: simpoints" << simparams.simpoints
- << "rreso" << simparams.radial_resolution;
+ << "rreso" << simparams.radial_resolution
+ << "bottom_sim" << simparams.bottom << "bottom_dat" << edata->bottom;
//simparams.meniscus = 5.8;
//sdata.scanData.resize( total_scans );
Modified: trunk/programs/us_mpi_analysis/2dsa_master.cpp
===================================================================
--- trunk/programs/us_mpi_analysis/2dsa_master.cpp 2019-04-24 06:11:54 UTC (rev 2738)
+++ trunk/programs/us_mpi_analysis/2dsa_master.cpp 2019-04-24 19:57:07 UTC (rev 2739)
@@ -22,12 +22,39 @@
if ( mc_iterations > 1 )
max_iterations = max_iters_all > 1 ? max_iters_all : 5;
+ menibott_ndx = 0;
+ meniscus_run = 0;
+ bottom_run = 0;
+ if ( fit_mb_select == 0 )
+ {
+ menibott_count = 1;
+ meniscus_points = 1;
+ bottom_points = 1;
+ }
+ else if ( fit_menbot )
+ {
+ menibott_count = meniscus_points * bottom_points;
+ }
+ else if ( fit_meni )
+ {
+ menibott_count = meniscus_points;
+ bottom_points = 1;
+ }
+ else if ( fit_bott )
+ {
+ menibott_count = bottom_points;
+ meniscus_points = 1;
+ }
+
while ( true )
{
int worker;
- meniscus_value = meniscus_values.size() == 1 ?
- data_sets[ current_dataset ]->run_data.meniscus :
- meniscus_values[ meniscus_run ];
+ meniscus_value = ( meniscus_points == 1 )
+ ? data_sets[ current_dataset ]->run_data.meniscus
+ : meniscus_values[ meniscus_run ];
+ bottom_value = ( bottom_points == 1 )
+ ? data_sets[ current_dataset ]->run_data.bottom
+ : bottom_values [ bottom_run ];
//if ( max_depth > 1 )
// DbgLv(1) << " master loop-TOP: jq-empty?" << job_queue.isEmpty() << " areReady?" << worker_status.contains(READY)
// << " areWorking?" << worker_status.contains(WORKING);
@@ -64,11 +91,23 @@
progress += "; MonteCarlo: "
+ QString::number( mc_iteration + 1 );
- else if ( meniscus_values.size() > 1 )
+ else if ( fit_menbot )
progress += "; Meniscus: "
- + QString::number( meniscus_value, 'f', 3 )
+ + QString::number( meniscus_value, 'f', 4 )
+ + "; Bottom: "
+ + QString::number( bottom_value, 'f', 4 )
+ + QString().sprintf( " ( m%2d b%2d )",
+ ( meniscus_run + 1 ), ( bottom_run + 1 ) );
+ else if ( fit_meni )
+ progress += "; Meniscus: "
+ + QString::number( meniscus_value, 'f', 4 )
+ tr( " (%1 of %2)" ).arg( meniscus_run + 1 )
- .arg( meniscus_values.size() );
+ .arg( meniscus_points );
+ else if ( fit_bott )
+ progress += "; Bottom: "
+ + QString::number( bottom_value, 'f', 4 )
+ + tr( " (%1 of %2)" ).arg( bottom_run + 1 )
+ .arg( bottom_points );
else
progress += "; RMSD: "
+ QString::number( sqrt( simulation_values.variance ) );
@@ -121,7 +160,7 @@
write_output();
// Fit meniscus
- if ( ( meniscus_run + 1 ) < meniscus_values.size() )
+ if ( ( menibott_ndx + 1 ) < menibott_count )
{
set_meniscus();
}
@@ -178,27 +217,39 @@
DbgLv(1) << " master loop-BOT: cds kds" << current_dataset << count_datasets;
if ( current_dataset < count_datasets )
{
+ menibott_ndx = 0;
meniscus_run = 0;
+ bottom_run = 0;
iterations = 1;
mc_iteration = 0;
- if ( meniscus_points > 1 )
- { // Reset the range of fit-meniscus points for this data set
+ if ( menibott_count > 1 )
+ { // Reset the range of fit-meniscus/bottom points for this data set
US_DataIO::EditedData* edata
= &data_sets[ current_dataset ]->run_data;
- double men_str = edata->meniscus - meniscus_range / 2.0;
- double men_inc = meniscus_range / ( meniscus_points - 1.0 );
double dat_str = edata->radius( 0 );
+ double men_dpt = ( meniscus_points > 1 ) ?
+ (double)( meniscus_points - 1 ) : 1;
+ double bot_dpt = ( bottom_points > 1 ) ?
+ (double)( bottom_points - 1 ) : 1;
+ double men_str = edata->meniscus - ( meniscus_range * 0.5 );
+ double bot_str = edata->bottom - ( bottom_range * 0.5 );
+ double men_inc = meniscus_range / men_dpt;
+ double bot_inc = bottom_range / bot_dpt;
double men_end = men_str + meniscus_range - men_inc;
if ( men_end >= dat_str )
{ // Adjust first meniscus so range remains below data range
- men_end = dat_str - men_inc / 2.0;
+ men_end = dat_str - ( men_inc * 0.5 );
men_str = men_end - meniscus_range + men_inc;
}
for ( int ii = 0; ii < meniscus_points; ii++ )
meniscus_values[ ii ] = men_str + men_inc * ii;
-DbgLv(1) << " master loop-BOT: menpt" << meniscus_points << "mv0 mvn"
+ for ( int ii = 0; ii < bottom_points; ii++ )
+ bottom_values[ ii ] = bot_str + bot_inc * ii;
+DbgLv(0) << " master loop-BOT: menpt" << meniscus_points << "mv0 mvn"
<< meniscus_values[0] << meniscus_values[meniscus_points-1]
+ << "botpt" << bottom_points << "bv0 bvn"
+ << bottom_values[0] << bottom_values[bottom_points-1]
<< "gcores_count" << gcores_count;
}
@@ -267,10 +318,10 @@
{
calculated_solutes.clear();
orig_solutes.clear();
- simulation_values.noisflag = parameters[ "tinoise_option" ].toInt() > 0 ?
- 1 : 0;
- simulation_values.noisflag += parameters[ "rinoise_option" ].toInt() > 0 ?
- 2 : 0;
+ simulation_values.noisflag = ( parameters[ "tinoise_option" ].toInt() > 0 ?
+ 1 : 0 )
+ + ( parameters[ "rinoise_option" ].toInt() > 0 ?
+ 2 : 0 );
simulation_values.dbg_level = dbg_level;
simulation_values.dbg_timing = dbg_timing;
DbgLv(0) << "DEBUG_LEVEL" << simulation_values.dbg_level;
@@ -305,7 +356,6 @@
int nsstep = (int)( s_pts );
int nkstep = (int)( ff0_pts );
- //grid_reps = US_Math2::best_grid_reps( nsstep, nkstep );
DbgLv(0) << "InSol: nss nks" << s_pts << ff0_pts << nsstep << nkstep << "grid_reps" << grid_reps;
US_Solute::init_solutes( s_min, s_max, nsstep,
@@ -535,8 +585,30 @@
// Reset for a fit-meniscus iteration
void US_MPI_Analysis::set_meniscus( void )
{
- meniscus_run++;
+ menibott_ndx++;
+ if ( fit_menbot )
+ {
+ meniscus_run = menibott_ndx / meniscus_points;
+ bottom_run = menibott_ndx % meniscus_points;
+ }
+ else if ( fit_meni )
+ {
+ meniscus_run = menibott_ndx;
+ }
+ else if ( fit_bott )
+ {
+ bottom_run = menibott_ndx;
+ }
+ else
+ {
+DbgLv(0) << "FMB:set_meniscus: HUH????: mb m b:"
+ << fit_menbot << fit_meni << fit_bott;
+ }
+DbgLv(0) << "FMB:set_meniscus: mb_ndx men_run bot_run"
+ << menibott_ndx << meniscus_run << bottom_run << "mb m b mbc"
+ << fit_menbot << fit_meni << fit_bott << menibott_count;
+
// We incremented meniscus_run above. Just rerun from the beginning.
for ( int i = 0; i < orig_solutes.size(); i++ )
{
@@ -823,6 +895,7 @@
job.mpi_job.dataset_offset = current_dataset;
job.mpi_job.dataset_count = datasets_to_process;
job.mpi_job.meniscus_value = meniscus_value;
+ job.mpi_job.bottom_value = bottom_value;
max_experiment_size = min_experiment_size;
QVector< US_Solute > prev_solutes = simulation_values.solutes;
@@ -863,6 +936,7 @@
job.mpi_job.command = MPI_Job::PROCESS;
job.mpi_job.length = job.solutes.size();
job.mpi_job.meniscus_value = meniscus_value;
+ job.mpi_job.bottom_value = bottom_value;
job.mpi_job.solution = mc_iteration;
job.mpi_job.dataset_offset = current_dataset;
job.mpi_job.dataset_count = datasets_to_process;
@@ -1135,9 +1209,12 @@
Sa_Job job;
job.solutes = calculated_solutes[ depth ];
job.mpi_job.depth = next_depth;
- meniscus_value = ( meniscus_values.size() == 1 )
+ meniscus_value = ( meniscus_points == 1 )
? data_sets[ current_dataset ]->run_data.meniscus
: meniscus_values[ meniscus_run ];
+ bottom_value = ( bottom_points == 1 )
+ ? data_sets[ current_dataset ]->run_data.bottom
+ : bottom_values [ bottom_run ];
qSort( job.solutes );
DbgLv(1) << "Mast: queue LAST ns=" << job.solutes.size() << " d=" << depth+1
<< max_depth << " nsvs=" << simulation_values.solutes.size();
Modified: trunk/programs/us_mpi_analysis/2dsa_worker.cpp
===================================================================
--- trunk/programs/us_mpi_analysis/2dsa_worker.cpp 2019-04-24 06:11:54 UTC (rev 2738)
+++ trunk/programs/us_mpi_analysis/2dsa_worker.cpp 2019-04-24 19:57:07 UTC (rev 2739)
@@ -38,13 +38,18 @@
<< "command" << job.command;
meniscus_value = job.meniscus_value;
+ bottom_value = job.bottom_value;
int offset = job.dataset_offset;
int dataset_count = job.dataset_count;
int job_length = job.length;
+ int noisflag = ( parameters[ "tinoise_option" ].toInt() > 0 ? 1 : 0 )
+ + ( parameters[ "rinoise_option" ].toInt() > 0 ? 2 : 0 );
DbgLv(1) << "w:" << my_rank << ": offs cnt" << offset << dataset_count;
data_sets[ offset ]->run_data.meniscus = meniscus_value;
+ data_sets[ offset ]->run_data.bottom = bottom_value;
data_sets[ offset ]->simparams.meniscus = meniscus_value;
+ data_sets[ offset ]->simparams.bottom = bottom_value;
switch( job.command )
{
@@ -52,10 +57,7 @@
case MPI_Job::PROCESS: // Process solutes
{
US_SolveSim::Simulation simulation_values;
- simulation_values.noisflag =
- parameters[ "tinoise_option" ].toInt() > 0 ? 1 : 0;
- simulation_values.noisflag +=
- parameters[ "rinoise_option" ].toInt() > 0 ? 2 : 0;
+ simulation_values.noisflag = noisflag;
simulation_values.dbg_level = dbg_level;
simulation_values.dbg_timing = dbg_timing;
@@ -80,10 +82,11 @@
int nn = simulation_values.solutes.size() - 1;
int mm = nn/2;
DbgLv(1) << "w:" << my_rank << ": offs dscnt" << offset << dataset_count
- << "vbar s20wc bott"
+ << "vbar s20wc cpbott dabott"
<< data_sets[offset]->vbar20
<< data_sets[offset]->s20w_correction
- << data_sets[offset]->centerpiece_bottom;
+ << data_sets[offset]->centerpiece_bottom
+ << data_sets[offset]->run_data.bottom;
DbgLv(1) << "w:" << my_rank << ": sol0 solm soln"
<< simulation_values.solutes[0].s << simulation_values.solutes[0].k
<< simulation_values.solutes[mm].s << simulation_values.solutes[mm].k
Modified: trunk/programs/us_mpi_analysis/us_mpi_analysis.cpp
===================================================================
--- trunk/programs/us_mpi_analysis/us_mpi_analysis.cpp 2019-04-24 06:11:54 UTC (rev 2738)
+++ trunk/programs/us_mpi_analysis/us_mpi_analysis.cpp 2019-04-24 19:57:07 UTC (rev 2739)
@@ -302,11 +302,53 @@
mc_iterations = parameters[ "mc_iterations" ].toInt();
mc_iterations = qMax( mc_iterations, 1 );
+ // Set Fit-Meniscus/Bottom parameters
+ fit_mb_select = parameters[ "fit_mb_select" ].toInt();
meniscus_range = parameters[ "meniscus_range" ].toDouble();
meniscus_points = parameters[ "meniscus_points" ].toInt();
- meniscus_points = qMax( meniscus_points, 1 );
- meniscus_range = ( meniscus_points > 1 ) ? meniscus_range : 0.0;
+ fit_mb_select = ( meniscus_points > 1 ) ? fit_mb_select : 0;
+ fit_meni = ( ( fit_mb_select & 1 ) != 0 );
+ fit_bott = ( ( fit_mb_select & 2 ) != 0 );
+ fit_menbot = ( fit_meni && fit_bott );
+if (my_rank==0) {
+DbgLv(0) << "FMB: fit_mb_select" << fit_mb_select
+ << " fit_meni _bott _menbot" << fit_meni << fit_bott << fit_menbot; }
+ if ( fit_menbot )
+ { // Meniscus-and-bottom fit iterations will be run
+ bottom_range = meniscus_range;
+ bottom_points = meniscus_points;
+ menibott_count = meniscus_points * bottom_points;
+ }
+
+ else if ( fit_meni )
+ { // Meniscus-only fit iterations will be run
+ bottom_range = 0.0;
+ bottom_points = 1;
+ menibott_count = meniscus_points;
+ }
+
+ else if ( fit_bott )
+ { // Bottom-only fit iterations will be run
+ bottom_range = meniscus_range;
+ bottom_points = meniscus_points;
+ meniscus_range = 0.0;
+ meniscus_points = 1;
+ menibott_count = bottom_points;
+ }
+
+ else
+ { // No meniscus/bottom fit
+ meniscus_range = 0.0;
+ meniscus_points = 1;
+ bottom_range = 0.0;
+ bottom_points = 1;
+ menibott_count = 1;
+ }
+if (my_rank==0) {
+DbgLv(0) << "FMB: meni range points" << meniscus_range << meniscus_points
+ << " bott range points" << bottom_range << bottom_points; }
+
// Do some parameter checking
count_datasets = data_sets.size();
is_global_fit = US_Util::bool_flag( parameters[ "global_fit" ] );
@@ -379,17 +421,20 @@
double meniscus_start = data_sets[ 0 ]->run_data.meniscus
- meniscus_range / 2.0;
- double dm = ( meniscus_points > 1 )
- ? meniscus_range / ( meniscus_points - 1 ): 0.0;
+ double dmen = fit_meni ?
+ ( meniscus_range / ( meniscus_points - 1 ) ) :
+ 0.0;
- for ( int i = 0; i < meniscus_points; i++ )
+ for ( int ii = 0; ii < meniscus_points; ii++ )
{
- meniscus_values[ i ] = meniscus_start + dm * i;
+ meniscus_values[ ii ] = meniscus_start + dmen * ii;
}
// Get lower limit of data and last (largest) meniscus value
double start_range = data_sets[ 0 ]->run_data.radius( 0 );
double last_meniscus = meniscus_values[ meniscus_points - 1 ];
+if (my_rank==0) {
+ DbgLv(0) << "FMB: meniscus: start delta" << meniscus_start << dmen; }
if ( last_meniscus >= start_range )
{
@@ -400,13 +445,30 @@
qDebug() << " meniscus_start" << meniscus_start;
qDebug() << " meniscus_range" << meniscus_range;
qDebug() << " meniscus_points" << meniscus_points;
- qDebug() << " dm" << dm;
+ qDebug() << " meniscus delta" << dmen;
qDebug() << " last_meniscus" << last_meniscus;
qDebug() << " left_data" << start_range;
}
abort( "Meniscus value extends into data" );
}
+ // Calculate bottom values
+ bottom_values.resize( bottom_points );
+
+ double bottom_start = data_sets[ 0 ]->run_data.bottom
+ - bottom_range / 2.0;
+
+ double dbot = fit_bott ?
+ ( bottom_range / ( bottom_points - 1 ) ) :
+ 0.0;
+
+ for ( int ii = 0; ii < bottom_points; ii++ )
+ {
+ bottom_values[ ii ] = bottom_start + dbot * ii;
+ }
+if (my_rank==0) {
+ DbgLv(0) << "FMB: bottom: start delta" << bottom_start << dbot; }
+
population = parameters[ "population" ].toInt();
generations = parameters[ "generations" ].toInt();
crossover = parameters[ "crossover" ].toInt();
@@ -691,6 +753,7 @@
DbgLv(0) << "rank" << my_rank << ": ee" << ee << "tmst_file" << ds->tmst_file
<< "ssp count" << ds->simparams.sim_speed_prof.count();
+#if 0
// If EditedData has a bottom, use that to adjust bottom_position
US_DataIO::EditedData* edata = &ds->run_data;
@@ -713,6 +776,7 @@
<< "adj.bottom_pos" << ds->simparams.bottom_position;
}
}
+#endif
} // END: datasets loop to upload timestate
//DbgLv(0) << "rank" << my_rank << ": simSpeed :TM:" << ELAPSED_SECS;
// }
@@ -890,7 +954,9 @@
parameters[ "p_mutate_sk" ] = "20";
count_calc_residuals = 0; // Internal instrumentation
+ menibott_ndx = 0;
meniscus_run = 0;
+ bottom_run = 0;
mc_iteration = 0;
// Determine masters-group count and related controls
@@ -1424,6 +1490,7 @@
US_SolveSim::Simulation sim = simulation_values;
double save_meniscus = meniscus_value;
+ double save_bottom = bottom_value;
US_Model::AnalysisType mdl_type = model_type( analysis_type );
int mxdssz = -1;
@@ -1494,6 +1561,8 @@
DbgLv(1) << "WrO: meniscus_run" << meniscus_run << "mvsz" << meniscus_values.size();
meniscus_value = meniscus_run < meniscus_values.size()
? meniscus_values[ meniscus_run ] : save_meniscus;
+ bottom_value = bottom_run < bottom_values.size()
+ ? bottom_values[ bottom_run ] : save_bottom;
if ( mdl_type == US_Model::PCSA )
{
@@ -1510,6 +1579,7 @@
DbgLv(1) << "WrO: wr_model mdl_type" << mdl_type;
write_model( sim, mdl_type );
meniscus_value = save_meniscus;
+ bottom_value = save_bottom;
DbgLv(1) << "WrO: wr_noise";
if ( parameters[ "tinoise_option" ].toInt() > 0 )
@@ -1924,9 +1994,12 @@
model.analysis = type;
QString runID = edata->runID;
- if ( meniscus_points > 1 )
+ if ( fit_meni )
model.global = US_Model::MENISCUS;
+ else if ( fit_bott )
+ model.global = US_Model::BOTTOM;
+
else if ( is_global_fit )
{
model.global = US_Model::GLOBAL;
@@ -1937,9 +2010,11 @@
else
model.global = US_Model::NONE;
-DbgLv(1) << "wrMo: is_glob glob_sols" << is_global_fit << glob_sols;
+DbgLv(0) << "wrMo: is_glob glob_sols" << is_global_fit << glob_sols
+ << "f_men f_bot" << fit_meni << fit_bott << "m.glob" << model.global;
model.meniscus = meniscus_value;
+ model.bottom = fit_bott ? bottom_value : 0.0;
model.variance = sim.variance;
// demo1_veloc. 1A999. e201101171200_a201101171400_2DSA us3-0000003 .model
@@ -1962,10 +2037,19 @@
if ( mc_iterations > 1 )
iterID.sprintf( "mc%04d", mc_iter );
- else if ( meniscus_points > 1 )
+ else if ( fit_menbot )
+ iterID.sprintf( "i%02d-m%05db%05d",
+ menibott_ndx + 1,
+ (int)( meniscus_value * 10000 ),
+ (int)( bottom_value * 10000 ) );
+ else if ( fit_meni )
iterID.sprintf( "i%02d-m%05d",
meniscus_run + 1,
- (int)(meniscus_value * 10000 ) );
+ (int)( meniscus_value * 10000 ) );
+ else if ( fit_bott )
+ iterID.sprintf( "i%02d-b%05d",
+ bottom_run + 1,
+ (int)( bottom_value * 10000 ) );
else
iterID = "i01";
@@ -1980,7 +2064,7 @@
double vbar20 = data_sets[ current_dataset ]->vbar20;
model.description = runID + "." + tripleID + "." + analyID + ".model";
-DbgLv(1) << "wrMo: model descr" << model.description;
+DbgLv(0) << "wrMo: model descr" << model.description;
// Save as class variable for later reference
modelGUID = model.modelGUID;
@@ -2054,8 +2138,8 @@
int run = 1;
- if ( meniscus_run > 0 )
- run = meniscus_run + 1;
+ if ( menibott_ndx > 0 )
+ run = menibott_ndx + 1;
else if ( mc_iterations > 0 )
run = mc_iter;
@@ -2065,6 +2149,7 @@
<< ";MC_iteration=" << mc_iter
<< ";variance=" << sim.variance
<< ";run=" << runstring
+ << ";bottom_value=" << bottom_value
<< "\n";
fileo.close();
}
@@ -2118,9 +2203,19 @@
if ( mc_iterations > 1 ) // MonteCarlo iteration
iterID.sprintf( "mc%04d", mc_iteration + 1 );
- else if ( meniscus_points > 1 ) // Fit meniscus
- iterID.sprintf( "i%02d-m%05d", meniscus_run + 1,
- (int)(meniscus_values[ meniscus_run ] * 10000 ) );
+ else if ( fit_menbot ) // Meniscus+Bottom fit
+ iterID.sprintf( "i%02d-m%05db%05d",
+ menibott_ndx + 1,
+ (int)( meniscus_value * 10000 ),
+ (int)( bottom_value * 10000 ) );
+ else if ( fit_meni ) // Meniscus fit
+ iterID.sprintf( "i%02d-m%05d",
+ meniscus_run + 1,
+ (int)( meniscus_value * 10000 ) );
+ else if ( fit_bott ) // Bottom fit
+ iterID.sprintf( "i%02d-b%05d",
+ bottom_run + 1,
+ (int)( bottom_value * 10000 ) );
else // Non-iterative single
iterID = "i01";
@@ -2402,10 +2497,19 @@
if ( mc_iterations > 1 )
iterID.sprintf( "mc%04d", mc_iter );
- else if ( meniscus_points > 1 )
+ else if ( fit_menbot )
+ iterID.sprintf( "i%02d-m%05db%05d",
+ menibott_ndx + 1,
+ (int)( meniscus_value * 10000 ),
+ (int)( bottom_value * 10000 ) );
+ else if ( fit_meni )
iterID.sprintf( "i%02d-m%05d",
meniscus_run + 1,
- (int)(meniscus_value * 10000 ) );
+ (int)( meniscus_value * 10000 ) );
+ else if ( fit_bott )
+ iterID.sprintf( "i%02d-b%05d",
+ bottom_run + 1,
+ (int)( bottom_value * 10000 ) );
else
iterID = "i01";
@@ -2489,8 +2593,8 @@
int run = 1;
- if ( meniscus_run > 0 )
- run = meniscus_run + 1;
+ if ( menibott_ndx > 0 )
+ run = menibott_ndx + 1;
else if ( mc_iterations > 0 )
run = mc_iter;
@@ -2500,6 +2604,7 @@
<< ";MC_iteration=" << mc_iter
<< ";variance=" << sim.variance
<< ";run=" << runstring
+ << ";bottom_value=" << bottom_value
<< "\n";
fileo.close();
}
Modified: trunk/programs/us_mpi_analysis/us_mpi_analysis.h
===================================================================
--- trunk/programs/us_mpi_analysis/us_mpi_analysis.h 2019-04-24 06:11:54 UTC (rev 2738)
+++ trunk/programs/us_mpi_analysis/us_mpi_analysis.h 2019-04-24 19:57:07 UTC (rev 2739)
@@ -95,17 +95,8 @@
QList< int > ds_points;
QVector< double > gl_nnls_a;
QVector< double > gl_nnls_b;
- int max_depth;
- int worknext;
- enum WorkerStatus { INIT, READY, WORKING };
- enum PMGTag { ADATESIZE=1000, ADATE, STARTITER, STARTLAST,
- UDPSIZE, UDPMSG, DONEITER, DONELAST };
-
- int meniscus_points;
- int meniscus_run;
- double meniscus_range; // Only used by master
- double meniscus_value; // Only used by worker
QVector< double > meniscus_values;
+ QVector< double > bottom_values;
QVector< double > concentrations;
QVector< double > maxods;
@@ -113,6 +104,30 @@
QVector< double > sigmas;
QVector< long > work_rss;
+ double meniscus_range; // Only used by master
+ double meniscus_value; // Only used by worker
+ double bottom_range; // Only used by master
+ double bottom_value; // Only used by worker
+
+ int max_depth;
+ int worknext;
+ int fit_mb_select; // Fit meniscus/bottom selection (0-3)
+ int menibott_ndx;
+ int meniscus_run;
+ int bottom_run;
+ int menibott_count;
+ int meniscus_points;
+ int bottom_points;
+ int set_count;
+
+ enum WorkerStatus { INIT, READY, WORKING };
+ enum PMGTag { ADATESIZE=1000, ADATE, STARTITER, STARTLAST,
+ UDPSIZE, UDPMSG, DONEITER, DONELAST };
+
+ bool fit_meni; // Fit-meniscus flag
+ bool fit_bott; // Fit-bottom flag
+ bool fit_menbot; // Fit-meniscus+bottom flag
+
US_DataIO::RawData* res_data; // Populated in calc_residuals
US_DataIO::RawData* sim_data; // Populated in calc_residuals
US_DataIO::RawData sim_data1; // Simulation for mc iteration 1
@@ -142,7 +157,6 @@
QDateTime submitTime;
QDateTime startTime;
- int set_count;
QList< DATASET* > data_sets;
class MPI_Job
@@ -159,6 +173,7 @@
Command command;
int depth;
double meniscus_value;
+ double bottom_value;
int dataset_offset;
int dataset_count;
@@ -169,6 +184,7 @@
command = IDLE;
depth = 0;
meniscus_value = 0.0;
+ bottom_value = 0.0;
dataset_offset = 0;
dataset_count = 1;
};
@@ -294,7 +310,7 @@
public:
int generation; // From worker: -1 = final; From master: 1 = done
int size; // Number of solutes in the following vector or
- // or genes requested for emmigration
+ // or genes requested for emigration
double fitness; // Fitness of best result
};
Modified: trunk/utils/us_astfem_rsa.cpp
===================================================================
--- trunk/utils/us_astfem_rsa.cpp 2019-04-24 06:11:54 UTC (rev 2738)
+++ trunk/utils/us_astfem_rsa.cpp 2019-04-24 19:57:07 UTC (rev 2739)
@@ -957,7 +957,9 @@
// Time left to be simulated after accelaration zone
duration = time2 - current_time;
+#if 0
adjust_limits( sp->rotorspeed ); // Does rotor stretch
+#endif
//duration = time2 - time0;
//delay = time1 - time0;
1
0