Skip to content

Commit

Permalink
Revert "Shift time at the end/Fix #411"
Browse files Browse the repository at this point in the history
This reverts commit f842bfb.
  • Loading branch information
0u812 committed Oct 11, 2017
1 parent da57f4b commit 17e4fd7
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions source/rrRoadRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1356,8 +1356,8 @@ const DoubleMatrix* RoadRunner::simulate(const Dictionary* dict)

applySimulateOptions();

const double timeEnd = self.simulateOpt.duration;
const double timeStart = 0;
const double timeEnd = self.simulateOpt.duration + self.simulateOpt.start;
const double timeStart = self.simulateOpt.start;

// evalute the model with its current state
self.model->getStateVectorRate(timeStart, 0, 0);
Expand Down Expand Up @@ -1587,12 +1587,6 @@ const DoubleMatrix* RoadRunner::simulate(const Dictionary* dict)

Log(Logger::LOG_DEBUG) << "Simulation done..";

for (int i = 0; i < self.simulationResult.numRows(); i++) {
self.simulationResult[i][getTimeRowIndex()] = self.simulationResult[i][getTimeRowIndex()] + self.simulateOpt.start;
}

Log(Logger::LOG_DEBUG) << "Added delta T.";

return &self.simulationResult;
}

Expand Down Expand Up @@ -4079,9 +4073,10 @@ void RoadRunner::applySimulateOptions()
{
get_self();

if (self.simulateOpt.duration < 0 || self.simulateOpt.steps < 0 )
if (self.simulateOpt.duration < 0 || self.simulateOpt.start < 0
|| self.simulateOpt.steps < 0 )
{
throw std::invalid_argument("duration and steps must be non-negative");
throw std::invalid_argument("duration, startTime and steps must be non-negative");
}

// This one creates the list of what we will look at in the result
Expand Down

0 comments on commit 17e4fd7

Please sign in to comment.