15 int main(
int argc,
char* argv[] )
17 QApplication application( argc, argv );
25 return application.exec();
32 connect(
astfem_rsa, SIGNAL( new_scan ( QVector< double >*,
double* ) ),
33 SLOT(
check_equil( QVector< double >*,
double* ) ) );
35 connect(
astfem_rsa, SIGNAL( new_time(
double ) ),
38 setWindowTitle( tr(
"Equilibrium Time Prediction" ) );
43 QBoxLayout*
main =
new QHBoxLayout(
this );
44 main->setSpacing ( 2 );
45 main->setContentsMargins ( 2, 2, 2, 2 );
48 QGridLayout* left =
new QGridLayout;
51 QLabel* lb_sample =
us_banner( tr(
"Model Settings" ) );
52 left->addWidget( lb_sample, row++, 0, 1, 2 );
54 QGridLayout* buttons1 =
new QGridLayout;
61 left->addLayout( buttons1, row, 0, 3, 2 );
66 p.setColor( QPalette::WindowText, Qt::white );
67 p.setColor( QPalette::Shadow , Qt::white );
74 QLabel* lb_radius =
us_banner( tr(
"Radius Settings" ) );
75 left->addWidget( lb_radius, row++, 0, 1, 2 );
77 QGroupBox* channelGroupBox =
new QGroupBox( tr(
"Channel Type" ) );
78 channelGroupBox->setContentsMargins ( 2, 2, 2, 2 );
79 channelGroupBox->setPalette( p );
80 channelGroupBox->setFont ( font );
82 QRadioButton* rb_inner;
83 QRadioButton* rb_outer;
84 QRadioButton* rb_center;
85 QRadioButton* rb_custom;
87 QGridLayout* rb5 =
us_radiobutton( tr(
"Inner Channel" ), rb_inner,
true );
88 QGridLayout* rb6 =
us_radiobutton( tr(
"Outer Channel" ), rb_outer );
89 QGridLayout* rb7 =
us_radiobutton( tr(
"Center Channel" ), rb_center );
93 QButtonGroup* channelGroup =
new QButtonGroup;
94 channelGroup->addButton( rb_inner ,
INNER );
95 channelGroup->addButton( rb_outer ,
OUTER );
96 channelGroup->addButton( rb_center,
CENTER );
97 channelGroup->addButton( rb_custom,
CUSTOM );
98 connect( channelGroup, SIGNAL( buttonClicked(
int ) ),
103 QGridLayout* channel =
new QGridLayout;
104 channel->setContentsMargins ( 2, 2, 2, 2 );
105 channel->setSpacing( 0 );
106 channel->addLayout( rb5, 0, 0 );
107 channel->addLayout( rb6, 0, 1 );
108 channel->addLayout( rb7, 1, 0 );
109 channel->addLayout( rb8, 1, 1 );
111 channelGroupBox->setLayout( channel );
113 left->addWidget( channelGroupBox, row, 0, 2, 2 );
117 QLabel* lb_top =
us_label( tr(
"Top Radius:" ) );
118 left->addWidget( lb_top, row, 0 );
123 left->addWidget(
cnt_top, row++, 1 );
126 QLabel* lb_bottom =
us_label( tr(
"Bottom Radius:" ) );
127 left->addWidget( lb_bottom, row, 0 );
135 QLabel* lb_rotor =
us_banner( tr(
"Rotorspeed Settings" ) );
136 left->addWidget( lb_rotor, row++, 0, 1, 2 );
139 QGroupBox* rotor =
new QGroupBox( tr(
"Speed Type" ) );
140 rotor->setContentsMargins ( 2, 10, 2, 2 );
141 rotor->setPalette( p );
142 rotor->setFont ( font );
144 QRadioButton* rb_sigma;
145 QRadioButton* rb_rpm;
158 QButtonGroup* speedGroup =
new QButtonGroup;
159 speedGroup->addButton( rb_sigma,
SIGMA );
160 speedGroup->addButton( rb_rpm ,
RPM );
161 connect( speedGroup, SIGNAL( buttonClicked(
int ) ),
164 QGridLayout* speedType =
new QGridLayout;
165 speedType->setContentsMargins( 2, 2, 2, 2 );
166 speedType->setSpacing ( 0 );
168 speedType->addLayout( rb9, 0, 0 );
169 speedType->addLayout( rb10, 0, 1 );
171 rotor->setLayout( speedType );
173 left->addWidget( rotor, row++, 0, 1, 2 );
182 connect(
cnt_lowspeed, SIGNAL( valueChanged(
double ) ),
195 QLabel* lb_speedsteps =
us_label( tr(
"Speed Steps:" ) );
196 left->addWidget( lb_speedsteps, row, 0 );
204 QLabel* lb_speedlist =
us_label( tr(
"Current Speed List:" ) );
205 left->addWidget( lb_speedlist, row, 0 );
212 left->setRowStretch ( row + 1, 99 );
216 QLabel* lb_sim2 =
us_banner( tr(
"Simulation Settings" ) );
217 left->addWidget( lb_sim2, row++, 0, 1, 2 );
220 QLabel* lb_tolerance =
us_label( tr(
"Tolerance:" ) );
221 left->addWidget( lb_tolerance, row, 0 );
228 QLabel* lb_time =
us_label( tr(
"Time Increment (min):" ) );
229 left->addWidget( lb_time, row, 0 );
235 QGridLayout* buttons2 =
new QGridLayout;
241 buttons2->addWidget(
pb_estimate, b_row++, 0, 1, 2 );
244 connect( pb_help, SIGNAL( clicked() ), SLOT(
help() ) );
245 buttons2->addWidget( pb_help, b_row, 0 );
248 connect( pb_close, SIGNAL( clicked() ), SLOT( close() ) );
249 buttons2->addWidget( pb_close, b_row++, 1 );
251 left->addLayout( buttons2, row, 0, 2, 2 );
253 main->addLayout( left );
257 QBoxLayout* right =
new QVBoxLayout;
260 tr(
"Approach to Equilibrium Simulation" ),
261 tr(
"Radius" ), tr(
"Concentration" ) );
268 right->addLayout( plot );
272 QFontMetrics fm(
te_info->font() );
273 te_info->setFixedHeight( fm.height() * 15 );
276 right->setStretchFactor( plot , 10 );
277 right->setStretchFactor(
te_info, 2 );
279 main->addLayout( right );
291 QMessageBox::warning(
this,
293 tr(
"The low speed value cannot exceed the high speed value" ) );
321 if ( speed < cnt_lowspeed->value() )
325 QMessageBox::warning(
this,
327 tr(
"The high speed value cannot be less than the low speed value" ) );
364 const double inner_top = 5.788;
365 const double inner_bottom = 6.111;
366 const double center_top = 6.290;
367 const double center_bottom = 6.613;
368 const double outer_top = 6.781;
369 const double outer_bottom = 7.104;
375 cnt_top ->setValue( inner_top );
378 inner_top, inner_bottom );
382 cnt_top ->setValue( outer_top );
385 outer_top, outer_bottom );
389 cnt_top ->setValue( center_top );
392 outer_top, center_bottom );
407 double T =
K0 + 20.0;
412 double rpm = 30.0 / M_PI *
413 sqrt( sigma *
R * T * 2 / ( mw * ( 1 - vbar * rho ) ) );
415 rpm = floor( rpm / 100.0 + 0.5 ) * 100.0;
431 double T =
K0 + 20.0;
436 double sigma = mw * ( 1 - vbar * rho ) *
sq( M_PI / 30.0 * rpm ) /
468 lb_lowspeed ->setText( tr(
"Low Speed (sigma):" ) );
479 connect(
cnt_lowspeed, SIGNAL( valueChanged(
double ) ),
495 te_speedlist->append( QString::number( i + 1 ) +
": sigma = " +
503 QString::number( sigma_start,
'f', 3 ) );
526 connect(
cnt_lowspeed, SIGNAL( valueChanged(
double ) ),
542 rpm = floor( rpm / 100.0 + 0.5 ) * 100.0;
544 te_speedlist->append( QString::number( i + 1 ) +
": rpm = " +
545 QString::number( rpm ) );
552 QString::number( rpm_start ) );
562 connect( dialog, SIGNAL( valueChanged(
US_Model ) ),
612 scan.
rvalues.fill( 0.0, radius_points );
636 te_info->
e->append( tr(
"Sigma RPM Time Increment Total Time\n" ) );
654 new QwtPlotCurve(
"Step Number " + QString::number( i ) );
685 results.sprintf(
"%6.4f %5d %6.2f hours %6.2f hours",
692 tr(
"(Note: All speeds have been adjusted to be rounded to "
693 "the nearest 100 RPM.)\n" ) +
694 "______________________________________________________"
695 "_____________________\n" );
725 if ( sqrt( diffs / radius_points ) <
cnt_tolerance->value() )