Skip to content

Commit

Permalink
fix in cpp runtime for the initialization interation. Calling initial…
Browse files Browse the repository at this point in the history
…izeEquations instead of evaluate

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@18002 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
niklwors committed Nov 4, 2013
1 parent 93de7f7 commit e370734
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions Compiler/Template/CodegenCpp.tpl
Expand Up @@ -2163,7 +2163,7 @@ case SIMCODE(modelInfo = MODELINFO(__)) then
bool getCondition(unsigned int index);
private:
//Methods:
void initEquations();
/*
Expand Down Expand Up @@ -2541,6 +2541,7 @@ case SIMCODE(modelInfo = MODELINFO(__)) then
virtual void setInitial(bool);
/// (Re-) initialize the system of equations and bounded parameters
virtual void initialize();
virtual void initEquations();
// Returns the history object to query simulation results
virtual IHistory* getHistory();
virtual void stepCompleted(double time);
Expand Down Expand Up @@ -6411,11 +6412,11 @@ case SIMCODE(modelInfo = MODELINFO(__)) then
void <%lastIdentOfPath(modelInfo.name)%>::setInitial(bool status)
{
_initial = status;
if(_initial)
if(_initial)
_callType = IContinuous::DISCRETE;
else
_callType = IContinuous::CONTINUOUS;
}
>>
Expand Down
6 changes: 3 additions & 3 deletions SimulationRuntime/cpp/Core/SimController/Initialization.cpp
Expand Up @@ -29,14 +29,14 @@ void Initialization::initializeSystem()
while((restart /*|| cond_restart*/) && !(iter++ > 15))
{
event_system->getConditions(conditions0);
continous_system->evaluate(IContinuous::ALL); // vxworksupdate
_system->initEquations(); // vxworksupdate
restart = event_system->checkForDiscreteEvents();
event_system->getConditions(conditions1);
event_system->saveDiscreteVars();
cond_restart = !std::equal (conditions1, conditions1+dim,conditions0);
}

mixed_system->saveAll();
continous_system->evaluate(IContinuous::ALL); // vxworksupdate
_system->setInitial(false);
_system->setInitial(false);

}
Expand Up @@ -23,6 +23,7 @@ class ISystemInitialization

/// (Re-) initialize the system of equations and bounded parameters
virtual void initialize() = 0;
virtual void initEquations() = 0;
//sets the initial status
virtual void setInitial(bool) = 0;
//returns the intial status
Expand Down

0 comments on commit e370734

Please sign in to comment.