10 setWindowTitle(
"Set Simulation Parameters" );
12 setAttribute ( Qt::WA_DeleteOnClose );
16 QGridLayout*
main =
new QGridLayout(
this );
17 main->setContentsMargins ( 2, 2, 2, 2 );
18 main->setSpacing( 2 );
22 QLabel* lb_info =
us_banner( tr(
"Simulation Run Parameter Setup" ) );
23 main->addWidget( lb_info, row++, 0, 1, 8 );
28 QLabel* lb_speeds =
us_label( tr(
"Number of Speed Profiles:" ) );
29 main->addWidget( lb_speeds, row, 0, 1, 3 );
35 connect(
cnt_speeds, SIGNAL( valueChanged (
double ) ),
47 QString::number( i + 1 ) +
": " +
54 connect(
cmb_speeds, SIGNAL( activated (
int ) ),
58 QLabel* lb_hours =
us_label( tr(
"Length of Experiment (Hours):" ) );
59 main->addWidget( lb_hours, row, 0, 1, 3 );
72 QLabel* lb_mins =
us_label( tr(
"Length of Experiment (Minutes):" ) );
73 main->addWidget( lb_mins, row, 0, 1, 3 );
86 QLabel* lb_delay_hours =
us_label( tr(
"Time Delay for Scans (Hours):" ) );
87 main->addWidget( lb_delay_hours, row, 0, 1, 3 );
100 QLabel* lb_delay_mins =
us_label( tr(
"Time Delay for Scans (Minutes):" ) );
101 main->addWidget( lb_delay_mins, row, 0, 1, 3 );
114 QLabel* lb_rotor =
us_label( tr(
"Rotor Speed (rpm):" ) );
115 main->addWidget( lb_rotor, row, 0, 1, 3 );
131 QLabel* lb_rotorAccel =
us_label( tr(
"Simulate Rotor Acceleration:" ) );
132 main->addWidget( lb_rotorAccel, row, 0, 1, 3 );
137 main->addLayout( acceleration_flag, row++, 3, 1, 1 );
143 QLabel* lb_accelProfile =
us_label( tr(
"Acceleration Profile (rpm/sec):" ));
144 main->addWidget( lb_accelProfile, row, 0, 1, 3 );
159 QLabel* lb_scans =
us_label( tr(
"Scans to be saved:" ) );
160 main->addWidget( lb_scans, row, 0, 1, 3 );
164 cnt_scans->setIncSteps( QwtCounter::Button1, 1 );
165 cnt_scans->setIncSteps( QwtCounter::Button2, 10 );
166 cnt_scans->setIncSteps( QwtCounter::Button3, 100 );
168 main->addWidget(
cnt_scans, row++, 3, 1, 1 );
169 connect(
cnt_scans, SIGNAL( valueChanged(
double ) ),
173 QLabel* lb_speedProfile =
us_label( tr(
"Select a Speed Profile:" ) );
174 main->addWidget( lb_speedProfile, row, 0, 1, 3 );
192 main->addLayout( rb1, row, 4, 1, 2 );
194 QGridLayout* rb2 =
us_radiobutton( tr(
"Band-forming Centerpiece" ),
197 main->addLayout( rb2, row++, 6, 1, 2 );
203 QLabel* lb_lamella =
us_label( tr(
"Band loading volume (" )
204 + QString( QChar( 181 ) ) +
"l):" );
205 main->addWidget( lb_lamella, row, 4, 1, 3 );
209 cnt_lamella->setIncSteps( QwtCounter::Button1, 1 );
210 cnt_lamella->setIncSteps( QwtCounter::Button2, 10 );
214 connect(
cnt_lamella, SIGNAL( valueChanged (
double ) ),
218 QLabel* lb_meniscus =
us_label( tr(
"Meniscus Position (cm):" ) );
219 main->addWidget( lb_meniscus, row, 4, 1, 3 );
229 connect(
cnt_meniscus, SIGNAL( valueChanged (
double ) ),
233 QLabel* lb_bottom =
us_label( tr(
"Bottom of Cell Position (cm):" ) );
234 main->addWidget( lb_bottom, row, 4, 1, 3 );
239 cnt_bottom->setIncSteps( QwtCounter::Button1, 1 );
240 cnt_bottom->setIncSteps( QwtCounter::Button2, 10 );
241 cnt_bottom->setIncSteps( QwtCounter::Button3, 100 );
243 main->addWidget(
cnt_bottom, row++, 7, 1, 1 );
244 connect(
cnt_bottom, SIGNAL( valueChanged (
double ) ),
248 QLabel* lb_simpoints =
us_label( tr(
"Radial Discretization (points):" ) );
249 main->addWidget( lb_simpoints, row, 4, 1, 3 );
260 QLabel* lb_radial_res =
us_label( tr(
"Radial Resolution (cm):" ) );
261 main->addWidget( lb_radial_res, row, 4, 1, 3 );
274 QLabel* lb_rnoise =
us_label( tr(
"Random Noise (% Conc.):" ) );
275 main->addWidget( lb_rnoise, row, 4, 1, 3 );
279 cnt_rnoise->setIncSteps( QwtCounter::Button1, 1 );
280 cnt_rnoise->setIncSteps( QwtCounter::Button2, 10 );
281 cnt_rnoise->setIncSteps( QwtCounter::Button3, 100 );
283 main->addWidget(
cnt_rnoise, row++, 7, 1, 1 );
284 connect(
cnt_rnoise, SIGNAL( valueChanged (
double ) ),
291 QLabel* lb_tinoise =
us_label( tr(
"Time Invariant Noise (% Conc.):" ) );
292 main->addWidget( lb_tinoise, row, 4, 1, 3 );
296 cnt_tinoise->setIncSteps( QwtCounter::Button1, 1 );
297 cnt_tinoise->setIncSteps( QwtCounter::Button2, 10 );
298 cnt_tinoise->setIncSteps( QwtCounter::Button3, 100 );
301 connect(
cnt_tinoise, SIGNAL( valueChanged (
double ) ),
305 QLabel* lb_rinoise =
us_label( tr(
"Radially Invar. Noise (% Conc.):" ) );
306 main->addWidget( lb_rinoise, row, 4, 1, 3 );
310 cnt_rinoise->setIncSteps( QwtCounter::Button1, 1 );
311 cnt_rinoise->setIncSteps( QwtCounter::Button2, 10 );
312 cnt_rinoise->setIncSteps( QwtCounter::Button3, 100 );
315 connect(
cnt_rinoise, SIGNAL( valueChanged (
double ) ),
319 QLabel* lb_temperature =
us_label( tr(
"Temperature (%1):" )
321 main->addWidget( lb_temperature, row, 4, 1, 3 );
336 cmb_mesh->addItem(
"Adaptive Space Time FE Mesh (ASTFEM)" );
337 cmb_mesh->addItem(
"Claverie Fixed Mesh" );
338 cmb_mesh->addItem(
"Moving Hat Mesh" );
339 cmb_mesh->addItem(
"Specified file (mesh.dat)" );
340 cmb_mesh->addItem(
"AST Finite Volume Method (ASTFVM)" );
343 main->addWidget(
cmb_mesh, row++, 4, 1, 4 );
345 connect(
cmb_mesh, SIGNAL( activated (
int ) ),
351 cmb_moving->addItem(
"Constant Time Grid (Claverie/Acceleration)" );
352 cmb_moving->addItem(
"Moving Time Grid (ASTFEM/Moving Hat)" );
354 connect(
cmb_moving, SIGNAL( activated (
int ) ),
357 main->addWidget(
cmb_moving, row++, 4, 1, 4 );
360 QBoxLayout* buttons =
new QHBoxLayout();
362 QPushButton* pb_load =
us_pushbutton( tr(
"Load Profile" ) );
363 connect( pb_load, SIGNAL( clicked() ), SLOT(
load() ) );
364 buttons ->addWidget( pb_load );
366 QPushButton* pb_save =
us_pushbutton( tr(
"Save Profile" ) );
367 connect( pb_save, SIGNAL( clicked() ), SLOT(
save() ) );
368 buttons ->addWidget( pb_save );
371 connect( pb_help, SIGNAL( clicked() ), SLOT(
help() ) );
372 buttons ->addWidget( pb_help );
375 connect( pb_cancel, SIGNAL( clicked() ), SLOT(
revert() ) );
376 buttons ->addWidget( pb_cancel );
379 connect( pb_accept, SIGNAL( clicked() ), SLOT(
accepted() ) );
380 buttons ->addWidget( pb_accept );
382 main->addLayout( buttons, row++, 0, 1, 8 );
463 for (
int i = old_size; i < (int) value; i++ )
499 QString::number( i + 1 ) +
": " +
502 QString::number( spi->
rotorspeed ) +
" rpm" );
505 connect(
cmb_speeds, SIGNAL( activated (
int ) ),
552 QVector< int > hours;
553 QVector< double > minutes;
554 QVector< int > speed;
557 speed .push_back( 0 );
561 for (
int i = 0; i < steps; i++ )
563 hours .push_back( 0 );
564 minutes.push_back( 0.0 );
569 int lower_limit = 1 +
570 ( abs( (speed[ i + 1 ] - speed[ i ] ) ) + 1 ) / ss->
acceleration;
572 hours [ i ] = lower_limit / 3600;
573 int secs = lower_limit - hours[ i ] * 3600;
574 int mins = qRound( (
double)secs / 60.0 );
575 minutes[ i ] = (double)mins;
583 if ( sp->
delay_hours == hours[ current_speed_step] &&
590 if ( sp->
delay_hours < (
int)hours[ current_speed_step ] )
685 sp->
scans = (int)scans;
690 QString fn = QFileDialog::getSaveFileName(
this,
691 tr(
"Save Simulation Parameters in:" ),
693 tr(
"SimParams files (sp_*.xml);;"
694 "All XML files (*.xml);;"
697 if ( fn.isEmpty() )
return;
699 fn = fn.replace(
"\\",
"/" );
700 int jj = fn.lastIndexOf(
"/" ) + 1;
701 QString fdir = fn.left( jj );
702 QString fnam = fn.mid( jj );
706 if ( fn.endsWith(
"." ) )
708 fn = fn.left( fn.length() - 1 );
709 fnam = fnam.left( fnam.length() - 1 );
712 else if ( !fn.endsWith(
".xml" ) )
715 fnam = fnam +
".xml";
718 if ( fnam.startsWith(
"." ) )
720 fn = fdir + fnam.mid( 1 );
723 else if ( !fnam.startsWith(
"sp_" ) )
725 fn = fdir +
"sp_" + fnam;
732 if( QMessageBox::No == QMessageBox::warning(
this,
735 "This file exists already!\n\n"
736 "Do you want to overwrite it?" ),
737 QMessageBox::Yes, QMessageBox::No ) )
745 QMessageBox::information(
this,
746 tr(
"UltraScan Information" ),
747 tr(
"Please note:\n\n"
748 "The Simulation Profile was successfully saved to:\n\n" ) +
753 QMessageBox::information(
this,
754 tr(
"UltraScan Error" ),
755 tr(
"Please note:\n\n"
756 "The Simulation Profile could not be saved to:\n\n" ) +
763 QString fn = QFileDialog::getOpenFileName(
this,
764 tr(
"Load Simulation Parameters from:" ),
766 tr(
"SimParams files (sp_*.xml);;"
767 "All XML files (*.xml);;"
770 if ( fn.isEmpty() )
return;
781 for (
int i = 0; i < steps; i++ )
786 QString::number( i + 1 ) +
": " +
789 QString::number( spi->
rotorspeed ) +
" rpm" );
792 connect(
cmb_speeds, SIGNAL( activated (
int ) ),
831 QMessageBox::information(
this,
832 tr(
"UltraScan Information" ),
833 tr(
"Please note:\n\n"
834 "The Simulation Profile was successfully loaded from:\n\n" ) +
840 QMessageBox::information(
this,
841 tr(
"UltraScan Error" ),
842 tr(
"Please note:\n\n"
843 "Could not read the Simulation Profile:\n\n" ) +
857 QMessageBox::information(
this,
858 tr(
"UltraScan Information" ),
859 tr(
"Please note:\n\n"
860 "The radial mesh file should have\n"
861 "the following format:\n\n"
866 "Radius values smaller than the meniscus or\n"
867 "larger than the bottom of the cell will be\n"
868 "excluded from the concentration vector." ) );
872 if ( meshfile.open( QIODevice::ReadOnly | QIODevice::Text ) )
874 QTextStream ts( &meshfile );
879 while ( ! ts.atEnd() )
925 QMessageBox::warning(
this,
926 tr(
"UltraScan Warning" ),
927 tr(
"Please note:\n\n"
928 "UltraScan could not open the mesh file!\n"
931 "could not be opened." ) );
963 connect(
cnt_speeds, SIGNAL( valueChanged (
double ) ),
965 connect(
cmb_speeds, SIGNAL( activated (
int ) ),
981 connect(
cnt_scans, SIGNAL( valueChanged(
double ) ),
985 connect(
cnt_lamella, SIGNAL( valueChanged (
double ) ),
987 connect(
cnt_meniscus, SIGNAL( valueChanged (
double ) ),
989 connect(
cnt_bottom, SIGNAL( valueChanged (
double ) ),
995 connect(
cnt_rnoise, SIGNAL( valueChanged (
double ) ),
997 connect(
cnt_tinoise, SIGNAL( valueChanged (
double ) ),
999 connect(
cnt_rinoise, SIGNAL( valueChanged (
double ) ),
1001 connect(
cmb_mesh, SIGNAL( activated (
int ) ),
1003 connect(
cmb_moving, SIGNAL( activated (
int ) ),