Skip to content

Commit

Permalink
#309 modify end time of simulation to keep the same stabilization time
Browse files Browse the repository at this point in the history
closes #309
  • Loading branch information
rosiereflo authored and gautierbureau committed Jan 17, 2023
1 parent 146a9ec commit fc01b7a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sources/Launcher/DYNComputeLoadVariationLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ ComputeLoadVariationLauncher::launch() {
if (simulation) {
boost::shared_ptr<DYN::ModelMulti> modelMulti = boost::dynamic_pointer_cast<DYN::ModelMulti>(simulation->getModel());
std::vector<boost::shared_ptr<DYN::SubModel> > subModels = modelMulti->findSubModelByLib(DDBDir + "/DYNModelVariationArea" + DYN::sharedLibraryExtension());
double duration = 0;
for (unsigned int i=0; i < subModels.size(); i++) {
double startTime = subModels[i]->findParameterDynamic("startTime").getValue<double>();
double stopTime = subModels[i]->findParameterDynamic("stopTime").getValue<double>();
duration = stopTime - startTime;
int nbLoads = subModels[i]->findParameterDynamic("nbLoads").getValue<int>();
for (int k = 0; k < nbLoads; ++k) {
std::stringstream deltaPName;
Expand All @@ -94,6 +96,7 @@ ComputeLoadVariationLauncher::launch() {
subModels[i]->setParameterValue("stopTime", DYN::PAR, newStopTime, false);
subModels[i]->setSubModelParameters(); // update values stored in subModel
}
simulation->setStopTime(job->getSimulationEntry()->getStopTime() - (100. - variation_)/100. * duration);
simulate(simulation, result);
}
LoadIncreaseResult loadResult;
Expand Down

0 comments on commit fc01b7a

Please sign in to comment.