本文整理汇总了C++中Tank::findVolume方法的典型用法代码示例。如果您正苦于以下问题:C++ Tank::findVolume方法的具体用法?C++ Tank::findVolume怎么用?C++ Tank::findVolume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tank
的用法示例。
在下文中一共展示了Tank::findVolume方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void QualEngine::init()
{
if (engineState != QualEngine::OPENED) return;
// ... initialize node concentrations & tank volumes
for (Node* node : network->nodes)
{
if ( network->qualModel->type == QualModel::TRACE ) node->quality = 0.0;
else node->quality = node->initQual;
if ( node->type() == Node::TANK )
{
Tank* tank = static_cast<Tank*>(node);
tank->volume = tank->findVolume(tank->initHead);
}
}
// ... initialize reaction model and quality solver
qualSolver->init();
network->qualModel->init(network);
qualStep = network->option(Options::QUAL_STEP);
if ( qualStep <= 0 ) qualStep = 300;
qualTime = 0;
engineState = QualEngine::INITIALIZED;
}
示例2: getTankValue
int getTankValue(int param, Node* node, double* value, Network* nw)
{
double lcf = nw->ucf(Units::LENGTH);
double vcf = lcf * lcf * lcf;
*value = 0.0;
if ( node->type() != Node::TANK ) return 0;
Tank* tank = static_cast<Tank*>(node);
switch (param)
{
case EN_TANKLEVEL:
*value = (tank->head - tank->elev) * lcf;
break;
case EN_INITVOLUME:
*value = tank->findVolume(tank->head) * vcf;
break;
case EN_MIXMODEL:
*value = tank->mixingModel.type;
break;
case EN_MIXZONEVOL:
*value = (tank->mixingModel.fracMixed * tank->maxVolume) * vcf;
break;
case EN_TANKDIAM:
*value = tank->diameter * lcf;
break;
case EN_MINVOLUME:
*value = tank->minVolume * vcf;
break;
case EN_VOLCURVE:
if ( tank->volCurve )
{
string name = tank->volCurve->name;
int index = nw->indexOf(Element::CURVE, name);
*value = index;
if ( index < 0 ) return 205;
}
else *value = -1.0;
break;
case EN_MINLEVEL:
*value = (tank->minHead - tank->elev) * lcf;
break;
case EN_MAXLEVEL:
*value = (tank->maxHead - tank->elev) * lcf;
break;
case EN_MIXFRACTION:
*value = tank->mixingModel.fracMixed;
break;
case EN_TANK_KBULK:
*value = tank->bulkCoeff ;
break;
case EN_TANKVOLUME:
*value = tank->volume * vcf;
break;
default: return 203;
}
return 0;
}