diff --git a/Compiler/BackEnd/BackendDAEUtil.mo b/Compiler/BackEnd/BackendDAEUtil.mo index 87607c66523..cadd1f3d2cf 100644 --- a/Compiler/BackEnd/BackendDAEUtil.mo +++ b/Compiler/BackEnd/BackendDAEUtil.mo @@ -435,7 +435,7 @@ algorithm ((nie2,_)) = BackendEquation.traverseBackendDAEEqns(removedEqs,countInitialEqns,(nie1,whenClauseLst)); dae1 = checkInitialSystem1(unfixed1,nie2,dae,funcs,vars,varsws,states,statesws); then - dae; + dae1; case (dae,_) equation diff --git a/Compiler/susan_codegen/SimCode/SimCodeC.tpl b/Compiler/susan_codegen/SimCode/SimCodeC.tpl index e7e70f499c4..e9b0fc3da0c 100644 --- a/Compiler/susan_codegen/SimCode/SimCodeC.tpl +++ b/Compiler/susan_codegen/SimCode/SimCodeC.tpl @@ -800,6 +800,7 @@ template functionInitializeDataStruc() } returnData->initFixed = init_fixed; + returnData->var_attr = var_attr; returnData->modelName = model_name; returnData->modelFilePrefix = model_fileprefix; returnData->statesNames = state_names; @@ -1130,7 +1131,7 @@ template functionInitialResidual(list residualEquations) let expPart = daeExp(exp, contextOther, &preExp /*BUFC*/, &varDecls /*BUFD*/) '<%preExp%>localData->initialResiduals[i++] = <%expPart%>; -if (sim_verbose >=LOG_INIT) { printf(" Residual[%d] : <%ExpressionDump.printExpStr(exp)%> = %f\n",i,localData->initialResiduals[i-1]); }' +if (sim_verbose == LOG_RES_INIT) { printf(" Residual[%d] : <%ExpressionDump.printExpStr(exp)%> = %f\n",i,localData->initialResiduals[i-1]); }' ;separator="\n") << int initial_residual() diff --git a/c_runtime/simulation_init.cpp b/c_runtime/simulation_init.cpp index 829173b5c41..6457c783cf5 100644 --- a/c_runtime/simulation_init.cpp +++ b/c_runtime/simulation_init.cpp @@ -30,6 +30,7 @@ #include "simulation_init.h" #include "simulation_runtime.h" +#include "solver_main.h" #include /* @@ -42,26 +43,18 @@ void leastSquare(long *nz, double *z, double *funcValue) int startIndPar = 2*globalData->nStates+globalData->nAlgebraic+globalData->intVariables.nAlgebraic+globalData->boolVariables.nAlgebraic; for (ind=0, indAct=0, indz=0; indnStates; ind++) - if (globalData->initFixed[indAct++]==0) + if (globalData->initFixed[indAct++]==0 ) globalData->states[ind] = z[indz++]; // for real parameters - for (ind=0,indAct=startIndPar; indnParameters; ind++) - if (globalData->initFixed[indAct++]==0) + for (ind=0,indAct=startIndPar; indnParameters; ind++, indAct++) + if (globalData->initFixed[indAct]==0 and globalData->var_attr[indAct-globalData->nStates]==1) globalData->parameters[ind] = z[indz++]; bound_parameters(); functionODE(); functionAlgebraics(); -/* for (ind=0,indy=0,indAct=2*globalData->nStates; indnAlgebraic; ind++) - if (globalData->initFixed[indAct++]==1) - globalData->algebraics [ind] = static_y[indy++]; - - Comment from Bernhard: Even though algebraic variables are "fixed", they are calculated from - the states, so they should be allowed to change when states vary, - and NOT be replaced by their initial values as above. -*/ initial_residual(); for (ind=0, *funcValue=0; indnInitialResiduals; ind++) @@ -88,7 +81,7 @@ int reportResidualValue(double funcValue) cout << "residual[" << i << "] = " << globalData->initialResiduals[i] << endl; } } - return 0 /*-1*/; + return 1; } return 0; } @@ -136,7 +129,7 @@ int simplex_initialization(long& nz,double *z) /* Start with stepping .5 in each direction. */ for (ind=0;ind= LOG_INIT ? 100 : -1; //C Set value for stopping criterion. Stopping occurs when the @@ -152,7 +145,7 @@ int simplex_initialization(long& nz,double *z) //C the points of the current simplex < stopcr. STOPCR = 1.e-3; - NLOOP = 2*MAXF;//2*nz; + NLOOP = 2*MAXF; //C Fit a quadratic surface to be sure a minimum has been found. @@ -203,23 +196,15 @@ int simplex_initialization(long& nz,double *z) * residual of all equations (both continuous time eqns and initial eqns). */ -int initialize(const std::string*method) +int initialize(const std::string init_method) { long nz; int ind, indAct, indz; - std::string init_method; - - if (method == NULL) { - // init_method = std::string("newuoa"); - init_method = std::string("simplex"); - } else { - init_method = *method; - } for (ind=0, nz=0; indnStates; ind++){ if (globalData->initFixed[ind]==0){ if (sim_verbose >= LOG_INIT) - printf("Variable %s is unfixed.\n",globalData->statesNames[ind].name); + printf("State %s is unfixed.\n",globalData->statesNames[ind].name); nz++; } @@ -228,9 +213,9 @@ int initialize(const std::string*method) int startIndPar = 2*globalData->nStates+globalData->nAlgebraic+globalData->intVariables.nAlgebraic+globalData->boolVariables.nAlgebraic; int endIndPar = startIndPar+globalData->nParameters; for (ind=startIndPar;indinitFixed[ind]==0){ + if (globalData->initFixed[ind]==0 and globalData->var_attr[ind-globalData->nStates]==1){ if (sim_verbose >= LOG_INIT) - printf("Variable %s is unfixed.\n",globalData->parametersNames[ind-startIndPar].name); + printf("Parameter %s is unfixed.\n",globalData->parametersNames[ind-startIndPar].name); nz++; } } @@ -262,7 +247,7 @@ int initialize(const std::string*method) } // for real parameters for (ind=0,indAct=startIndPar; indnParameters; ind++) { - if (globalData->initFixed[indAct++]==0) + if (globalData->initFixed[indAct++]==0 and globalData->var_attr[indAct-globalData->nStates]==1) z[indz++] = globalData->parameters[ind]; } @@ -280,3 +265,89 @@ int initialize(const std::string*method) return retVal; } +int +main_initialize(const std::string* method) +{ + + std::string init_method; + + if (method == NULL) + { + init_method = std::string("simplex"); + } + else + { + init_method = *method; + } + + saveall(); + initial_function(); + update_DAEsystem(); + if (sim_verbose >= LOG_SOLVER) + { + sim_result->emit(); + } + // do some initial stuff + globalData->init = 1; + initial_function(); + if (sim_verbose >= LOG_SOLVER) + { + sim_result->emit(); + } + //saveall(); + //update_DAEsystem(); + + storeExtrapolationData(); + storeExtrapolationData(); + + if (sim_verbose >= LOG_SOLVER) + { + sim_result->emit(); + } + + //first try with the given method as default simplex and + //then try with the other one + int retVal = 0; + retVal = initialize(init_method); + if (retVal != 0) + { + if (init_method == std::string("simplex")) + { + init_method = std::string("newuoa"); + retVal = initialize(init_method); + } + else if (init_method == std::string("newuoa")) + { + init_method = std::string("simplex"); + retVal = initialize(init_method); + } + if (retVal != 0) + { + printf("Initialization of the current initial set of equations and initial guesses fails!\n"); + printf("Try with better Initial guesses for the states.\n"); + retVal = 1; + } + } + + saveall(); + storeExtrapolationData(); + storeExtrapolationData(); + + if (sim_verbose >= LOG_SOLVER) + { + sim_result->emit(); + } + + update_DAEsystem(); + SaveZeroCrossings(); + saveall(); + if (sim_verbose >= LOG_SOLVER) + { + sim_result->emit(); + } + storeExtrapolationData(); + storeExtrapolationData(); + globalData->init = 0; + return retVal; +} + diff --git a/c_runtime/simulation_init.h b/c_runtime/simulation_init.h index 9615fb30fd2..66bf161dbdd 100644 --- a/c_runtime/simulation_init.h +++ b/c_runtime/simulation_init.h @@ -39,7 +39,7 @@ #ifndef _SIMULATION_INIT_H #define _SIMULATION_INIT_H -int initialize(const std::string*method); +int main_initialize(const std::string*method); #ifndef NEWUOA #define NEWUOA newuoa_ diff --git a/c_runtime/simulation_input.cpp b/c_runtime/simulation_input.cpp index d2336581df5..0cd813521ae 100644 --- a/c_runtime/simulation_input.cpp +++ b/c_runtime/simulation_input.cpp @@ -132,66 +132,66 @@ void read_commented_value(ifstream &f, signed char *str); } for(int i = 0; i < simData->nStates; i++) { // Read x initial values read_commented_value(file,&simData->states[i]); - if (sim_verbose >= LOG_SOLVER) { + if (sim_verbose >= LOG_INIT) { cout << "read " << simData->statesNames[i].name << " = " << simData->states[i] << " from init file." << endl; } } for(int i = 0; i < simData->nStates; i++) { // Read der(x) initial values read_commented_value(file,&simData->statesDerivatives[i]); - if (sim_verbose >= LOG_SOLVER) { + if (sim_verbose >= LOG_INIT) { cout << "read " << simData->stateDerivativesNames[i].name << " = " << simData->statesDerivatives[i] << " from init file." << endl; } } for(int i = 0; i < simData->nAlgebraic; i++) { // Read y initial values read_commented_value(file,&simData->algebraics[i]); - if (sim_verbose >= LOG_SOLVER) { + if (sim_verbose >= LOG_INIT) { cout << "read " << simData->algebraicsNames[i].name << " = " << simData->algebraics[i] << " from init file." << endl; } } for(int i = 0; i < simData->nParameters; i++) { // Read parameter values read_commented_value(file,&simData->parameters[i]); - if (sim_verbose >= LOG_SOLVER) { + if (sim_verbose >= LOG_INIT) { cout << "read " << simData->parametersNames[i].name << " = " << simData->parameters[i] << " from init file." << endl; } } for(int i = 0; i < simData->intVariables.nParameters; i++) { // Read parameter values read_commented_value(file,&simData->intVariables.parameters[i]); - if (sim_verbose >= LOG_SOLVER) { + if (sim_verbose >= LOG_INIT) { cout << "read " << simData->int_param_names[i].name << " = " << simData->intVariables.parameters[i] << " from init file." << endl; } } for(int i = 0; i < simData->intVariables.nAlgebraic; i++) { // Read parameter values read_commented_value(file,&simData->intVariables.algebraics[i]); - if (sim_verbose >= LOG_SOLVER) { + if (sim_verbose >= LOG_INIT) { cout << "read " << simData->int_alg_names[i].name << " = " << simData->intVariables.algebraics[i] << " from init file." << endl; } } for(int i = 0; i < simData->boolVariables.nParameters; i++) { // Read parameter values read_commented_value(file,&simData->boolVariables.parameters[i]); - if (sim_verbose >= LOG_SOLVER) { + if (sim_verbose >= LOG_INIT) { cout << "read " << simData->bool_param_names[i].name << " = " << (bool)simData->boolVariables.parameters[i] << " from init file." << endl; } } for(int i = 0; i < simData->boolVariables.nAlgebraic; i++) { // Read parameter values read_commented_value(file,&simData->boolVariables.algebraics[i]); - if (sim_verbose >= LOG_SOLVER) { + if (sim_verbose >= LOG_INIT) { cout << "read " << simData->bool_alg_names[i].name << " = " << (bool)simData->boolVariables.algebraics[i] << " from init file." << endl; } } for(int i=0; i < simData->stringVariables.nParameters; i++) { // Read string parameter values read_commented_value(file,&(simData->stringVariables.parameters[i])); - if (sim_verbose >= LOG_SOLVER) { + if (sim_verbose >= LOG_INIT) { cout << "read " << simData->string_param_names[i].name << " = \"" << simData->stringVariables.parameters[i] << "\" from init file." << endl; } } for(int i=0; i < simData->stringVariables.nAlgebraic; i++) { // Read string algebraic values read_commented_value(file,&simData->stringVariables.algebraics[i]); - if (sim_verbose >= LOG_SOLVER) { + if (sim_verbose >= LOG_INIT) { cout << "read " << simData->string_alg_names[i].name << " from init file." << endl; } } diff --git a/c_runtime/simulation_runtime.cpp b/c_runtime/simulation_runtime.cpp index 14356a65966..ed270bd0134 100644 --- a/c_runtime/simulation_runtime.cpp +++ b/c_runtime/simulation_runtime.cpp @@ -100,6 +100,7 @@ simulation_result *sim_result; /* Flags for controlling logging to stdout */ const int LOG_STATS = 1; const int LOG_INIT = 2; +const int LOG_RES_INIT = 3; const int LOG_SOLVER = 4; const int LOG_NONLIN_SYS = 8; const int LOG_EVENTS = 16; @@ -232,10 +233,14 @@ verboseLevel(int argc, char**argv) { res |= LOG_STATS; } -if (flags->find("LOG_INIT", 0) != string::npos) + if (flags->find("LOG_INIT", 0) != string::npos) { res |= LOG_INIT; } + if (flags->find("LOG_RES_INIT", 0) != string::npos) + { + res |= LOG_RES_INIT; + } if (flags->find("LOG_SOLVER", 0) != string::npos) { res |= LOG_SOLVER; diff --git a/c_runtime/simulation_runtime.h b/c_runtime/simulation_runtime.h index c65277540a4..df2d537070e 100644 --- a/c_runtime/simulation_runtime.h +++ b/c_runtime/simulation_runtime.h @@ -103,6 +103,7 @@ extern omc_fileInfo TermInfo; /* message for termination. */ /* Flags for controlling logging to stdout */ extern const int LOG_STATS; extern const int LOG_INIT; +extern const int LOG_RES_INIT; extern const int LOG_SOLVER; extern const int LOG_EVENTS; extern const int LOG_NONLIN_SYS; @@ -223,6 +224,7 @@ typedef struct sim_DATA { double* statesBackup; char* initFixed; /* Fixed attribute for all variables and parameters */ + char* var_attr; /* Type attribute for all variables and parameters */ int init; /* =1 during initialization, 0 otherwise. */ void** extObjs; /* External objects */ /* nStatesDerivatives == states */ diff --git a/c_runtime/solver_main.cpp b/c_runtime/solver_main.cpp index d1d950c4d60..a859028aff3 100644 --- a/c_runtime/solver_main.cpp +++ b/c_runtime/solver_main.cpp @@ -133,13 +133,13 @@ JacA_num(double *t, double *y, double *matrixA) int l; for (int i = 0; i < globalData->nStates; i++) { - delta_hh = delta_h*(globalData->states[i]>0?globalData->states[i]:-globalData->states[i]); - delta_hh = ((delta_h > delta_hh)?delta_h:delta_hh); - globalData->states[i] += delta_hh; - functionODE(); - globalData->states[i] -= delta_hh; + delta_hh = delta_h*(globalData->states[i]>0?globalData->states[i]:-globalData->states[i]); + delta_hh = ((delta_h > delta_hh)?delta_h:delta_hh); + globalData->states[i] += delta_hh; + functionODE(); + globalData->states[i] -= delta_hh; - for (int j = 0; j < globalData->nStates; j++) + for (int j = 0; j < globalData->nStates; j++) { l = j + i * globalData->nStates; matrixA[l] = (globalData->statesDerivatives[j] - yprime[j])/delta_hh; @@ -238,6 +238,31 @@ solver_main_step(int flag, double &start, double &stop, bool &reset, int* stats) } } +/* ! Function to update the whole system with EventIteration. + * Evaluate the functionDAE() + */ +void update_DAEsystem(){ + int needToIterate = 0; + int IterationNum = 0; + + functionDAE(&needToIterate); + if (sim_verbose >= LOG_SOLVER) + { + sim_result->emit(); + } + while (checkForDiscreteChanges() || needToIterate) + { + saveall(); + functionDAE(&needToIterate); + IterationNum++; + if (IterationNum > IterationMax) + { + throw TerminateSimulationException(globalData->timeValue, string( + "ERROR: Too many Iteration. System is not consistent!\n")); + } + } +} + /* The main function for a solver with synchronous event handling flag 1=explicit euler 2=rungekutta @@ -256,8 +281,8 @@ solver_main(int argc, char** argv, double &start, double &stop, double &step, int dasslStats[DASSLSTATS]; int dasslStatsTmp[DASSLSTATS]; for(int i=0;ioldTime = start; globalData->timeValue = start; + int needToIterate = 0; + int IterationNum = 0; + if (outputSteps > 0) { // Use outputSteps if set, otherwise use step size. step = (stop - start) / outputSteps; @@ -323,123 +351,57 @@ solver_main(int argc, char** argv, double &start, double &stop, double &step, { cout << "Calculated bound parameters" << endl; } + // Evaluate all constant equations + functionAliasEquations(); // Calculate initial values from initial_function() // saveall() value as pre values if (measure_time_flag) { - rt_accumulate(SIM_TIMER_PREINIT); - rt_tick(SIM_TIMER_INIT); + rt_accumulate(SIM_TIMER_PREINIT); + rt_tick(SIM_TIMER_INIT); } - globalData->init = 1; - initial_function(); - saveall(); - storeExtrapolationData(); - // Calculate initial values from (fixed) start attributes - - int needToIterate = 0; - int IterationNum = 0; - functionDAE(&needToIterate); - functionAliasEquations(); + try{ + if (main_initialize(init_method)) + { + throw TerminateSimulationException(globalData->timeValue, string( + "Error in initialization. Storing results and exiting.\n")); + } - //work-around problem with discrete algorithm vars - // - //functionDAE(needToIterate); - //functionAliasEquations(); - if (sim_verbose >= LOG_SOLVER) - { - sim_result->emit(); - } - try - { - do - { - if (IterationNum > IterationMax) - { - throw TerminateSimulationException(globalData->timeValue, string( - "ERROR: Too many Iteration while the initialization. System is not consistent!\n")); - } - if (initialize(init_method)) - { - throw TerminateSimulationException(globalData->timeValue, string( - "Error in initialization. Storing results and exiting.\n")); - } - saveall(); - functionDAE(&needToIterate); - functionAliasEquations(); - IterationNum++; - } while (checkForDiscreteChanges() || needToIterate); - } - catch (TerminateSimulationException &e) - { - cout << e.getMessage() << endl; - if (modelTermination) - { // terminated from assert, etc. - cout << "Simulation terminated at time " << globalData->timeValue - << endl; - return -1; + SaveZeroCrossings(); + saveall(); + if (sim_verbose >= LOG_SOLVER) + { + sim_result->emit(); } - } - SaveZeroCrossings(); - saveall(); - if (sim_verbose >= LOG_SOLVER) - { - sim_result->emit(); - } - // Calculate stable discrete state - // and initial ZeroCrossings - if (globalData->curSampleTimeIx < globalData->nSampleTimes) - { - sampleEvent_actived = checkForSampleEvent(); - activateSampleEvents(); - } - //Activate sample and evaluate again - needToIterate = 0; - IterationNum = 0; - functionDAE(&needToIterate); - if (sim_verbose >= LOG_SOLVER) - { + //Activate sample and evaluate again + if (globalData->curSampleTimeIx < globalData->nSampleTimes) + { + sampleEvent_actived = checkForSampleEvent(); + activateSampleEvents(); + } + update_DAEsystem(); + SaveZeroCrossings(); + if (sampleEvent_actived) + { + deactivateSampleEventsandEquations(); + sampleEvent_actived = 0; + } + saveall(); sim_result->emit(); - } - try - { - while (checkForDiscreteChanges() || needToIterate) - { - saveall(); - functionDAE(&needToIterate); - IterationNum++; - if (IterationNum > IterationMax) - { - throw TerminateSimulationException(globalData->timeValue, string( - "ERROR: Too many Iteration. System is not consistent!\n")); - } - } + storeExtrapolationData(); + storeExtrapolationData(); } catch (TerminateSimulationException &e) { cout << e.getMessage() << endl; - if (modelTermination) - { // terminated from assert, etc. - cout << "Simulation terminated at time " << globalData->timeValue - << endl; - return -1; - } + printf("Simulation terminated while the initialization. Could not find suitable initial values."); + return -1; } - functionAliasEquations(); - SaveZeroCrossings(); - if (sampleEvent_actived) - { - deactivateSampleEventsandEquations(); - sampleEvent_actived = 0; - } - - saveall(); - sim_result->emit(); // Initialization complete if (measure_time_flag) rt_accumulate( SIM_TIMER_INIT); - globalData->init = 0; if (globalData->timeValue >= stop) { @@ -459,13 +421,13 @@ solver_main(int argc, char** argv, double &start, double &stop, double &step, FILE *fmt = NULL; uint32_t stepNo = 0; if (measure_time_flag) { - const string filename = string(globalData->modelFilePrefix) + "_prof.data"; - fmt = fopen(filename.c_str(), "wb"); - if (!fmt) { - fprintf(stderr, "Warning: Time measurements output file %s could not be opened: %s\n", filename.c_str(), strerror(errno)); - fclose(fmt); - fmt = NULL; - } + const string filename = string(globalData->modelFilePrefix) + "_prof.data"; + fmt = fopen(filename.c_str(), "wb"); + if (!fmt) { + fprintf(stderr, "Warning: Time measurements output file %s could not be opened: %s\n", filename.c_str(), strerror(errno)); + fclose(fmt); + fmt = NULL; + } } try @@ -569,29 +531,29 @@ solver_main(int argc, char** argv, double &start, double &stop, double &step, tmpdbl = rt_accumulated(SIM_TIMER_STEP); flag = flag && 1 == fwrite(&tmpdbl, sizeof(double), 1, fmt); for (int i = 0; i < globalData->nFunctions + globalData->nProfileBlocks; i++) { - tmpint = rt_ncall(i + SIM_TIMER_FIRST_FUNCTION); - flag = flag && 1 == fwrite(&tmpint, sizeof(uint32_t), 1, fmt); + tmpint = rt_ncall(i + SIM_TIMER_FIRST_FUNCTION); + flag = flag && 1 == fwrite(&tmpint, sizeof(uint32_t), 1, fmt); } for (int i = 0; i < globalData->nFunctions + globalData->nProfileBlocks; i++) { - tmpdbl = rt_accumulated(i + SIM_TIMER_FIRST_FUNCTION); - flag = flag && 1 == fwrite(&tmpdbl, sizeof(double), 1, fmt); + tmpdbl = rt_accumulated(i + SIM_TIMER_FIRST_FUNCTION); + flag = flag && 1 == fwrite(&tmpdbl, sizeof(double), 1, fmt); } rt_accumulate(SIM_TIMER_OVERHEAD); if (!flag) { - fprintf(stderr, "Warning: Disabled time measurements because the output file could not be generated: %s\n", strerror(errno)); - fclose(fmt); - fmt = NULL; + fprintf(stderr, "Warning: Disabled time measurements because the output file could not be generated: %s\n", strerror(errno)); + fclose(fmt); + fmt = NULL; } } SaveZeroCrossings(); sim_result->emit(); if (reset == true) - { - // save dassl stats befor reset - for (int i = 0; i < DASSLSTATS; i++) - dasslStats[i] += dasslStatsTmp[i]; - } + { + // save dassl stats befor reset + for (int i = 0; i < DASSLSTATS; i++) + dasslStats[i] += dasslStatsTmp[i]; + } //Check for termination of terminate() or assert() if (terminationAssert || terminationTerminate) { @@ -657,7 +619,7 @@ euler_ex_step(double* step, int (*f)()) { globalData->timeValue += *step; for (int i = 0; i < globalData->nStates; i++) { - globalData->states[i] += globalData->statesDerivatives[i] * (*step); + globalData->states[i] += globalData->statesDerivatives[i] * (*step); } f(); return 0; @@ -872,7 +834,7 @@ dasrt_step(double* step, double &start, double &stop, bool &trigger1, int* tmpSt } catch (TerminateSimulationException &e) { - + cout << e.getMessage() << endl; //free DASSL specific work arrays. return 1; diff --git a/c_runtime/solver_main.h b/c_runtime/solver_main.h index 75818acc58d..6b6807aa878 100644 --- a/c_runtime/solver_main.h +++ b/c_runtime/solver_main.h @@ -73,5 +73,6 @@ extern "C" { int solver_main( int argc, char** argv,double &start, double &stop, double &step, long &outputSteps, double &tolerance, int flag); +void update_DAEsystem(); #endif diff --git a/c_runtime/solver_qss/solver_qss.cpp b/c_runtime/solver_qss/solver_qss.cpp index 282a84a4934..00915eec851 100644 --- a/c_runtime/solver_qss/solver_qss.cpp +++ b/c_runtime/solver_qss/solver_qss.cpp @@ -218,7 +218,7 @@ void init_ompd() throw TerminateSimulationException(globalData->timeValue, string( "ERROR: Too many Iteration while the initialization. System is not consistent!\n")); } - if (initialize(init_method)) + if (main_initialize(init_method)) { throw TerminateSimulationException(globalData->timeValue, string( "Error in initialization. Storing results and exiting.\n"));