Changeset 22981
- Timestamp:
- 2014-10-27T15:37:35+01:00 (10 years ago)
- Location:
- trunk/SimulationRuntime/cpp/Include
- Files:
-
- 43 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SimulationRuntime/cpp/Include/Core/HistoryImpl.h
r22024 r22981 12 12 template< template <size_t,size_t,size_t,size_t> class ResultsPolicy,size_t dim_1, size_t dim_2,size_t dim_3,size_t dim_4> 13 13 class HistoryImpl: public IHistory, 14 14 public ResultsPolicy<dim_1,dim_2,dim_3,dim_4> 15 15 { 16 16 public: 17 HistoryImpl(IGlobalSettings& globalSettings) 18 :ResultsPolicy<dim_1,dim_2,dim_3,dim_4>((globalSettings.getEndTime()-globalSettings.getStartTime())/globalSettings.gethOutput(),globalSettings.getOutputPath(),globalSettings.getResultsFileName()) 19 ,_globalSettings(globalSettings) 20 { 21 } 17 22 18 HistoryImpl(IGlobalSettings& globalSettings)19 :ResultsPolicy<dim_1,dim_2,dim_3,dim_4>((globalSettings.getEndTime()-globalSettings.getStartTime())/globalSettings.gethOutput(),globalSettings.getOutputPath(),globalSettings.getResultsFileName()) 20 ,_globalSettings(globalSettings) 21 { 23 void setOutputs(map<unsigned int,string> var_outputs) 24 { 25 _var_outputs=var_outputs; 26 } 22 27 23 } 28 void init() 29 { 30 ResultsPolicy<dim_1,dim_2,dim_3,dim_4>::init(_globalSettings.getOutputPath(), _globalSettings.getResultsFileName()); 31 } 24 32 25 void setOutputs(map<unsigned int,string> var_outputs) 26 { 27 _var_outputs=var_outputs; 33 virtual void getOutputNames(vector<string>& output_names) 34 { 35 boost::copy(_var_outputs | boost::adaptors::map_values, std::back_inserter(output_names)); 36 } 28 37 38 void getSimResults(const double time, ublas::vector<double>& v, ublas::vector<double>& dv) 39 { 40 ResultsPolicy<dim_1,dim_2,dim_3,dim_4>::read(time,v,dv); 41 } 29 42 30 } 31 void init() 32 { 33 ResultsPolicy<dim_1,dim_2,dim_3,dim_4>::init(_globalSettings.getOutputPath(),_globalSettings.getResultsFileName()); 34 } 35 virtual void getOutputNames(vector<string>& output_names) 36 { 43 void getSimResults(ublas::matrix<double>& R, ublas::matrix<double>& dR) 44 { 45 ResultsPolicy<dim_1,dim_2,dim_3,dim_4>::read(R,dR); 46 } 37 47 38 boost::copy(_var_outputs | boost::adaptors::map_values, std::back_inserter(output_names)); 48 void getSimResults(ublas::matrix<double>& R, ublas::matrix<double>& dR, ublas::matrix<double>& Re) 49 { 50 ResultsPolicy<dim_1,dim_2,dim_3,dim_4>::read(R, dR, Re); 51 } 39 52 40 } 53 virtual void getOutputResults(ublas::matrix<double>& Ro) 54 { 55 vector<unsigned int> ids; 56 boost::copy(_var_outputs | boost::adaptors::map_keys, std::back_inserter(ids)); 57 ResultsPolicy<dim_1,dim_2,dim_3,dim_4>::read(Ro,ids); 58 } 41 59 42 void getSimResults(const double time,ublas::vector<double>& v,ublas::vector<double>& dv) 43 { 44 ResultsPolicy<dim_1,dim_2,dim_3,dim_4>::read(time,v,dv); 60 unsigned long getSize() 61 { 62 return ResultsPolicy<dim_1,dim_2,dim_3,dim_4>::size(); 63 } 64 65 unsigned long getDimRe() 66 { 67 return dim_3; 68 } 45 69 46 } 70 unsigned long getDimdR() 71 { 72 return dim_2; 73 } 47 74 75 unsigned long getDimR() 76 { 77 return dim_1; 78 } 48 79 49 void getSimResults(ublas::matrix<double>& R,ublas::matrix<double>& dR) 50 { 80 vector<double> getTimeEntries() 81 { 82 vector<double> time; 83 ResultsPolicy<dim_1,dim_2,dim_3,dim_4>::getTime(time); 84 return time; 85 } 51 86 52 ResultsPolicy<dim_1,dim_2,dim_3,dim_4>::read(R,dR); 87 void clear() 88 { 89 ResultsPolicy<dim_1,dim_2,dim_3,dim_4>::eraseAll(); 90 }; 53 91 54 }55 56 void getSimResults(ublas::matrix<double>& R,ublas::matrix<double>& dR,ublas::matrix<double>& Re)57 {58 59 ResultsPolicy<dim_1,dim_2,dim_3,dim_4>::read(R,dR,Re);60 61 }62 63 virtual void getOutputResults(ublas::matrix<double>& Ro)64 {65 vector<unsigned int> ids;66 boost::copy(_var_outputs | boost::adaptors::map_keys, std::back_inserter(ids));67 ResultsPolicy<dim_1,dim_2,dim_3,dim_4>::read(Ro,ids);68 }69 70 unsigned long getSize()71 {72 return ResultsPolicy<dim_1,dim_2,dim_3,dim_4>::size();73 }74 75 76 unsigned long getDimRe()77 {78 return dim_3;79 }80 81 82 unsigned long getDimdR()83 {84 return dim_2;85 }86 87 88 89 unsigned long getDimR()90 {91 return dim_1;92 }93 94 95 vector<double> getTimeEntries()96 {97 vector<double> time;98 ResultsPolicy<dim_1,dim_2,dim_3,dim_4>::getTime(time);99 return time;100 }101 102 void clear()103 {104 ResultsPolicy<dim_1,dim_2,dim_3,dim_4>::eraseAll();105 };106 92 private: 107 //map of indices of all output variables 108 map<unsigned int,string> _var_outputs; 109 IGlobalSettings& _globalSettings; 110 93 //map of indices of all output variables 94 map<unsigned int,string> _var_outputs; 95 IGlobalSettings& _globalSettings; 111 96 }; -
trunk/SimulationRuntime/cpp/Include/Core/Modelica/ModelicaSystem.h
r22400 r22981 16 16 *****************************************************************************/ 17 17 18 class Modelica: public IMixedSystem ,public IContinuous ,public IEvent ,public ISystemProperties, public SystemDefaultImplementation 19 { 20 public: 18 21 22 Modelica(IGlobalSettings* globalSettings,boost::shared_ptr<IAlgLoopSolverFactory> nonlinsolverfactory,boost::shared_ptr<ISimData>); 19 23 20 class Modelica: public IMixedSystem ,public IContinuous ,public IEvent ,public ISystemProperties, public SystemDefaultImplementation 21 { 22 public: 24 ~Modelica(); 23 25 24 Modelica(IGlobalSettings* globalSettings,boost::shared_ptr<IAlgLoopSolverFactory> nonlinsolverfactory,boost::shared_ptr<ISimData>); 26 //Releases the Modelica System 27 virtual void destroy(); 25 28 26 ~Modelica(); 29 // Geerbt von IContinuous 30 ////////////////////////////////////////////////// 31 virtual int getDimBoolean() const; 27 32 28 //Releases the Modelica System 29 virtual void destroy();33 /// Provide number (dimension) of states 34 virtual int getDimContinuousStates() const; 30 35 31 // Geerbt von IContinuous 32 ////////////////////////////////////////////////// 33 virtual int getDimBoolean() const; 36 /// Provide number (dimension) of integer variables 37 virtual int getDimInteger() const; 34 38 35 /// Provide number (dimension) of states36 virtual int getDimContinuousStates() const;39 /// Provide number (dimension) of real variables 40 virtual int getDimReal() const; 37 41 38 /// Provide number (dimension) of integervariables39 virtual int getDimInteger() const;42 /// Provide number (dimension) of string variables 43 virtual int getDimString() const; 40 44 41 /// Provide number (dimension) of real variables42 virtual int getDimReal() const;45 /// Provide number (dimension) of right hand sides (equations and/or residuals) according to the index 46 virtual int getDimRHS() const; 43 47 44 /// Provide number (dimension) of stringvariables45 virtual int getDimString() const;48 /// Provide boolean variables 49 virtual void getBoolean(bool* z); 46 50 47 /// Provide number (dimension) of right hand sides (equations and/or residuals) according to the index48 virtual int getDimRHS() const;51 /// Provide boolean variables 52 virtual void getContinuousStates(double* z); 49 53 54 /// Provide integer variables 55 virtual void getInteger(int* z); 50 56 51 /// Provide booleanvariables52 virtual void getBoolean(bool* z);57 /// Provide real variables 58 virtual void getReal(double* z); 53 59 54 /// Provide booleanvariables55 virtual void getContinuousStates(double* z);60 /// Provide real variables 61 virtual void getString(std::string* z); 56 62 57 /// Provide integer variables58 virtual void getInteger(int* z);63 /// Provide the right hand side 64 virtual void getRHS(double* f); 59 65 60 /// Provide realvariables61 virtual void getReal(double* z);66 /// Provide boolean variables 67 virtual void setBoolean(const bool* z); 62 68 63 /// Provide realvariables64 virtual void getString(std::string* z);69 /// Provide boolean variables 70 virtual void setContinuousStates(const double* z); 65 71 66 /// Provide the right hand side67 virtual void getRHS(double* f);72 /// Provide integer variables 73 virtual void setInteger(const int* z); 68 74 75 /// Provide real variables 76 virtual void setReal(const double* z); 69 77 70 /// Provide booleanvariables71 virtual void setBoolean(const bool* z);78 /// Provide real variables 79 virtual void setString(const std::string* z); 72 80 73 /// Provide boolean variables74 virtual void setContinuousStates(const double* z);81 /// Provide the right hand side 82 virtual void setRHS(const double* f); 75 83 76 /// Provide integer variables 77 virtual void setInteger(const int* z); 84 // Update transfer behavior of the system of equations according to command given by solver 85 virtual bool evaluateAll(const UPDATETYPE command = IContinuous::UNDEF_UPDATE); 86 virtual void evaluateODE(const UPDATETYPE command = IContinuous::UNDEF_UPDATE); 87 virtual void evaluateZeroFuncs(const UPDATETYPE command = IContinuous::UNDEF_UPDATE); 78 88 79 /// Provide real variables80 virtual void setReal(const double* z);89 //Resets all time events 90 virtual void resetTimeEvents(); 81 91 82 /// Provide real variables 83 virtual void setString(const std::string* z);92 //Set current integration time 93 virtual void setTime(const double& t); 84 94 85 /// Provide the right hand side 86 virtual void setRHS(const double* f); 95 // Provide Jacobian 96 virtual void getJacobian(SparseMatrix& matrix); 97 virtual void getStateSetJacobian(SparseMatrix& matrix); 98 // Provide number (dimension) of zero functions 99 virtual int getDimZeroFunc() ; 87 100 88 // Update transfer behavior of the system of equations according to command given by solver 89 virtual bool evaluateAll(const UPDATETYPE command = IContinuous::UNDEF_UPDATE);90 virtual void evaluateODE(const UPDATETYPE command = IContinuous::UNDEF_UPDATE);91 virtual void evaluateZeroFuncs(const UPDATETYPE command =IContinuous::UNDEF_UPDATE);101 // Provides current values of root/zero functions 102 virtual void getZeroFunc(double* f); 103 virtual bool checkConditions(); 104 virtual void getConditions(bool* c); 92 105 106 //Called to handle all events occured at same time 107 virtual bool handleSystemEvents( bool* events); 108 //Called to handle an event 109 virtual void handleEvent(const bool* events); 93 110 94 //Resets all time events 95 virtual void resetTimeEvents();111 //Checks if a discrete variable has changed and triggers an event 112 virtual bool checkForDiscreteEvents(); 96 113 97 //Set current integration time 98 virtual void setTime(const double& t);114 // M is regular 115 virtual bool isODE(); 99 116 117 // M is singular 118 virtual bool isAlgebraic(); 100 119 120 // System is able to provide the Jacobian symbolically 121 virtual bool provideSymbolicJacobian(); 122 virtual void saveDiscreteVars(); 123 virtual bool stepCompleted(double time); 101 124 125 private: 126 //Methods: 127 //Saves all variables before an event is handled, is needed for the pre, edge and change operator 128 void saveAll(); 102 129 103 104 105 // Provide Jacobian 106 virtual void getJacobian(SparseMatrix& matrix); 107 virtual void getStateSetJacobian(SparseMatrix& matrix); 108 // Provide number (dimension) of zero functions 109 virtual int getDimZeroFunc() ; 110 111 // Provides current values of root/zero functions 112 virtual void getZeroFunc(double* f); 113 virtual bool checkConditions(); 114 virtual void getConditions(bool* c); 115 116 //Called to handle all events occured at same time 117 virtual bool handleSystemEvents( bool* events); 118 //Called to handle an event 119 virtual void handleEvent(const bool* events); 120 121 //Checks if a discrete variable has changed and triggers an event 122 virtual bool checkForDiscreteEvents(); 123 124 125 126 // M is regular 127 virtual bool isODE(); 128 129 // M is singular 130 virtual bool isAlgebraic(); 131 132 // System is able to provide the Jacobian symbolically 133 virtual bool provideSymbolicJacobian() ; 134 virtual void saveDiscreteVars(); 135 virtual bool stepCompleted(double time); 136 private: 137 138 //Methods: 139 //Saves all variables before an event is handled, is needed for the pre, edge and change operator 140 void saveAll(); 141 142 void resetHelpVar(const int index); 143 130 void resetHelpVar(const int index); 144 131 }; -
trunk/SimulationRuntime/cpp/Include/Core/SimController/Configuration.h
r22025 r22981 2 2 #include <SimCoreFactory/Policies/FactoryPolicy.h> 3 3 4 5 6 class Configuration : public ConfigurationPolicy 4 class Configuration : public ConfigurationPolicy 7 5 { 8 6 public: … … 13 11 ISolverSettings* getSolverSettings(); 14 12 ISimControllerSettings* getSimControllerSettings(); 13 15 14 private: 16 17 15 boost::shared_ptr<ISettingsFactory> _settings_factory; 18 boost::shared_ptr<ISolverSettings> 19 boost::shared_ptr<IGlobalSettings> 20 boost::shared_ptr<ISimControllerSettings> 16 boost::shared_ptr<ISolverSettings> _solver_settings; 17 boost::shared_ptr<IGlobalSettings> _global_settings; 18 boost::shared_ptr<ISimControllerSettings> _simcontroller_settings; 21 19 boost::shared_ptr<ISolver> _solver; 22 23 20 }; -
trunk/SimulationRuntime/cpp/Include/Core/SimController/ISimController.h
r22917 r22981 36 36 class ISimController 37 37 { 38 39 38 public: 40 39 /// Enumeration to control the time integration … … 42 41 #if defined(__vxworks) || defined(__TRICORE__) 43 42 #else 44 virtual std::pair<boost::shared_ptr<IMixedSystem>, boost::shared_ptr<ISimData> > LoadSystem(boost::shared_ptr<ISimData> (*createSimDataCallback)(), boost::shared_ptr<IMixedSystem> (*createSystemCallback)(IGlobalSettings*, boost::shared_ptr<IAlgLoopSolverFactory>, boost::shared_ptr<ISimData>), string modelKey)=0;43 virtual std::pair<boost::shared_ptr<IMixedSystem>, boost::shared_ptr<ISimData> > LoadSystem(boost::shared_ptr<ISimData> (*createSimDataCallback)(), boost::shared_ptr<IMixedSystem> (*createSystemCallback)(IGlobalSettings*, boost::shared_ptr<IAlgLoopSolverFactory>, boost::shared_ptr<ISimData>), string modelKey) = 0; 45 44 #endif 46 virtual std::pair<boost::shared_ptr<IMixedSystem>, boost::shared_ptr<ISimData> > LoadSystem(string modelLib,string modelKey) = 0;47 virtual std::pair<boost::shared_ptr<IMixedSystem>, boost::shared_ptr<ISimData> > LoadModelicaSystem(PATH modelica_path,string modelKey) = 0;45 virtual std::pair<boost::shared_ptr<IMixedSystem>, boost::shared_ptr<ISimData> > LoadSystem(string modelLib, string modelKey) = 0; 46 virtual std::pair<boost::shared_ptr<IMixedSystem>, boost::shared_ptr<ISimData> > LoadModelicaSystem(PATH modelica_path,string modelKey) = 0; 48 47 49 /* 50 Starts the simulation 51 modelKey: Modelica model name 52 modelica_path: path to Modelica system dll 53 */ 48 // Starts the simulation; modelKey: Modelica model name; modelica_path: path to Modelica system dll 54 49 virtual void Start(boost::shared_ptr<IMixedSystem> mixedsystem, SimSettings simsettings, string modelKey)=0; 55 50 // Stops the simulation 51 virtual void Stop() = 0; 52 53 // Functions for realtime-usage (VxWorks and BODAS) 56 54 virtual void StartVxWorks(boost::shared_ptr<IMixedSystem> mixedsystem, SimSettings simsettings) = 0; 57 55 virtual boost::shared_ptr<ISimData> getSimData(string modelname) = 0; 58 56 virtual void calcOneStep() = 0; 59 60 /// Stops the simulation61 virtual void Stop() = 0;62 57 }; -
trunk/SimulationRuntime/cpp/Include/Core/SimController/ISimData.h
r22903 r22981 18 18 virtual ISimVar* Get(std::string key) = 0; 19 19 //Adds Results for an output var to simdata object 20 virtual void addOutputResults(std::string name, uBlas::vector<double> v) = 0;20 virtual void addOutputResults(std::string name, uBlas::vector<double> v) = 0; 21 21 //Returns reference to results for an output var, when simData object is destroyed results are no longer valid 22 virtual void getOutputResults(std::string name, uBlas::vector<double>& v) = 0;22 virtual void getOutputResults(std::string name, uBlas::vector<double>& v) = 0; 23 23 //Clears all output var results 24 24 virtual void clearResults() = 0; 25 //Return the time intervall25 //Returns the time interval 26 26 virtual void getTimeEntries(std::vector<double>& time_entries) = 0; 27 27 virtual void addTimeEntries(std::vector<double> time_entries) = 0; -
trunk/SimulationRuntime/cpp/Include/Core/SimController/Initialization.h
r22025 r22981 8 8 { 9 9 public: 10 Initialization(boost::shared_ptr<ISystemInitialization> system_initialization,boost::shared_ptr<ISolver> 10 Initialization(boost::shared_ptr<ISystemInitialization> system_initialization,boost::shared_ptr<ISolver>); 11 11 ~Initialization(void); 12 12 void initializeSystem(/*double start_time, double end_time*/); 13 13 14 private: 14 15 15 boost::shared_ptr<ISystemInitialization> _system; 16 boost::shared_ptr<ISolver>_solver;16 boost::shared_ptr<ISolver> _solver; 17 17 }; 18 18 -
trunk/SimulationRuntime/cpp/Include/Core/SimController/SimController.h
r22904 r22981 21 21 #if defined(__vxworks) || defined(__TRICORE__) 22 22 #else 23 virtual std::pair<boost::shared_ptr<IMixedSystem>, boost::shared_ptr<ISimData> > LoadSystem(boost::shared_ptr<ISimData> (*createSimDataCallback)(), boost::shared_ptr<IMixedSystem> (*createSystemCallback)(IGlobalSettings*, boost::shared_ptr<IAlgLoopSolverFactory>, boost::shared_ptr<ISimData>), string modelKey);23 virtual std::pair<boost::shared_ptr<IMixedSystem>, boost::shared_ptr<ISimData> > LoadSystem(boost::shared_ptr<ISimData> (*createSimDataCallback)(), boost::shared_ptr<IMixedSystem> (*createSystemCallback)(IGlobalSettings*, boost::shared_ptr<IAlgLoopSolverFactory>, boost::shared_ptr<ISimData>), string modelKey); 24 24 #endif 25 25 virtual std::pair<boost::shared_ptr<IMixedSystem>, boost::shared_ptr<ISimData> > LoadModelicaSystem(PATH modelica_path, string modelKey); … … 29 29 virtual void Stop(); 30 30 31 // for real-time usage (VxWorks and BODAS) 31 32 virtual boost::shared_ptr<ISimData> getSimData(string modelname); 32 33 virtual void StartVxWorks(boost::shared_ptr<IMixedSystem> mixedsystem, SimSettings simsettings); … … 40 41 boost::shared_ptr<IAlgLoopSolverFactory> _algloopsolverfactory; 41 42 43 // for real-time usage (VxWorks and BODAS) 42 44 boost::shared_ptr<SimManager> _simMgr; 43 45 -
trunk/SimulationRuntime/cpp/Include/Core/SimController/SimManager.h
r22903 r22981 30 30 { 31 31 public: 32 SimManager(boost::shared_ptr<IMixedSystem> system, Configuration* _config);32 SimManager(boost::shared_ptr<IMixedSystem> system, Configuration* _config); 33 33 ~SimManager(); 34 34 void runSimulation(); 35 35 void initialize(); 36 void runSingleStep(); 36 37 // for real-time usage (VxWorks and BODAS) 38 void runSingleStep(); 37 39 38 40 private: 39 40 41 41 void computeEndTimes(std::vector<std::pair<double,int> > &tStopsSub); 42 42 void runSingleProcess(); … … 46 46 Configuration* _config; 47 47 48 49 50 std::vector<std::vector<std::pair<double,int> > > ///< - Stopzeitpunkte aufgrund von Time-Events 51 _tStops; 52 boost::shared_ptr<ISolver> _solver; ///< - Solver 53 54 55 int _dimtimeevent, ///< Temp - Timeevent-Dimensionen-Array 56 _dimZeroFunc; ///< Number of zero functions 57 int* _timeeventcounter; ///< Temp - Timeevent-Counter-Array 58 int 59 _totStps, ///< Output - Anzahl steps der Prozesse 60 _accStps, ///< Output - Anzahl akzeptierte steps der Prozesse 61 _rejStps; ///< Output - Anzahl verworfene steps der Prozesse 62 63 ISolver::SOLVERCALL _solverTask; ///< Temporary - Beschreibt die Aufgabe mit der der Solver aufgerufen wird 64 65 int 66 _idid; ///< Output - DebugID 67 bool 68 _continueSimulation ///< - Flag für Endlossimulation (wird gesetzt, wenn Solver zurückkehrt) 69 ,_writeFinalState; ///< Temporary - Ist am Ende noch ein Time-Event??? 70 bool* 71 _events; ///< Vector (of dimension _dimZeroF) indicating which zero function caused an event 72 double 73 _H, ///< Input, Output - Koppelschrittweite 74 _tStart, 75 _tEnd; 76 boost::shared_ptr<Initialization> _initialization; 48 std::vector<std::vector<std::pair<double,int> > > _tStops; ///< - Stopzeitpunkte aufgrund von Time-Events 49 boost::shared_ptr<ISolver> _solver; ///< - Solver 50 int _dimtimeevent, ///< Temp - Timeevent-Dimensionen-Array 51 _dimZeroFunc; ///< - Number of zero functions 52 int* _timeeventcounter; ///< Temp - Timeevent-Counter-Array 53 int _totStps, ///< Output - Anzahl Steps der Prozesse 54 _accStps, ///< Output - Anzahl akzeptierte Steps der Prozesse 55 _rejStps; ///< Output - Anzahl verworfene steps der Prozesse 56 ISolver::SOLVERCALL _solverTask; ///< Temporary - Beschreibt die Aufgabe mit der der Solver aufgerufen wird 57 int _idid; ///< Output - DebugID 58 bool _continueSimulation,///< - Flag für Endlossimulation (wird gesetzt, wenn Solver zurückkehrt) 59 _writeFinalState; ///< Temporary - Ist am Ende noch ein Time-Event??? 60 bool* _events; ///< - Vector (of dimension _dimZeroF) indicating which zero function caused an event 61 double _H, ///< Input, Output - Koppelschrittweite 62 _tStart, 63 _tEnd; 64 boost::shared_ptr<Initialization> _initialization; 77 65 }; -
trunk/SimulationRuntime/cpp/Include/Core/SimulationSettings/Factory.h
r22025 r22981 13 13 { 14 14 public: 15 SettingsFactory(PATH libraries_path,PATH config_path,PATH modelicasystem_path); 16 virtual boost::shared_ptr<ISolverSettings> createSelectedSolverSettings(); 17 virtual boost::shared_ptr<IGlobalSettings> createSolverGlobalSettings(); 18 ~SettingsFactory(void); 15 SettingsFactory(PATH libraries_path, PATH config_path, PATH modelicasystem_path); 16 virtual boost::shared_ptr<ISolverSettings> createSelectedSolverSettings(); 17 virtual boost::shared_ptr<IGlobalSettings> createSolverGlobalSettings(); 18 ~SettingsFactory(void); 19 19 20 private: 20 21 boost::shared_ptr<IGlobalSettings> _global_settings; 21 22 boost::shared_ptr<ISolverSettings> _solver_settings; 22 23 23 }; -
trunk/SimulationRuntime/cpp/Include/Core/SimulationSettings/GlobalSettings.h
r22025 r22981 1 1 #pragma once 2 3 4 2 #include <fstream> 5 3 6 class 4 class GlobalSettings : public IGlobalSettings 7 5 { 8 9 6 public: 10 7 GlobalSettings(void); … … 22 19 virtual bool getResultsOutput(); 23 20 virtual void setResultsOutput(bool); 24 ///< Write out statistical simulation infos, e.g. number of steps (at the end of simulation); [false, true]; default: true)21 ///< Write out statistical simulation infos, e.g. number of steps (at the end of simulation); [false, true]; default: true) 25 22 virtual bool getInfoOutput(); 26 23 virtual void setInfoOutput(bool); … … 28 25 virtual void useEndlessSim(bool); 29 26 ///path for simulation results in textfile 30 virtual string 27 virtual string getOutputPath(); 31 28 virtual void setOutputPath(string); 32 29 virtual OutputFormat getOutputFormat(); 33 30 virtual void setOutputFormat(OutputFormat format); 34 35 31 virtual OutputPointType getOutputPointType(); 36 32 virtual void setOutputPointType(OutputPointType); 37 38 virtual LogType getLogType(); 33 virtual LogType getLogType(); 39 34 virtual void setLogType(LogType); 40 35 41 36 //solver used for simulation 42 virtual string 37 virtual string getSelectedSolver(); 43 38 virtual void setSelectedSolver(string); 44 virtual string 39 virtual string getSelectedNonLinSolver(); 45 40 virtual void setSelectedNonLinSolver(string); 46 virtual string 41 virtual string getSelectedLinSolver(); 47 42 virtual void setSelectedLinSolver(string); 48 43 virtual void setResultsFileName(string); … … 54 49 virtual void setAlarmTime(unsigned int); 55 50 virtual unsigned int getAlarmTime(); 51 56 52 private: 57 53 double … … 59 55 _endTime,///< End time of integraiton (default: 1.0) 60 56 _hOutput;//< Output step size (default: 20 ms) 61 62 57 bool 63 58 _resultsOutput, ///< Write out results ([false,true]; default: true) … … 75 70 LogType _log_type; 76 71 unsigned int _alarm_time; 77 78 79 72 }; -
trunk/SimulationRuntime/cpp/Include/Core/SimulationSettings/IGlobalSettings.h
r22562 r22981 18 18 #endif 19 19 20 enum OutputFormat {CSV, MAT, EMPTY} 21 enum LogType {OFF, STATS, NLS, ODE};22 enum OutputPointType {ALL, STEP,EMPTY2};20 enum OutputFormat {CSV, MAT, EMPTY}; 21 enum LogType {OFF, STATS, NLS, ODE}; 22 enum OutputPointType {ALL, STEP, EMPTY2}; 23 23 class IGlobalSettings 24 24 { 25 26 25 public: 27 virtual 26 virtual ~IGlobalSettings() {} 28 27 ///< Start time of integration (default: 0.0) 29 virtual double getStartTime() =0;30 virtual void setStartTime(double) =0;31 ///< End time of integra iton (default: 1.0)32 virtual double getEndTime() =0;33 virtual void setEndTime(double) =0;28 virtual double getStartTime() = 0; 29 virtual void setStartTime(double) = 0; 30 ///< End time of integration (default: 1.0) 31 virtual double getEndTime() = 0; 32 virtual void setEndTime(double) = 0; 34 33 ///< Output step size (default: 20 ms) 35 virtual double gethOutput() =0;36 virtual void sethOutput(double) =0;34 virtual double gethOutput() = 0; 35 virtual void sethOutput(double) = 0; 37 36 ///< Write out results ([false,true]; default: true) 38 virtual bool getResultsOutput() =0;39 virtual void setResultsOutput(bool) =0;37 virtual bool getResultsOutput() = 0; 38 virtual void setResultsOutput(bool) = 0; 40 39 virtual OutputFormat getOutputFormat() = 0; 41 40 virtual void setOutputFormat(OutputFormat) = 0; … … 44 43 virtual LogType getLogType() = 0; 45 44 virtual void setLogType(LogType) = 0; 46 45 virtual void setAlarmTime(unsigned int) = 0; 47 46 virtual unsigned int getAlarmTime() = 0; 48 47 49 virtual bool useEndlessSim() =0;50 virtual void useEndlessSim(bool) =0;48 virtual bool useEndlessSim() = 0; 49 virtual void useEndlessSim(bool) = 0; 51 50 ///< Write out statistical simulation infos, e.g. number of steps (at the end of simulation); [false,true]; default: true) 52 virtual bool getInfoOutput() =0;53 virtual void setInfoOutput(bool) =0;54 virtual string getOutputPath() =0;55 virtual void setOutputPath(string)= 0;56 virtual string getSelectedSolver()=0;57 virtual void setSelectedSolver(string) =0;58 virtual string getSelectedLinSolver()=0;59 virtual void setSelectedLinSolver(string) =0;60 virtual string getSelectedNonLinSolver()=0;61 virtual void setSelectedNonLinSolver(string) =0;62 virtual void load(std::string xml_file) =0;63 virtual void setResultsFileName(string)=0;64 virtual string getResultsFileName()=0;65 virtual void setRuntimeLibrarypath(string)=0;66 virtual string getRuntimeLibrarypath()=0;51 virtual bool getInfoOutput() = 0; 52 virtual void setInfoOutput(bool) = 0; 53 virtual string getOutputPath() = 0; 54 virtual void setOutputPath(string)= 0; 55 virtual string getSelectedSolver() = 0; 56 virtual void setSelectedSolver(string) = 0; 57 virtual string getSelectedLinSolver() = 0; 58 virtual void setSelectedLinSolver(string) = 0; 59 virtual string getSelectedNonLinSolver() = 0; 60 virtual void setSelectedNonLinSolver(string) = 0; 61 virtual void load(std::string xml_file) = 0; 62 virtual void setResultsFileName(string) = 0; 63 virtual string getResultsFileName() = 0; 64 virtual void setRuntimeLibrarypath(string) = 0; 65 virtual string getRuntimeLibrarypath() = 0; 67 66 }; -
trunk/SimulationRuntime/cpp/Include/Core/SimulationSettings/ISettingsFactory.h
r22024 r22981 1 1 #pragma once 2 3 2 #include <Core/Solver/ISolverSettings.h> 4 3 … … 8 7 ISettingsFactory() {}; 9 8 virtual ~ISettingsFactory(void) {}; 10 virtual boost::shared_ptr<ISolverSettings> createSelectedSolverSettings() = 0;11 virtual boost::shared_ptr<IGlobalSettings> createSolverGlobalSettings() = 0;9 virtual boost::shared_ptr<ISolverSettings> createSelectedSolverSettings() = 0; 10 virtual boost::shared_ptr<IGlobalSettings> createSolverGlobalSettings() = 0; 12 11 }; -
trunk/SimulationRuntime/cpp/Include/Core/SimulationSettings/ISimControllerSettings.h
r22024 r22981 1 1 #pragma once 2 2 3 /** 4 Klasse zur Kapselung der Parameter (Einstellungen) für den SimManagerSettings. 5 */ 3 /* Klasse zur Kapselung der Parameter (Einstellungen) für den SimManagerSettings.*/ 6 4 7 5 #include <Core/Math/Constants.h> … … 11 9 public: 12 10 ISimControllerSettings(IGlobalSettings* globalSettings) 13 : dHcpl 14 , dErrTol(0.0)15 , dK 16 , dC 17 , dCmax 18 , dCmin 19 , dHuplim 20 , dHlowlim 21 , dSingleStepTol 22 , dTendTol 23 , iMaxRejSteps(50)24 , iSingleSteps(0)25 , bDynCouplingStepSize(false)26 , bCouplingOutput 27 , _globalSettings(globalSettings)11 : dHcpl (1e-3) 12 , dErrTol (0.0) 13 , dK (-0.25) 14 , dC (1.0) 15 , dCmax (1.5) 16 , dCmin (0.5) 17 , dHuplim ((globalSettings->getEndTime()-globalSettings->getStartTime())/100) 18 , dHlowlim (10.0 * UROUND) 19 , dSingleStepTol (1e-5) 20 , dTendTol (1e-6) 21 , iMaxRejSteps (50) 22 , iSingleSteps (0) 23 , bDynCouplingStepSize (false) 24 , bCouplingOutput (true) 25 , _globalSettings (globalSettings) 28 26 { 29 27 }; 30 28 31 29 double 32 dHcpl, 30 dHcpl, ///< Koppelschrittweite (=Intervalllänge nach der Daten zwischen gekoppelten System ausgetauscht werden, default: 100 Schritte [1/s]) 33 31 dErrTol, ///< Gibt an, wieviel größer als 1.0 der Fehler sein darf, damit der Schritt akzeptiert wird (vorteilhaft, wenn sich wenig ändert) (default: 0.0) 34 dK, 35 dC, 36 dCmax, 37 dCmin, 32 dK, ///< Faktor für Schrittweitensteuerung (k-ten Wurzel des Fehlers) (dK <= 0, default: -0.25, kleinerer Wert = größere Schrittweite) 33 dC, ///< Savety Faktor für Schrittweitensteuerung (default: 1.0) 34 dCmax, ///< Upscale Faktor für Schrittweitensteuerung (default: 1.5) 35 dCmin, ///< Downscale Faktor für Schrittweitensteuerung (default: 0.5) 38 36 dHuplim, ///< Maximale Koppelschrittweite 39 dHlowlim, 40 dSingleStepTol, 41 dTendTol; 37 dHlowlim, ///< Minimale Koppelschrittweite 38 dSingleStepTol, ///< Fehlertoleranz zur Aussetzung der Doppelschritt-Technik (default: 1e-5) 39 dTendTol; ///< Toleranz mit der Endzeit erreicht werden soll (default: 1e-6) 42 40 43 41 int 44 iMaxRejSteps, 45 iSingleSteps; 42 iMaxRejSteps, ///< Max. Anzahl nacheinander verworfener Schritte (default: 50) 43 iSingleSteps; ///< Anzahl Schritte ohne Doppelschritt-Technik (ACHTUNG: nur bei genauer Kenntniss über Kopplungsgrad verwenden) (default: 0) 46 44 47 45 bool 48 bDynCouplingStepSize, 49 bCouplingOutput; 46 bDynCouplingStepSize, ///< Aquidistante oder dynamische gesteuerte Koppelschrittweite ([false,true]; default: false) 47 bCouplingOutput; ///< SimManagerSettings-spezifische Ausgaben ([false,true]; default: false) 50 48 51 49 IGlobalSettings* 52 50 _globalSettings; ///< Zeiger auf Globale Simulations Einstellungen 53 54 51 }; -
trunk/SimulationRuntime/cpp/Include/Core/Solver/FactoryExport.h
r22901 r22981 17 17 error "operating system not supported" 18 18 #endif 19 20 21 -
trunk/SimulationRuntime/cpp/Include/Core/Solver/IAlgLoopSolver.h
r20164 r22981 19 19 class IAlgLoopSolver 20 20 { 21 22 21 public: 23 22 /// Enumeration to denote the status of iteration … … 29 28 }; 30 29 31 virtual ~IAlgLoopSolver() 30 virtual ~IAlgLoopSolver() {}; 32 31 33 32 /// (Re-) initialize the solver -
trunk/SimulationRuntime/cpp/Include/Core/Solver/ILinSolverSettings.h
r21137 r22981 1 1 #pragma once 2 3 2 #include <string> 4 3 … … 6 5 /** 7 6 8 Al gemeine Klasse zur Kapselung der Parameter (Einstellungen) für einen linearen Solver7 Allgemeine Klasse zur Kapselung der Parameter (Einstellungen) für einen linearen Solver 9 8 Hier werden default-Einstellungen entsprechend der allgemeinen Simulations- 10 einstellu gnen gemacht, diese können überprüft und ev. Fehleinstellungen korrigiert9 einstellungen gemacht, diese können überprüft und ev. Fehleinstellungen korrigiert 11 10 werden. 12 11 *****************************************************************************/ … … 16 15 virtual ~ILinSolverSettings(){}; 17 16 18 virtual bool getUseSparseFormat()=0; 19 virtual void setUseSparseFormat(bool value)=0; 20 21 virtual void load(std::string)=0; 17 virtual bool getUseSparseFormat() = 0; 18 virtual void setUseSparseFormat(bool value) = 0; 19 virtual void load(std::string) = 0; 22 20 }; -
trunk/SimulationRuntime/cpp/Include/Core/Solver/INonLinSolverSettings.h
r21136 r22981 1 1 #pragma once 2 3 4 5 6 2 7 3 /*****************************************************************************/ 8 4 /** 9 5 10 Al gemeine Klasse zur Kapselung der Parameter (Einstellungen) für einen nicht linearen Solver6 Allgemeine Klasse zur Kapselung der Parameter (Einstellungen) für einen nicht linearen Solver 11 7 Hier werden default-Einstellungen entsprechend der allgemeinen Simulations- 12 einstellu gnen gemacht, diese können überprüft und ev. Fehleinstellungen korrigiert8 einstellungen gemacht, diese können überprüft und ev. Fehleinstellungen korrigiert 13 9 werden. 14 10 *****************************************************************************/ … … 18 14 virtual ~INonLinSolverSettings(){}; 19 15 20 virtual long int 21 virtual void 22 virtual double 23 virtual void 24 virtual double 25 virtual void 26 virtual double getDelta()= 0;27 virtual void setDelta(double)= 0;28 virtual void load(string) =0;16 virtual long int getNewtMax() = 0; 17 virtual void setNewtMax(long int)= 0; 18 virtual double getRtol() = 0; 19 virtual void setRtol(double) = 0; 20 virtual double getAtol() = 0; 21 virtual void setAtol(double) = 0; 22 virtual double getDelta() = 0; 23 virtual void setDelta(double) = 0; 24 virtual void load(string) = 0; 29 25 }; 30 26 -
trunk/SimulationRuntime/cpp/Include/Core/Solver/ISolver.h
r21582 r22981 1 1 #pragma once 2 3 4 5 2 /*****************************************************************************/ 6 3 /** … … 18 15 class ISolver 19 16 { 20 21 17 public: 22 18 /// Enumeration to control the time integration 23 19 enum SOLVERCALL 24 20 { 25 UNDEF_CALL = 0x00000000, 26 27 FIRST_CALL = 0x00000100, ///< First call to solver 28 RECALL = 0x00000400, ///< Call to solver after restart (state vector of solver has to be reinitialized 29 RECORDCALL = 0x00004000, ///< Erster Aufruf zum recorden von y0 30 }; 21 UNDEF_CALL = 0x00000000, 22 FIRST_CALL = 0x00000100, ///< First call to solver 23 RECALL = 0x00000400, ///< Call to solver after restart (state vector of solver has to be reinitialized 24 RECORDCALL = 0x00004000, ///< Erster Aufruf zum recorden von y0 25 }; 31 26 32 27 /// Enum to define the current status of the solver 33 28 enum SOLVERSTATUS 34 29 { 35 UNDEF_STATUS = 36 CONTINUE = 0x00001,///< Continoue integration37 USER_STOP = 0x00002,///< Integratin stopped by user38 SOLVERERROR = 0x00004,///< An error occured. Integration was stopped39 DONE = 0x00008,///< Integration successfully done30 UNDEF_STATUS = 0x00000, 31 CONTINUE = 0x00001, ///< Continoue integration 32 USER_STOP = 0x00002, ///< Integratin stopped by user 33 SOLVERERROR = 0x00004, ///< An error occured. Integration was stopped 34 DONE = 0x00008, ///< Integration successfully done 40 35 }; 41 36 … … 43 38 enum ZEROSTATUS 44 39 { 45 EQUAL_ZERO, ///< Value of zero function smaller than given tolerance (_zeroTol)46 ZERO_CROSSING, ///< zero crossing = change in sign of zero function47 NO_ZERO, ///< Even though zero crossing occured, no value of zero function did not become zero in given intervall48 UNCHANGED_SIGN ///< no zero crossing = continoue time integration40 EQUAL_ZERO, ///< Value of zero function smaller than given tolerance (_zeroTol) 41 ZERO_CROSSING, ///< zero crossing = change in sign of zero function 42 NO_ZERO, ///< Even though zero crossing occured, no value of zero function did not become zero in given intervall 43 UNCHANGED_SIGN ///< no zero crossing = continoue time integration 49 44 }; 50 45 51 virtual ~ISolver() {}; 52 46 virtual ~ISolver() {}; 53 47 54 48 /// Set start time … … 63 57 /// (Re-) initialize the solver 64 58 virtual void initialize() = 0; 65 59 virtual bool stateSelection() = 0; 66 60 /// Approximation of the numerical solution in a given time interval 67 61 virtual void solve(const SOLVERCALL command = UNDEF_CALL) = 0; … … 74 68 virtual void writeSimulationInfo() = 0; 75 69 76 /// Indicates whether a solver error occurred during integration, returns type of error and provides error message 77 /*virtual const int reportErrorMessage(ostream& messageStream) = 0;*/ 78 70 /// Indicates whether a solver error occurred during integration, returns type of error and provides error message 71 /*virtual const int reportErrorMessage(ostream& messageStream) = 0;*/ 79 72 }; -
trunk/SimulationRuntime/cpp/Include/Core/Solver/ISolverSettings.h
r22917 r22981 31 31 virtual double getEndTimeTol() = 0; 32 32 virtual void setEndTimeTol(double) = 0; 33 // DenseOut33 // DenseOut 34 34 virtual bool getDenseOutput() = 0; 35 35 virtual void setDenseOutput(bool) = 0; … … 40 40 virtual void setRTol(double) = 0; 41 41 42 /// 43 virtual IGlobalSettings* getGlobalSettings() =0;44 virtual void load(string) =0;42 /// Global simulation settings 43 virtual IGlobalSettings* getGlobalSettings() = 0; 44 virtual void load(string) = 0; 45 45 }; -
trunk/SimulationRuntime/cpp/Include/Core/Solver/SimulationMonitor.h
r22561 r22981 8 8 { 9 9 public: 10 SimulationMonitor(); 11 ~SimulationMonitor(); 12 void initialize(); 13 void setTimeOut(unsigned int time_out); 14 void checkTimeout(); 15 protected: 10 SimulationMonitor(); 11 ~SimulationMonitor(); 12 void initialize(); 13 void setTimeOut(unsigned int time_out); 14 void checkTimeout(); 15 16 protected: 16 17 /*nanosecond_type _time_out;*/ 17 18 18 bool _interrupt; 19 19 /*cpu_timer _timer;*/ 20 21 20 }; -
trunk/SimulationRuntime/cpp/Include/Core/Solver/SolverDefaultImplementation.h
r22024 r22981 12 12 #include <Core/Solver/SystemStateSelection.h> 13 13 #include <Core/Solver/SimulationMonitor.h> 14 14 15 /// typedef to hand over (callback) functions to fortran routines 15 16 typedef int (*U_fp)(...); … … 34 35 #define BOOST_EXTENSION_SOLVER_DECL 35 36 #endif 37 36 38 class BOOST_EXTENSION_SOLVER_DECL SolverDefaultImplementation : public SimulationMonitor 37 39 { … … 40 42 SolverDefaultImplementation(IMixedSystem* system, ISolverSettings* settings); 41 43 virtual ~SolverDefaultImplementation(); 42 43 44 44 45 /// Set start time for numerical solution … … 49 50 50 51 /// Set the initial step size (needed for reinitialization after external zero search) 51 void setInitStepSize(const double& h) 52 void setInitStepSize(const double& h); 52 53 53 54 /// Assemble system and (re-)initialize solver … … 60 61 void setZeroState(); 61 62 62 63 63 /// Called by solver after every successfull integration step (calls writeOutput) 64 64 void writeToFile(const int& stp, const double& t, const double& h); 65 65 virtual bool stateSelection(); 66 66 67 67 protected: … … 69 69 //--------------------------------------------------------------- 70 70 IMixedSystem 71 *_system; 71 *_system; ///< System to be solved 72 72 73 73 ISolverSettings 74 *_settings; 74 *_settings; ///< Settings for the solver 75 75 76 76 boost::shared_ptr<SystemStateSelection> _state_selection; 77 77 double 78 _tInit, 79 _tCurrent, 80 _tEnd, 81 _tLastSuccess, 82 _tLastUnsucess, 78 _tInit, ///< (initiale) Startzeit (wird nicht vom Solver verändert) 79 _tCurrent, ///< current time (is changed by the solver) 80 _tEnd, ///< end time 81 _tLastSuccess, ///< time of last successfull integration step (before zero crossing) 82 _tLastUnsucess, ///< time of last unsuccessfull integration step (after zero crossing) 83 83 _tLargeStep; 84 84 85 85 double 86 _h; 86 _h; ///< step size (changed by the solver) 87 87 88 88 bool 89 _firstCall, 90 _firstStep; 89 _firstCall, ///< Denotes the first call to the solver. May be used to call init() 90 _firstStep; ///< Denotes the first step. May be used for (re-)initialization to call giveVars(...) 91 91 92 92 93 93 int 94 _totStps, 95 _accStps, 96 _rejStps, 97 _zeroStps, 98 _zeros; 94 _totStps, ///< Total number of time integration steps 95 _accStps, ///< Number of accepted time integration steps 96 _rejStps, ///< Number of rejected time integration steps 97 _zeroStps, ///< Number of zero search steps during whole time integration intervall 98 _zeros; ///< Number of zeros in whole time integration intervall 99 99 100 100 int 101 101 _dimSys, ///< Number of equations (=dimension of the system) 102 _dimZeroFunc; 102 _dimZeroFunc; ///< Number of zero functions 103 103 104 104 bool* 105 _events; ///< Vector (of dimension _dimZeroF) indicating which zero function caused an event 106 event_times_type ///< Map including all time entries and the event ID occuring a time event 105 _events; ///< Vector (of dimension _dimZeroF) indicating which zero function caused an event 106 107 event_times_type ///< Map including all time entries and the event ID occuring a time event 107 108 _time_events; 108 109 109 110 double 110 *_zeroVal, ///< Vector (of dimension _dimZeroF) containing values of all zero functions111 *_zeroValInit, ///< Vektor (der Dimension _dimZeroF) mit Nullstellenfunktionswerten am Anfang des Integrationsintervalles112 *_zeroValLastSuccess; ///< Vector (of dimension _dimZeroF) containing values of all zero functions of last sucessfull integration step (before zero crossing)111 *_zeroVal, ///< Vector (of dimension _dimZeroF) containing values of all zero functions 112 *_zeroValInit, ///< Vektor (der Dimension _dimZeroF) mit Nullstellenfunktionswerten am Anfang des Integrationsintervalles 113 *_zeroValLastSuccess; ///< Vector (of dimension _dimZeroF) containing values of all zero functions of last sucessfull integration step (before zero crossing) 113 114 114 115 ISolver::ZEROSTATUS 115 _zeroStatus; ///< Denotes whether a change in sign in at least one zero function occured116 _zeroStatus; ///< Denotes whether a change in sign in at least one zero function occured 116 117 117 118 ISolver::SOLVERSTATUS 118 _solverStatus; ///< Denotes the current status of the solver119 _solverStatus; ///< Denotes the current status of the solver 119 120 120 121 IWriteOutput::OUTPUT 121 _outputCommand; ///< Controls the output122 _outputCommand; ///< Controls the output 122 123 123 124 private: -
trunk/SimulationRuntime/cpp/Include/Core/Solver/SolverSettings.h
r22565 r22981 2 2 3 3 #include "ISolverSettings.h" 4 5 6 7 4 /*****************************************************************************/ 8 5 /** … … 22 19 #define BOOST_EXTENSION_SOLVERSETTINGS_DECL 23 20 #endif 21 24 22 class BOOST_EXTENSION_SOLVERSETTINGS_DECL SolverSettings : public ISolverSettings 25 23 { 26 24 public: 27 SolverSettings( IGlobalSettings* globalSettings); 28 virtual ~SolverSettings(); 29 /// Initial step size (default: 1e-2) 30 virtual double gethInit(); 31 virtual void sethInit(double); 32 /// Lower limit for step size during integration (default: should be machine precision) 33 virtual double getLowerLimit(); 34 virtual void setLowerLimit(double); 35 /// Upper limit for step size during integration (default: _endTime-_startTime) 36 virtual double getUpperLimit(); 37 virtual void setUpperLimit(double); 38 /// Tolerance to reach _endTime (default: 1e-6) 39 virtual double getEndTimeTol(); 40 virtual void setEndTimeTol(double); 41 42 //dense Output 43 virtual bool getDenseOutput(); 44 virtual void setDenseOutput(bool); 45 46 virtual double getATol(); 47 virtual void setATol(double); 48 virtual double getRTol(); 49 virtual void setRTol(double); 50 51 /// Global simulation settings 52 virtual IGlobalSettings* getGlobalSettings(); 53 virtual void load(string); 25 SolverSettings( IGlobalSettings* globalSettings); 26 virtual ~SolverSettings(); 27 /// Initial step size (default: 1e-2) 28 virtual double gethInit(); 29 virtual void sethInit(double); 30 /// Lower limit for step size during integration (default: should be machine precision) 31 virtual double getLowerLimit(); 32 virtual void setLowerLimit(double); 33 /// Upper limit for step size during integration (default: _endTime-_startTime) 34 virtual double getUpperLimit(); 35 virtual void setUpperLimit(double); 36 /// Tolerance to reach _endTime (default: 1e-6) 37 virtual double getEndTimeTol(); 38 virtual void setEndTimeTol(double); 39 40 //dense Output 41 virtual bool getDenseOutput(); 42 virtual void setDenseOutput(bool); 43 44 virtual double getATol(); 45 virtual void setATol(double); 46 virtual double getRTol(); 47 virtual void setRTol(double); 48 49 /// Global simulation settings 50 virtual IGlobalSettings* getGlobalSettings(); 51 virtual void load(string); 52 54 53 private: 55 54 double 56 _hInit, ///< Initial step size (default: 1e-2)57 _hLowerLimit, ///< Lower limit for step size during integration (default: should be machine precision)58 _hUpperLimit, ///< Upper limit for step size during integration (default: _endTime-_startTime)59 _endTimeTol, ///< Tolerance to reach _endTime (default: 1e-6)55 _hInit, ///< Initial step size (default: 1e-2) 56 _hLowerLimit, ///< Lower limit for step size during integration (default: should be machine precision) 57 _hUpperLimit, ///< Upper limit for step size during integration (default: _endTime-_startTime) 58 _endTimeTol, ///< Tolerance to reach _endTime (default: 1e-6) 60 59 _dRtol, 61 60 _dAtol; 62 61 IGlobalSettings* 63 _globalSettings; ///< Global simulation settings62 _globalSettings; ///< Global simulation settings 64 63 65 64 bool 66 65 _denseOutput; 67 68 66 }; -
trunk/SimulationRuntime/cpp/Include/Core/Solver/SystemStateSelection.h
r22903 r22981 16 16 { 17 17 public: 18 SystemStateSelection(IMixedSystem* system); 19 20 ~SystemStateSelection(); 21 22 bool stateSelection(int switchStates); 23 void initialize(); 18 SystemStateSelection(IMixedSystem* system); 19 ~SystemStateSelection(); 20 21 bool stateSelection(int switchStates); 22 void initialize(); 24 23 25 24 private: 26 27 int comparePivot(int *oldPivot, int *newPivot, int switchStates, unsigned int index);28 29 30 31 32 33 34 35 36 37 25 void setAMatrix(int* newEnable, unsigned int index); 26 int comparePivot(int* oldPivot, int* newPivot, int switchStates, unsigned int index); 27 28 IMixedSystem* _system; 29 IStateSelection* _state_selection; 30 std::vector<boost::shared_array<int> > _rowPivot; 31 std::vector<boost::shared_array<int> > _colPivot; 32 unsigned int _dimStateSets; 33 std::vector<unsigned int> _dimStates; 34 std::vector<unsigned int> _dimDummyStates; 35 std::vector<unsigned int> _dimStateCanditates; 36 bool _initialized; 38 37 }; 39 -
trunk/SimulationRuntime/cpp/Include/Core/System/EventHandling.h
r22509 r22981 1 1 #pragma once 2 3 2 4 3 /** … … 16 15 //Inits the event variables 17 16 //void initialize(IEvent* system,int dim,init_prevars_type init_prevars); 18 void initialize(IEvent* system,int dim);17 void initialize(IEvent* system, int dim); 19 18 //Returns the help vector 20 19 //void getHelpVars(double* h); … … 24 23 //int getDimHelpVars() const; 25 24 26 27 28 25 //saves a variable in _pre_vars vector 29 void save(double var, string key);26 void save(double var, string key); 30 27 void savePreVars(double vars [], unsigned int n); 31 28 void saveDiscretPreVars(double vars [], unsigned int n); 32 29 //saves all helpvariables 33 30 //void saveH(); 34 31 // void setHelpVar(unsigned int i,double var); 35 32 //const double& operator[](unsigned int i) const; 36 33 //Implementation of the Modelica pre operator 37 double pre(double var, string key);34 double pre(double var, string key); 38 35 //Implementation of the Modelica edge operator 39 bool edge(double var, string key);36 bool edge(double var, string key); 40 37 //Implementation of the Modelica change operator 41 bool change(double var, string key);42 38 bool change(double var, string key); 39 //Adds an event to the eventqueue 43 40 //void addEvent(long index); 44 41 //removes an event from the eventqueue … … 47 44 bool IterateEventQueue(bool& state_vars_reinitialized); 48 45 49 void saveDiscreteVar(double var,string key); 50 bool changeDiscreteVar(double var,string key); 51 46 void saveDiscreteVar(double var, string key); 47 bool changeDiscreteVar(double var, string key); 52 48 53 49 getCondition_type getCondition; 50 54 51 private: 55 52 //Stores all varibales occured before an event … … 62 59 //Dimesion of Helpvarsvector 63 60 //int _dimH; 64 65 66 61 event_times_type _time_events; 62 boost::multi_array<double,1> _pre_vars; 63 boost::multi_array<double,1> _pre_discrete_vars; 67 64 68 69 70 71 65 IContinuous* _countinous_system; //just a cast of _event_system -> required in IterateEventQueue 66 IMixedSystem* _mixed_system; //just a cast of _event_system -> required in IterateEventQueue 67 bool* _conditions0; 68 bool* _conditions1; 72 69 }; -
trunk/SimulationRuntime/cpp/Include/Core/System/IAlgLoop.h
r22276 r22981 16 16 *****************************************************************************/ 17 17 18 19 18 class IAlgLoop 20 19 { … … 23 22 enum CONSTRTYPE 24 23 { 25 UNDEF 24 UNDEF = 0x00000000, 26 25 REAL = 0x00000001, 27 INTEGER 28 BOOLEAN 29 ALL 26 INTEGER = 0x00000002, 27 BOOLEAN = 0x00000004, 28 ALL = 0x00000007, 30 29 }; 30 31 virtual ~IAlgLoop() {}; 31 32 32 33 34 virtual ~IAlgLoop() {}; 35 36 /// Provide number (dimension) of variables according to the data type 37 virtual int getDimReal() const = 0; 38 39 /// Provide number (dimension) of right hand sides (residuals) according to the data type 40 virtual int getDimRHS() const = 0; 41 42 /// (Re-) initialize the system of equations 43 virtual void initialize() = 0; 44 45 /// Provide variables of given data type 46 virtual void getReal(double* lambda) = 0; 47 /// Provide nominal values of given data type 48 virtual void getNominalReal(double* lambda) = 0; 49 /// Set variables with given data type 50 virtual void setReal(const double* lambda) = 0; 51 52 /// Update transfer behavior of the system of equations according to command given by solver 53 virtual void evaluate() = 0; // vxworksupdate 54 55 /// Provide the right hand side (according to the index) 56 virtual void getRHS(double* res) = 0; 57 58 virtual void getSystemMatrix(double* A_matrix) = 0; 59 virtual void getSystemMatrix(sparse_matrix * ) {}; 60 61 virtual bool isLinear() = 0; 62 virtual bool isLinearTearing()=0; 63 virtual bool isConsistent() = 0; 64 65 66 virtual bool getUseSparseFormat() = 0; 67 virtual void setUseSparseFormat(bool value) = 0; 68 virtual float queryDensity() = 0; 69 /*/// Fügt das übergebene Objekt als Across-Kante hinzu 70 void addAcrossEdge(IObject& new_obj); 71 72 /// Fübt das übergebene Objekt als Through-Kante hinzu 73 void addThroughEdge(IObject& new_obj); 74 75 /// Definiert die übergebene Größe als Schnittgröße 76 void addConstraint(double& constr_value); 77 */ 33 /// Provide number (dimension) of variables according to the data type 34 virtual int getDimReal() const = 0; 35 36 /// Provide number (dimension) of right hand sides (residuals) according to the data type 37 virtual int getDimRHS() const = 0; 38 39 /// (Re-) initialize the system of equations 40 virtual void initialize() = 0; 41 42 /// Provide variables of given data type 43 virtual void getReal(double* lambda) = 0; 44 /// Provide nominal values of given data type 45 virtual void getNominalReal(double* lambda) = 0; 46 /// Set variables with given data type 47 virtual void setReal(const double* lambda) = 0; 48 49 /// Update transfer behavior of the system of equations according to command given by solver 50 virtual void evaluate() = 0; // vxworksupdate 51 52 /// Provide the right hand side (according to the index) 53 virtual void getRHS(double* res) = 0; 54 55 virtual void getSystemMatrix(double* A_matrix) = 0; 56 virtual void getSystemMatrix(sparse_matrix * ) {}; 57 58 virtual bool isLinear() = 0; 59 virtual bool isLinearTearing() = 0; 60 virtual bool isConsistent() = 0; 61 62 virtual bool getUseSparseFormat() = 0; 63 virtual void setUseSparseFormat(bool value) = 0; 64 virtual float queryDensity() = 0; 65 /*/// Fügt das übergebene Objekt als Across-Kante hinzu 66 void addAcrossEdge(IObject& new_obj); 67 68 /// Fübt das übergebene Objekt als Through-Kante hinzu 69 void addThroughEdge(IObject& new_obj); 70 71 /// Definiert die übergebene Größe als Schnittgröße 72 void addConstraint(double& constr_value); 73 */ 78 74 }; 79 75 -
trunk/SimulationRuntime/cpp/Include/Core/System/IContinuous.h
r22917 r22981 1 1 #pragma once 2 3 4 2 5 3 /*****************************************************************************/ … … 15 13 Copyright (c) 2008, OSMC 16 14 *****************************************************************************/ 15 17 16 class IContinuous 18 17 { 19 18 public: 20 21 22 19 /// Enumeration to control the evaluation of equations within the system 23 20 enum UPDATETYPE 24 21 { 25 UNDEF_UPDATE =0x00000000,26 ACROSS =0x00000001,27 THROUGH =0x00000002,28 ALL =0x00000003,29 DISCRETE = 0x00000004,30 CONTINUOUS = 0x00000008,31 RANKING =0x00000016 ///< Ranking Method22 UNDEF_UPDATE = 0x00000000, 23 ACROSS = 0x00000001, 24 THROUGH = 0x00000002, 25 ALL = 0x00000003, 26 DISCRETE = 0x00000004, 27 CONTINUOUS = 0x00000008, 28 RANKING = 0x00000016 ///< Ranking Method 32 29 }; 33 34 35 30 36 31 virtual ~IContinuous() {}; … … 54 49 virtual int getDimRHS() const = 0; 55 50 56 57 58 59 51 /// Provide boolean variables 60 52 virtual void getBoolean(bool* z) = 0; … … 62 54 /// Provide boolean variables 63 55 virtual void getContinuousStates(double* z) = 0; 64 virtual void getNominalStates(double* z) 56 virtual void getNominalStates(double* z) = 0 ; 65 57 /// Provide integer variables 66 58 virtual void getInteger(int* z) = 0; … … 74 66 /// Provide the right hand side 75 67 virtual void getRHS(double* f) = 0; 76 77 78 79 80 68 81 69 /// Provide boolean variables … … 97 85 virtual void setRHS(const double* f) = 0; 98 86 99 100 101 102 87 /// Update transfer behavior of the system of equations according to command given by solver 103 88 104 89 virtual bool evaluateAll(const UPDATETYPE command = UNDEF_UPDATE) = 0; // vxworks 105 90 virtual void evaluateODE(const UPDATETYPE command = UNDEF_UPDATE) = 0; // vxworks 106 virtual void evaluateZeroFuncs(const UPDATETYPE command = UNDEF_UPDATE) = 0;107 virtual bool evaluateConditions(const UPDATETYPE command = UNDEF_UPDATE) = 0;91 virtual void evaluateZeroFuncs(const UPDATETYPE command = UNDEF_UPDATE) = 0; 92 virtual bool evaluateConditions(const UPDATETYPE command = UNDEF_UPDATE) = 0; 108 93 109 94 virtual bool stepCompleted(double time) = 0; 110 95 virtual bool stepStarted(double time) = 0; 111 112 96 }; 113 97 … … 117 101 enum INDEX 118 102 { 119 UNDEF_INDEX 120 VAR_INDEX0 121 VAR_INDEX1 122 VAR_INDEX2 123 VAR_INDEX3 124 DIFF_INDEX3 125 DIFF_INDEX2 126 DIFF_INDEX1 127 ALL_RESIDUES 128 ALL_STATES 129 ALL_VARS 103 UNDEF_INDEX = 0x00000, 104 VAR_INDEX0 = 0x00001, ///< Variable Index 0 (States of systems of 1st order) 105 VAR_INDEX1 = 0x00002, ///< Variable Index 1 (1st order States of systems of 2nd order, e.g. positions) 106 VAR_INDEX2 = 0x00004, ///< Variable Index 2 (2nd order States of systems of 2nd order, e.g. velocities) 107 VAR_INDEX3 = 0x00038, ///< Variable Index 3 (all constraints) 108 DIFF_INDEX3 = 0x00008, ///< Differentiation Index 3 (constraints on position level only) 109 DIFF_INDEX2 = 0x00010, ///< Differentiation Index 2 (constraints on velocity level only) 110 DIFF_INDEX1 = 0x00020, ///< Differentiation Index 1 (constraints on acceleration level only) 111 ALL_RESIDUES = 0x00040, ///< All residues 112 ALL_STATES = 0x00007, ///< All states (no order) 113 ALL_VARS = 0x0003f, ///< All variables (no order) 130 114 }; 131 115 */ -
trunk/SimulationRuntime/cpp/Include/Core/System/ICoupledSystem.h
r22024 r22981 1 1 #pragma once 2 2 #include <Core/Object/IObject.h> 3 3 4 class ICoupledSystem 4 5 { 5 6 public: 6 7 virtual void addAcross(IObject&)=0; 8 virtual void addThrough(IObject&)=0; 7 virtual void addAcross(IObject&) = 0; 8 virtual void addThrough(IObject&) = 0; 9 9 }; -
trunk/SimulationRuntime/cpp/Include/Core/System/IEvent.h
r22509 r22981 1 1 #pragma once 2 3 2 4 3 /*****************************************************************************/ … … 20 19 { 21 20 public: 22 23 21 virtual ~IEvent() {}; 24 22 … … 28 26 virtual void getZeroFunc(double* f) = 0; 29 27 30 virtual void setConditions(bool* c) = 0;31 virtual void getConditions(bool* c) =0;28 virtual void setConditions(bool* c) = 0; 29 virtual void getConditions(bool* c) = 0; 32 30 virtual void saveDiscreteVars() = 0; 33 31 /// Called to handle an event … … 36 34 virtual bool checkForDiscreteEvents() = 0; 37 35 virtual bool getCondition(unsigned int index) = 0; 38 36 virtual void initPreVars(unordered_map<string,unsigned int>&,unordered_map<string,unsigned int>&)= 0; 39 37 }; 40 -
trunk/SimulationRuntime/cpp/Include/Core/System/IStateSelection.h
r21829 r22981 8 8 { 9 9 public: 10 11 virtual ~IStateSelection() {}; 12 virtual int getDimStateSets() const = 0; 13 virtual int getDimStates(unsigned int index) const = 0; 14 virtual int getDimCanditates(unsigned int index) const = 0; 15 virtual int getDimDummyStates(unsigned int index) const = 0; 16 virtual void getStates(unsigned int index,double* z) = 0; 17 virtual void setStates(unsigned int index,const double* z) = 0; 18 virtual void getStateCanditates(unsigned int index,double* z) = 0; 19 virtual bool getAMatrix(unsigned int index,DynArrayDim2<int> & A) =0 ; 20 virtual void setAMatrix(unsigned int index,DynArrayDim2<int>& A)=0; 21 virtual bool getAMatrix(unsigned int index,DynArrayDim1<int> & A) =0 ; 22 virtual void setAMatrix(unsigned int index,DynArrayDim1<int>& A)=0; 10 virtual ~IStateSelection() {}; 11 virtual int getDimStateSets() const = 0; 12 virtual int getDimStates(unsigned int index) const = 0; 13 virtual int getDimCanditates(unsigned int index) const = 0; 14 virtual int getDimDummyStates(unsigned int index) const = 0; 15 virtual void getStates(unsigned int index, double* z) = 0; 16 virtual void setStates(unsigned int index, const double* z) = 0; 17 virtual void getStateCanditates(unsigned int index, double* z) = 0; 18 virtual bool getAMatrix(unsigned int index, DynArrayDim2<int> & A) = 0 ; 19 virtual void setAMatrix(unsigned int index, DynArrayDim2<int>& A) = 0; 20 virtual bool getAMatrix(unsigned int index, DynArrayDim1<int> & A) = 0 ; 21 virtual void setAMatrix(unsigned int index, DynArrayDim1<int>& A) = 0; 23 22 }; -
trunk/SimulationRuntime/cpp/Include/Core/System/IStepEvent.h
r22362 r22981 2 2 class IStepEvent 3 3 { 4 public: 5 6 virtual ~IStepEvent(){}; 7 virtual bool isStepEvent() = 0; 8 //sets the initial status 9 virtual void setTerminal(bool) = 0; 10 //returns the intial status 11 virtual bool terminal() = 0; 4 public: 5 virtual ~IStepEvent(){}; 6 virtual bool isStepEvent() = 0; 7 //sets the initial status 8 virtual void setTerminal(bool) = 0; 9 //returns the intial status 10 virtual bool terminal() = 0; 12 11 }; 13 12 -
trunk/SimulationRuntime/cpp/Include/Core/System/ISystemInitialization.h
r20164 r22981 16 16 { 17 17 public: 18 19 virtual ~ISystemInitialization() {}; 20 21 22 23 24 /// (Re-) initialize the system of equations and bounded parameters 25 virtual void initialize() = 0; 26 virtual void initEquations() = 0; 27 //sets the initial status 28 virtual void setInitial(bool) = 0; 29 //returns the intial status 30 virtual bool initial() = 0; 31 32 18 virtual ~ISystemInitialization() {}; 19 /// (Re-) initialize the system of equations and bounded parameters 20 virtual void initialize() = 0; 21 virtual void initEquations() = 0; 22 //sets the initial status 23 virtual void setInitial(bool) = 0; 24 //returns the intial status 25 virtual bool initial() = 0; 33 26 }; -
trunk/SimulationRuntime/cpp/Include/Core/System/ISystemProperties.h
r20164 r22981 13 13 Copyright (c) 2008, OSMC 14 14 *****************************************************************************/ 15 15 16 class ISystemProperties 16 17 { 17 18 public: 18 19 virtual ~ISystemProperties() {}; 20 21 /// M is regular 22 virtual bool isODE() /*const*/ = 0; 23 24 /// M is singular 25 virtual bool isAlgebraic() /*const*/ = 0; 26 27 /// System is able to provide the Jacobian symbolically 28 virtual bool provideSymbolicJacobian() /*const*/ = 0; 19 virtual ~ISystemProperties() {}; 20 21 /// M is regular 22 virtual bool isODE() /*const*/ = 0; 23 24 /// M is singular 25 virtual bool isAlgebraic() /*const*/ = 0; 26 27 /// System is able to provide the Jacobian symbolically 28 virtual bool provideSymbolicJacobian() /*const*/ = 0; 29 29 }; -
trunk/SimulationRuntime/cpp/Include/Core/System/ITime.h
r21582 r22981 1 2 1 #pragma once 3 2 typedef std::vector<std::pair<double,double> > time_event_type; 3 4 4 class ITime 5 5 { 6 6 public: 7 8 virtual ~ITime() {}; 9 virtual int getDimTimeEvent() const = 0; 10 //gibt die Time events (Startzeit und Frequenz) zurück 11 virtual void getTimeEvent(time_event_type& time_events) = 0; 12 //Wird vom Solver zur Behandlung der Time events aufgerufen (wenn zero_sign[i] = 0 kein time event,zero_sign[i] = n Anzahl von vorgekommen time events ) 13 virtual void handleTimeEvent(int* time_events) = 0; 14 /// Set current integration time 15 virtual void setTime(const double& time) = 0; 7 virtual ~ITime() {}; 8 virtual int getDimTimeEvent() const = 0; 9 //gibt die Time events (Startzeit und Frequenz) zurück 10 virtual void getTimeEvent(time_event_type& time_events) = 0; 11 //Wird vom Solver zur Behandlung der Time events aufgerufen (wenn zero_sign[i] = 0 kein time event,zero_sign[i] = n Anzahl von vorgekommen time events ) 12 virtual void handleTimeEvent(int* time_events) = 0; 13 /// Set current integration time 14 virtual void setTime(const double& time) = 0; 16 15 }; -
trunk/SimulationRuntime/cpp/Include/Core/System/IWriteOutput.h
r20164 r22981 1 1 #pragma once 2 3 2 4 3 class IHistory; … … 6 5 { 7 6 public: 8 9 7 /// Enumeration to control the output 10 8 enum OUTPUT 11 9 { 12 UNDEF_OUTPUT = 0x00000000, 10 UNDEF_OUTPUT = 0x00000000, 11 WRITEOUT = 0x00000001, ///< vxworks! Store current position of curser and write out current results 12 RESET = 0x00000002, ///< Reset curser position 13 OVERWRITE = 0x00000003, ///< RESET|WRITE 14 HEAD_LINE = 0x00000010, ///< Write out head line 15 RESULTS = 0x00000020, ///< Write out results 16 SIMINFO = 0x00000040 ///< Write out simulation info (e.g. number of steps) 17 }; 13 18 14 WRITEOUT = 0x00000001, ///< vxworks! Store current position of curser and write out current results 15 RESET = 0x00000002, ///< Reset curser position 16 OVERWRITE = 0x00000003, ///< RESET|WRITE 17 18 19 HEAD_LINE = 0x00000010, ///< Write out head line 20 RESULTS = 0x00000020, ///< Write out results 21 SIMINFO = 0x00000040 ///< Write out simulation info (e.g. number of steps) 22 }; 23 24 virtual ~IWriteOutput() {}; 25 /// Output routine (to be called by the solver after every successful integration step) 26 virtual void writeOutput(const OUTPUT command = UNDEF_OUTPUT) = 0; 27 virtual IHistory* getHistory()=0; 28 29 30 19 virtual ~IWriteOutput() {}; 20 21 /// Output routine (to be called by the solver after every successful integration step) 22 virtual void writeOutput(const OUTPUT command = UNDEF_OUTPUT) = 0; 23 virtual IHistory* getHistory() = 0; 31 24 }; -
trunk/SimulationRuntime/cpp/Include/Core/System/SystemDefaultImplementation.h
r22401 r22981 45 45 }; 46 46 47 48 47 class BOOST_EXTENSION_SYSTEM_DECL SystemDefaultImplementation 49 48 { 50 49 public: 51 50 SystemDefaultImplementation(IGlobalSettings* globalSettings); 52 53 51 virtual ~SystemDefaultImplementation(); 54 55 56 52 57 53 /// Provide number (dimension) of boolean variables … … 74 70 75 71 76 77 78 /// Provide boolean variables 79 virtual void getBoolean(bool* z); 80 81 /// Provide boolean variables 82 virtual void getContinuousStates(double* z); 83 84 /// Provide integer variables 85 virtual void getInteger(int* z); 86 87 /// Provide real variables 88 virtual void getReal(double* z); 89 90 /// Provide real variables 91 virtual void getString(std::string* z); 92 93 /// Provide the right hand side 94 virtual void getRHS(double* f); 95 96 virtual void setConditions(bool* c); 97 virtual void getConditions(bool* c); 98 /// Provide boolean variables 99 virtual void setBoolean(const bool* z); 100 101 /// Provide boolean variables 102 virtual void setContinuousStates(const double* z); 103 104 /// Provide integer variables 105 virtual void setInteger(const int* z); 106 107 /// Provide real variables 108 virtual void setReal(const double* z); 109 110 /// Provide real variables 111 virtual void setString(const std::string* z); 112 113 /// Provide the right hand side 114 virtual void setRHS(const double* f); 115 116 117 118 /// (Re-) initialize the system of equations 119 void initialize(); 120 /// Set current integration time 121 void setTime(const double& t); 72 /// Provide boolean variables 73 virtual void getBoolean(bool* z); 74 75 /// Provide boolean variables 76 virtual void getContinuousStates(double* z); 77 78 /// Provide integer variables 79 virtual void getInteger(int* z); 80 81 /// Provide real variables 82 virtual void getReal(double* z); 83 84 /// Provide real variables 85 virtual void getString(std::string* z); 86 87 /// Provide the right hand side 88 virtual void getRHS(double* f); 89 90 virtual void setConditions(bool* c); 91 virtual void getConditions(bool* c); 92 /// Provide boolean variables 93 virtual void setBoolean(const bool* z); 94 95 /// Provide boolean variables 96 virtual void setContinuousStates(const double* z); 97 98 /// Provide integer variables 99 virtual void setInteger(const int* z); 100 101 /// Provide real variables 102 virtual void setReal(const double* z); 103 104 /// Provide real variables 105 virtual void setString(const std::string* z); 106 107 /// Provide the right hand side 108 virtual void setRHS(const double* f); 109 110 /// (Re-) initialize the system of equations 111 void initialize(); 112 /// Set current integration time 113 void setTime(const double& t); 122 114 123 115 protected: 124 void Assert(bool cond, const string& msg); 125 void Terminate(string msg); 126 void intDelay(vector<unsigned int> expr,vector<double> delay_max); 127 void storeDelay(unsigned int expr_id,double expr_value,double time); 128 void storeTime(double time); 129 double delay(unsigned int expr_id,double expr_value, double delayTime, double delayMax); 130 bool isConsistent(); 131 116 void Assert(bool cond, const string& msg); 117 void Terminate(string msg); 118 void intDelay(vector<unsigned int> expr,vector<double> delay_max); 119 void storeDelay(unsigned int expr_id,double expr_value,double time); 120 void storeTime(double time); 121 double delay(unsigned int expr_id,double expr_value, double delayTime, double delayMax); 122 bool isConsistent(); 132 123 133 124 double getRealStartValue(string key); 134 bool 135 int 125 bool getBoolStartValue(string key); 126 int getIntStartValue(string key); 136 127 void setRealStartValue(double& var,double val,string key); 137 128 void setBoolStartValue(bool& var,bool val, string key); … … 139 130 140 131 double 141 _simTime; ///< current simulation time (given by the solver)132 _simTime; ///< current simulation time (given by the solver) 142 133 143 134 double 144 *__z, ///< "Extended state vector", containing all states and algebraic variables of all types145 *__zDot; ///< "Extended vector of derivatives", containing all right hand sides of differential and algebraic equations135 *__z, ///< "Extended state vector", containing all states and algebraic variables of all types 136 *__zDot; ///< "Extended vector of derivatives", containing all right hand sides of differential and algebraic equations 146 137 bool 147 * _conditions, ///< External conditions changed by the solver138 * _conditions, ///< External conditions changed by the solver 148 139 * _time_conditions; 149 140 150 141 int 151 152 _dimRHS,///< Dimension der rechten Seite153 _dimReal,///< Anzahl der reelwertigen Variablen154 _dimInteger,///< Anzahl der integerwertigen Variablen155 _dimBoolean,///< Anzahl der boolwertigen Variablen156 _dimString,///< Anzahl der stringwertigen Variablen157 _dimZeroFunc,///< Dimension (=Anzahl) Nullstellenfunktion158 _dimTimeEvent,///< Dimension (=Anzahl) Time event (start zeit und frequenz)159 _dimAE;///< Number (dimension) of algebraic equations (e.g. constraints from an algebraic loop)142 _dimContinuousStates, 143 _dimRHS, ///< Dimension der rechten Seite 144 _dimReal, ///< Anzahl der reelwertigen Variablen 145 _dimInteger, ///< Anzahl der integerwertigen Variablen 146 _dimBoolean, ///< Anzahl der boolwertigen Variablen 147 _dimString, ///< Anzahl der stringwertigen Variablen 148 _dimZeroFunc, ///< Dimension (=Anzahl) Nullstellenfunktion 149 _dimTimeEvent, ///< Dimension (=Anzahl) Time event (start zeit und frequenz) 150 _dimAE; ///< Number (dimension) of algebraic equations (e.g. constraints from an algebraic loop) 160 151 161 152 int 162 163 153 * _time_event_counter; 154 std::ostream *_outputStream; ///< Output stream for results 164 155 165 IContinuous::UPDATETYPE _callType; 166 156 IContinuous::UPDATETYPE _callType; 167 157 168 158 bool _initial; … … 175 165 InitVars<bool> _bool_start_values; 176 166 177 178 167 EventHandling _event_handling; 179 168 … … 183 172 double _delay_max; 184 173 double _start_time; 185 IGlobalSettings* 174 IGlobalSettings* _global_settings; //this should be a reference, but this is not working if the libraries are linked statically 186 175 }; 187 176 -
trunk/SimulationRuntime/cpp/Include/SimCoreFactory/OMCFactory/OMCFactory.h
r21582 r22981 9 9 class ISimController; 10 10 struct SimSettings; 11 11 12 class OMCFactory 12 13 { 13 14 public: 14 15 OMCFactory(); 15 OMCFactory(PATH library_path, PATH modelicasystem_path); 16 virtual ~OMCFactory(); 17 void UnloadAllLibs(void); 18 LOADERRESULT LoadLibrary(string libName,type_map& current_map); 19 LOADERRESULT UnloadLibrary(shared_library lib); 16 OMCFactory(PATH library_path, PATH modelicasystem_path); 17 virtual ~OMCFactory(); 18 19 void UnloadAllLibs(void); 20 LOADERRESULT LoadLibrary(string libName, type_map& current_map); 21 LOADERRESULT UnloadLibrary(shared_library lib); 22 23 virtual std::pair<boost::shared_ptr<ISimController>,SimSettings> createSimulation(int argc, const char* argv[]); 20 24 21 virtual std::pair<boost::shared_ptr<ISimController>,SimSettings> createSimulation(int argc, const char* argv[]); 22 23 protected: 24 25 SimSettings ReadSimulationParameter(int argc, const char* argv[]); 26 //boost::shared_ptr<ISimController> _simController; 27 std::map<string,shared_library> _modules; 28 PATH _library_path; 29 PATH _modelicasystem_path; 25 protected: 26 SimSettings ReadSimulationParameter(int argc, const char* argv[]); 27 //boost::shared_ptr<ISimController> _simController; 28 std::map<string,shared_library> _modules; 29 PATH _library_path; 30 PATH _modelicasystem_path; 30 31 }; 31 32 -
trunk/SimulationRuntime/cpp/Include/SimCoreFactory/OMCFactory/StaticOMCFactory.h
r21929 r22981 11 11 public: 12 12 StaticOMCFactory(); 13 StaticOMCFactory(PATH library_path, PATH modelicasystem_path); 13 StaticOMCFactory(PATH library_path, PATH modelicasystem_path); 14 virtual ~StaticOMCFactory(); 14 15 15 virtual ~StaticOMCFactory(); 16 17 virtual std::pair<boost::shared_ptr<ISimController>,SimSettings> createSimulation(int argc, const char* argv[]); 16 virtual std::pair<boost::shared_ptr<ISimController>, SimSettings> createSimulation(int argc, const char* argv[]); 18 17 }; -
trunk/SimulationRuntime/cpp/Include/SimCoreFactory/ObjectFactory.h
r22573 r22981 3 3 #include <SimCoreFactory/Policies/FactoryConfig.h> 4 4 #endif 5 5 6 template<class T> 6 7 struct ObjectFactory 7 8 { 8 ObjectFactory(PATH library_path,PATH modelicasystem_path,PATH config_path)9 : _library_path(library_path)10 , _modelicasystem_path(modelicasystem_path)11 , _config_path(config_path)9 ObjectFactory(PATH library_path, PATH modelicasystem_path, PATH config_path) 10 : _library_path(library_path) 11 , _modelicasystem_path(modelicasystem_path) 12 , _config_path(config_path) 12 13 { 13 _factory = boost::shared_ptr<T>(new T(library_path,modelicasystem_path)); 14 } 15 virtual ~ObjectFactory() {}; 16 protected: 17 boost::shared_ptr<T> _factory; 14 _factory = boost::shared_ptr<T>(new T(library_path, modelicasystem_path)); 15 } 16 17 virtual ~ObjectFactory() {}; 18 19 protected: 20 boost::shared_ptr<T> _factory; 18 21 PATH _library_path; 19 22 PATH _modelicasystem_path; -
trunk/SimulationRuntime/cpp/Include/SimCoreFactory/Policies/FactoryConfig.h
r22917 r22981 30 30 #include <boost/filesystem/operations.hpp> 31 31 #include <boost/filesystem/path.hpp> 32 33 34 32 #include <boost/unordered_map.hpp> 35 33 -
trunk/SimulationRuntime/cpp/Include/SimCoreFactory/Policies/FactoryPolicy.h
r22905 r22981 24 24 #include <SimCoreFactory/Policies/SystemBodasFactory.h> 25 25 #include <SimCoreFactory/Policies/NonLinSolverBodasFactory.h> 26 26 #include <SimCoreFactory/Policies/LinSolverBodasFactory.h> 27 27 /*Policy defines*/ 28 28 typedef SystemBodasFactory<BodasFactory> SimControllerPolicy; … … 40 40 #include <SimCoreFactory/Policies/SystemFactory.h> 41 41 #include <SimCoreFactory/Policies/NonLinSolverFactory.h> 42 42 #include <SimCoreFactory/Policies/LinSolverFactory.h> 43 43 /*Policy defines*/ 44 44 typedef SystemFactory<GenericFactory> SimControllerPolicy; … … 47 47 typedef NonLinSolverFactory<GenericFactory> NonLinSolverPolicy; 48 48 typedef SolverSettingsFactory<GenericFactory> SolverSettingsPolicy; 49 49 typedef LinSolverFactory<GenericFactory> LinSolverPolicy; 50 50 51 51 #elif defined(OMC_BUILD) && !defined(ANALYZATION_MODE) -
trunk/SimulationRuntime/cpp/Include/SimCoreFactory/Policies/LinSolverOMCFactory.h
r21932 r22981 7 7 */ 8 8 template<class CreationPolicy> 9 struct LinSolverOMCFactory : virtual public ObjectFactory<CreationPolicy> { 9 struct LinSolverOMCFactory : virtual public ObjectFactory<CreationPolicy> 10 { 11 public: 12 LinSolverOMCFactory(PATH library_path, PATH modelicasystem_path, PATH config_path) 13 : ObjectFactory<CreationPolicy>(library_path, modelicasystem_path, config_path) 14 , _last_selected_solver("empty") 15 { 16 _linsolver_type_map = new type_map(); 17 } 18 virtual ~LinSolverOMCFactory() 19 { 20 delete _linsolver_type_map; 21 // ObjectFactory<CreationPolicy>::_factory->UnloadAllLibs(); todo solver lib wird in linsolver factory entlanden 22 } 10 23 11 public: 12 LinSolverOMCFactory(PATH library_path, PATH modelicasystem_path,PATH config_path) 13 :ObjectFactory<CreationPolicy>(library_path,modelicasystem_path,config_path) 14 ,_last_selected_solver("empty") 15 { 16 _linsolver_type_map = new type_map(); 17 } 18 virtual ~LinSolverOMCFactory() 19 { 20 delete _linsolver_type_map; 21 // ObjectFactory<CreationPolicy>::_factory->UnloadAllLibs(); todo solver lib wird in linsolver factory entlanden 22 } 24 virtual boost::shared_ptr<ILinSolverSettings> createLinSolverSettings(string lin_solver) 25 { 26 string lin_solver_key; 23 27 24 virtual boost::shared_ptr<ILinSolverSettings> createLinSolverSettings(string lin_solver) 25 { 26 string lin_solver_key; 27 28 if(lin_solver.compare("umfpack")==0) 28 if(lin_solver.compare("umfpack") == 0) 29 29 { 30 31 30 PATH umfpack_path = ObjectFactory<CreationPolicy>::_library_path; 32 31 PATH umfpack_name(UMFPACK_LIB); … … 42 41 throw std::invalid_argument("Selected linear solver is not available"); 43 42 44 _last_selected_solver = 43 _last_selected_solver = lin_solver; 45 44 string linsolversettings = lin_solver.append("Settings"); 46 45 std::map<std::string, factory<ILinSolverSettings> >::iterator iter; … … 51 50 throw std::invalid_argument("No such linear solver Settings"); 52 51 } 53 boost::shared_ptr<ILinSolverSettings> linsolversetting = boost::shared_ptr<ILinSolverSettings>(iter->second.create());52 boost::shared_ptr<ILinSolverSettings> linsolversetting = boost::shared_ptr<ILinSolverSettings>(iter->second.create()); 54 53 return linsolversetting; 55 54 } 56 55 57 virtual boost::shared_ptr<IAlgLoopSolver> createLinSolver(IAlgLoop* algLoop, string solver_name, boost::shared_ptr<ILinSolverSettings>solver_settings)58 59 if(_last_selected_solver.compare(solver_name)==0)60 56 virtual boost::shared_ptr<IAlgLoopSolver> createLinSolver(IAlgLoop* algLoop, string solver_name, boost::shared_ptr<ILinSolverSettings> solver_settings) 57 { 58 if(_last_selected_solver.compare(solver_name) == 0) 59 { 61 60 std::map<std::string, factory<IAlgLoopSolver,IAlgLoop*, ILinSolverSettings*> >::iterator iter; 62 61 std::map<std::string, factory<IAlgLoopSolver,IAlgLoop*, ILinSolverSettings*> >& linSolverFactory(_linsolver_type_map->get()); … … 69 68 70 69 return solver; 71 72 70 } 71 else 73 72 throw std::invalid_argument("Selected linear solver is not available"); 74 } 73 } 74 75 75 protected: 76 string _last_selected_solver; 76 string _last_selected_solver; 77 77 78 private: 78 79 type_map* _linsolver_type_map; -
trunk/SimulationRuntime/cpp/Include/SimCoreFactory/Policies/StaticSystemOMCFactory.h
r22024 r22981 13 13 { 14 14 public: 15 StaticSystemOMCFactory(PATH library_path,PATH modelicasystem_path,PATH config_path) 16 :SystemOMCFactory<CreationPolicy>(library_path,modelicasystem_path,config_path) 17 { 15 StaticSystemOMCFactory(PATH library_path, PATH modelicasystem_path, PATH config_path) 16 :SystemOMCFactory<CreationPolicy>(library_path, modelicasystem_path, config_path) 17 { 18 } 18 19 19 } 20 virtual ~StaticSystemOMCFactory() 21 { 22 } 20 23 21 virtual ~StaticSystemOMCFactory() 22 { 23 } 24 25 virtual boost::shared_ptr<IAlgLoopSolverFactory> createAlgLoopSolverFactory(IGlobalSettings* globalSettings) 26 { 27 boost::shared_ptr<IAlgLoopSolverFactory> algloopsolverfactory = boost::shared_ptr<IAlgLoopSolverFactory>(new AlgLoopSolverFactory(globalSettings,ObjectFactory<CreationPolicy>::_library_path,ObjectFactory<CreationPolicy>::_modelicasystem_path)); 28 return algloopsolverfactory; 29 } 24 virtual boost::shared_ptr<IAlgLoopSolverFactory> createAlgLoopSolverFactory(IGlobalSettings* globalSettings) 25 { 26 boost::shared_ptr<IAlgLoopSolverFactory> algloopsolverfactory = boost::shared_ptr<IAlgLoopSolverFactory>(new AlgLoopSolverFactory(globalSettings, ObjectFactory<CreationPolicy>::_library_path, ObjectFactory<CreationPolicy>::_modelicasystem_path)); 27 return algloopsolverfactory; 28 } 30 29 31 30 protected: 32 virtual void initializeLibraries(PATH library_path,PATH modelicasystem_path,PATH config_path)33 34 31 virtual void initializeLibraries(PATH library_path, PATH modelicasystem_path, PATH config_path) 32 { 33 } 35 34 }; -
trunk/SimulationRuntime/cpp/Include/SimCoreFactory/Policies/SystemOMCFactory.h
r21584 r22981 9 9 10 10 public: 11 12 13 14 15 11 SystemOMCFactory(PATH library_path,PATH modelicasystem_path,PATH config_path) 12 :ObjectFactory<CreationPolicy>(library_path,modelicasystem_path,config_path) 13 { 14 _use_modelica_compiler = false; 15 _system_type_map = new type_map(); 16 16 #ifndef ANALYZATION_MODE 17 17 initializeLibraries(library_path, modelicasystem_path, config_path); 18 18 #endif 19 19 } 20 20 21 virtual ~SystemOMCFactory() 22 { 23 delete _system_type_map; 24 ObjectFactory<CreationPolicy>::_factory->UnloadAllLibs(); 21 virtual ~SystemOMCFactory() 22 { 23 delete _system_type_map; 24 ObjectFactory<CreationPolicy>::_factory->UnloadAllLibs(); 25 } 25 26 26 } 27 virtual boost::shared_ptr<IAlgLoopSolverFactory> createAlgLoopSolverFactory(IGlobalSettings* globalSettings) 28 { 29 std::map<std::string, factory<IAlgLoopSolverFactory,IGlobalSettings*,PATH,PATH> >::iterator iter; 30 std::map<std::string, factory<IAlgLoopSolverFactory,IGlobalSettings*,PATH,PATH> >& algloopsolver_factory(_system_type_map->get()); 31 iter = algloopsolver_factory.find("AlgLoopSolverFactory"); 32 if (iter ==algloopsolver_factory.end()) 33 { 34 throw std::invalid_argument("No AlgLoopSolverFactory found"); 35 } 36 boost::shared_ptr<IAlgLoopSolverFactory> algloopsolverfactory = boost::shared_ptr<IAlgLoopSolverFactory>(iter->second.create(globalSettings,ObjectFactory<CreationPolicy>::_library_path,ObjectFactory<CreationPolicy>::_modelicasystem_path)); 27 37 28 virtual boost::shared_ptr<IAlgLoopSolverFactory> createAlgLoopSolverFactory(IGlobalSettings* globalSettings) 29 { 30 std::map<std::string, factory<IAlgLoopSolverFactory,IGlobalSettings*,PATH,PATH> >::iterator iter; 31 std::map<std::string, factory<IAlgLoopSolverFactory,IGlobalSettings*,PATH,PATH> >& algloopsolver_factory(_system_type_map->get()); 32 iter = algloopsolver_factory.find("AlgLoopSolverFactory"); 33 if (iter ==algloopsolver_factory.end()) 34 { 35 throw std::invalid_argument("No AlgLoopSolverFactory found"); 36 } 37 boost::shared_ptr<IAlgLoopSolverFactory> algloopsolverfactory = boost::shared_ptr<IAlgLoopSolverFactory>(iter->second.create(globalSettings,ObjectFactory<CreationPolicy>::_library_path,ObjectFactory<CreationPolicy>::_modelicasystem_path)); 38 return algloopsolverfactory; 39 } 38 40 39 return algloopsolverfactory; 40 } 41 virtual std::pair<boost::shared_ptr<IMixedSystem>, boost::shared_ptr<ISimData> > createSystem(boost::shared_ptr<ISimData> (*createSimDataCallback)(), boost::shared_ptr<IMixedSystem> (*createSystemCallback)(IGlobalSettings*, boost::shared_ptr<IAlgLoopSolverFactory>, boost::shared_ptr<ISimData>), IGlobalSettings* globalSettings,boost::shared_ptr<IAlgLoopSolverFactory> algloopsolverfactory) 42 { 43 boost::shared_ptr<ISimData> simData = createSimDataCallback(); 44 boost::shared_ptr<IMixedSystem> system = createSystemCallback(globalSettings, algloopsolverfactory, simData); 45 return std::make_pair(system,simData); 46 } 41 47 42 virtual std::pair<boost::shared_ptr<IMixedSystem>,boost::shared_ptr<ISimData> > createSystem(boost::shared_ptr<ISimData> (*createSimDataCallback)(), boost::shared_ptr<IMixedSystem> (*createSystemCallback)(IGlobalSettings*, boost::shared_ptr<IAlgLoopSolverFactory>, boost::shared_ptr<ISimData>), IGlobalSettings* globalSettings,boost::shared_ptr<IAlgLoopSolverFactory> algloopsolverfactory) 43 { 44 boost::shared_ptr<ISimData> simData = createSimDataCallback(); 45 boost::shared_ptr<IMixedSystem> system = createSystemCallback(globalSettings, algloopsolverfactory, simData); 46 return std::make_pair(system,simData); 47 } 48 std::pair<boost::shared_ptr<IMixedSystem>, boost::shared_ptr<ISimData> > createSystem(string modelLib,string modelKey,IGlobalSettings* globalSettings,boost::shared_ptr<IAlgLoopSolverFactory> algloopsolverfactory) 49 { 50 PATH modelica_path = ObjectFactory<CreationPolicy>::_modelicasystem_path; 51 PATH modelica_name(modelLib); 52 modelica_path/=modelica_name; 53 LOADERRESULT result = ObjectFactory<CreationPolicy>::_factory->LoadLibrary(modelica_path.string(),*_system_type_map); 54 if (result != LOADER_SUCCESS) 55 { 56 std::stringstream tmp; 57 tmp << "Failed loading System library!" << std::endl << modelica_path.string(); 58 throw std::runtime_error(tmp.str()); 59 } 48 60 49 std::pair<boost::shared_ptr<IMixedSystem>,boost::shared_ptr<ISimData> > createSystem(string modelLib,string modelKey,IGlobalSettings* globalSettings,boost::shared_ptr<IAlgLoopSolverFactory> algloopsolverfactory) 50 { 51 PATH modelica_path = ObjectFactory<CreationPolicy>::_modelicasystem_path; 52 PATH modelica_name(modelLib); 53 modelica_path/=modelica_name; 54 LOADERRESULT result = ObjectFactory<CreationPolicy>::_factory->LoadLibrary(modelica_path.string(),*_system_type_map); 55 if (result != LOADER_SUCCESS) 56 { 57 std::stringstream tmp; 58 tmp << "Failed loading System library!" << std::endl << modelica_path.string(); 59 throw std::runtime_error(tmp.str()); 60 } 61 std::map<std::string, factory<IMixedSystem, IGlobalSettings*, boost::shared_ptr<IAlgLoopSolverFactory>, boost::shared_ptr<ISimData> > >::iterator system_iter; 62 std::map<std::string, factory<IMixedSystem, IGlobalSettings*, boost::shared_ptr<IAlgLoopSolverFactory>, boost::shared_ptr<ISimData> > >& factories(_system_type_map->get()); 63 system_iter = factories.find(modelKey); 64 if (system_iter == factories.end()) 65 { 66 throw std::invalid_argument("No system found"); 67 } 61 68 62 std::map<std::string, factory<IMixedSystem,IGlobalSettings*,boost::shared_ptr<IAlgLoopSolverFactory>, boost::shared_ptr<ISimData> > >::iterator system_iter; 63 std::map<std::string, factory<IMixedSystem,IGlobalSettings*,boost::shared_ptr<IAlgLoopSolverFactory>, boost::shared_ptr<ISimData> > >& factories(_system_type_map->get()); 64 system_iter = factories.find(modelKey); 65 if (system_iter ==factories.end()) 66 { 67 throw std::invalid_argument("No system found"); 68 } 69 std::map<std::string, factory<ISimData> >::iterator simdata_iter; 70 std::map<std::string, factory<ISimData > >& simdata_factory(_system_type_map->get()); 71 simdata_iter = simdata_factory.find("SimData"); 72 if (simdata_iter == simdata_factory.end()) 73 { 74 throw std::invalid_argument("No simdata found"); 75 } 76 boost::shared_ptr<ISimData> simData(simdata_iter->second.create()); 77 boost::shared_ptr<IMixedSystem> system(system_iter->second.create(globalSettings,algloopsolverfactory,simData)); 78 return std::make_pair(system, simData); 79 } 69 80 70 71 std::map<std::string, factory<ISimData> >::iterator simdata_iter; 72 std::map<std::string, factory<ISimData > >& simdata_factory(_system_type_map->get()); 73 simdata_iter = simdata_factory.find("SimData"); 74 if (simdata_iter ==simdata_factory.end()) 75 { 76 throw std::invalid_argument("No simdata found"); 77 } 78 boost::shared_ptr<ISimData> simData(simdata_iter->second.create()); 79 boost::shared_ptr<IMixedSystem> system(system_iter->second.create(globalSettings,algloopsolverfactory,simData)); 80 return std::make_pair(system,simData); 81 } 82 83 std::pair<boost::shared_ptr<IMixedSystem>,boost::shared_ptr<ISimData> > createModelicaSystem(PATH modelica_path,string modelKey, IGlobalSettings* globalSettings,boost::shared_ptr<IAlgLoopSolverFactory> algloopsolverfactory) 84 { 85 throw std::runtime_error("Modelica is not supported"); 86 } 81 std::pair<boost::shared_ptr<IMixedSystem>,boost::shared_ptr<ISimData> > createModelicaSystem(PATH modelica_path, string modelKey, IGlobalSettings* globalSettings, boost::shared_ptr<IAlgLoopSolverFactory> algloopsolverfactory) 82 { 83 throw std::runtime_error("Modelica is not supported"); 84 } 87 85 88 86 protected: 89 90 91 92 93 87 virtual void initializeLibraries(PATH library_path,PATH modelicasystem_path,PATH config_path) 88 { 89 PATH systemfactory_path = ObjectFactory<CreationPolicy>::_library_path; 90 PATH system_name(SYSTEM_LIB); 91 systemfactory_path/=system_name; 94 92 95 LOADERRESULT result = ObjectFactory<CreationPolicy>::_factory->LoadLibrary(systemfactory_path.string(),*_system_type_map);96 97 98 99 100 101 93 LOADERRESULT result = ObjectFactory<CreationPolicy>::_factory->LoadLibrary(systemfactory_path.string(), *_system_type_map); 94 if (result != LOADER_SUCCESS) 95 { 96 std::stringstream tmp; 97 tmp << "Failed loading System library!" << std::endl << systemfactory_path.string(); 98 throw std::runtime_error(tmp.str()); 99 } 102 100 103 104 105 101 PATH dataexchange_path = ObjectFactory<CreationPolicy>::_library_path; 102 PATH dataexchange_name(DATAEXCHANGE_LIB); 103 dataexchange_path/=dataexchange_name; 106 104 107 result = ObjectFactory<CreationPolicy>::_factory->LoadLibrary(dataexchange_path.string(),*_system_type_map);108 109 110 111 112 105 result = ObjectFactory<CreationPolicy>::_factory->LoadLibrary(dataexchange_path.string(), *_system_type_map); 106 if (result != LOADER_SUCCESS) 107 { 108 throw std::runtime_error("Failed loading Dataexchange library!"); 109 } 110 } 113 111 114 bool _use_modelica_compiler; 115 type_map* _system_type_map; 116 112 bool _use_modelica_compiler; 113 type_map* _system_type_map; 117 114 };
Note: See TracChangeset
for help on using the changeset viewer.