Skip to content

Commit

Permalink
Extended cpp code generation for Modelica Tables
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10544 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
niklwors committed Nov 18, 2011
1 parent 56f15b7 commit bfecc2a
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 73 deletions.
190 changes: 122 additions & 68 deletions Compiler/susan_codegen/SimCode/SimCodeCpp.tpl

Large diffs are not rendered by default.

Expand Up @@ -300,6 +300,7 @@ void
std::fill( x.data(), x.data() + x.num_elements(), val);
}




/**
Expand Down
Expand Up @@ -31,6 +31,9 @@ tuple<boost::shared_ptr<IGlobalSettings>,boost::shared_ptr<ISolverSettings> > Se
else
throw std::invalid_argument("Selected Solver is not available");

//solver_dll.assign("Idas.dll");
//solver_dll.assign("CVODE.dll");

string settings = _global_settings->getSelectedSolver().append("Settings");
string settings_file ="config//";
settings_file.append(
Expand Down
Expand Up @@ -5,7 +5,7 @@

GlobalSettings::GlobalSettings()
: _startTime (0.0)
, _endTime (1.0)
, _endTime (5.0)
, _hOutput (0.02)
, _resultsOutput (true)
, _infoOutput (true)
Expand Down
4 changes: 3 additions & 1 deletion SimulationRuntime/cpp/Source/SimManager/Configuration.cpp
Expand Up @@ -45,7 +45,9 @@ IDAESolver* Configuration::createSolver(IDAESystem* system)
solver_dll.assign(EULER_LIB);
else
throw std::invalid_argument("Selected Solver is not available");


//solver_dll.assign("Idas.dll");
//solver_dll.assign("CVODE.dll");
if(!load_single_library(types, solver_dll))
throw std::invalid_argument(solver_dll + "library could not be loaded");
std::map<std::string, factory<IDAESolver,IDAESystem*, ISolverSettings*> >::iterator iter;
Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/cpp/Source/SimManager/Main.cpp
Expand Up @@ -45,7 +45,7 @@ int main(int argc, const char* argv[])

// Command for integration: Since integration is done "at once" the solver is only called once. Hence it is both, first and last
// call to the solver at the same time. Furthermore it is supposed to be a regular call (not a recall)
IDAESolver::SOLVERCALL command = IDAESolver::SOLVERCALL(IDAESolver::FIRST_CALL|IDAESolver::LAST_CALL|IDAESolver::REGULAR_CALL);
IDAESolver::SOLVERCALL command = IDAESolver::SOLVERCALL(IDAESolver::FIRST_CALL|IDAESolver::LAST_CALL|IDAESolver::REGULAR_CALL|IDAESolver::RECORDCALL);
// The simulation entity is supposed to set start and end time
solver->setStartTime(global_settings->getStartTime());
solver->setEndTime(global_settings->getEndTime());
Expand Down
Expand Up @@ -21,6 +21,7 @@ Idas::Idas(IDAESystem* system, ISolverSettings* settings)
, _outStps (0)
, _locStps (0)
, _idid (0)
, _tHelp (0.0)
, _hOut (0.0)
, _hZero (0.0)
, _hUpLim (0.0)
Expand Down
Expand Up @@ -4,6 +4,8 @@

IdasSettings::IdasSettings(IGlobalSettings* globalSettings)
: SolverSettings (globalSettings)
,_denseOutput(false)
,_eventOutput(false)

{
};
Expand Down
Expand Up @@ -30,7 +30,11 @@ void SystemDefaultImplementation::Terminate(string msg)
{
throw std::runtime_error(msg);
}
bool SystemDefaultImplementation::initial()
{
return _initial;

}
int SystemDefaultImplementation::getDimVars(const IContinous::INDEX index) const
{
int i=0;
Expand Down
Expand Up @@ -66,10 +66,10 @@ class BOOST_EXTENSION_SYSTEM_DECL SystemDefaultImplementation

// Member variables
//---------------------------------------------------------------

protected:
void Assert(bool cond,string msg);
void Terminate(string msg);

bool initial();
double
time; ///< current simulation time (given by the solver)

Expand All @@ -84,6 +84,7 @@ class BOOST_EXTENSION_SYSTEM_DECL SystemDefaultImplementation
_dimODE1stOrder, ///< Number (dimension) of first order ordinary differential equations
_dimODE2ndOrder, ///< Number (dimension) of second order ordinary differential equations (RHS of a mechanical system)
_dimAE; ///< Number (dimension) of algebraic equations (e.g. constraints from an algebraic loop)
bool _initial;

private:
int
Expand Down

0 comments on commit bfecc2a

Please sign in to comment.