diff --git a/Compiler/Template/CodegenCpp.tpl b/Compiler/Template/CodegenCpp.tpl index b565744d941..9227f7a1ef5 100644 --- a/Compiler/Template/CodegenCpp.tpl +++ b/Compiler/Template/CodegenCpp.tpl @@ -454,6 +454,18 @@ case SIMCODE(modelInfo=MODELINFO()) then return new SimData(); } + shared_ptr createSimDataFunction() + { + shared_ptr data( new SimData() ); + return data; + } + + shared_ptr createSimVarsFunction(size_t dim_real, size_t dim_int, size_t dim_bool, size_t dim_string, size_t dim_pre_vars, size_t dim_z, size_t z_i) + { + shared_ptr var( new SimVars(dim_real, dim_int, dim_bool, dim_string, dim_pre_vars, dim_z, z_i) ); + return var; + } + #elif defined (RUNTIME_STATIC_LINKING) #include #include @@ -1900,7 +1912,7 @@ extern "C" int initSimulation(ISimController* &controller, ISimData* &data, dou PATH modelicaSystem_path = ""; shared_ptr factory = shared_ptr(new VxWorksFactory(libraries_path, modelicaSystem_path)); ISimController* sim_controller = createSimController(libraries_path, modelicaSystem_path); - shared_ptr simObjects= simulation.first->getSimObjects(); + shared_ptr simObjects= sim_controller->getSimObjects(); weak_ptr simData = simObjects->LoadSimData("<%lastIdentOfPath(modelInfo.name)%>"); weak_ptr simVars = simObjects->LoadSimVars("<%lastIdentOfPath(modelInfo.name)%>",<%numRealVars%>,<%numIntVars%>,<%numBoolVars%>,<%numStringVars%>,<%numPreVars%>,<%numStatevars(modelInfo)%>,<%numStateVarIndex(modelInfo)%>); weak_ptr system = sim_controller->LoadSystem("<%lastIdentOfPath(modelInfo.name)%>","<%lastIdentOfPath(modelInfo.name)%>"); diff --git a/SimulationRuntime/cpp/Core/DataExchange/FactoryExport.cpp b/SimulationRuntime/cpp/Core/DataExchange/FactoryExport.cpp index dfa5c767f6a..d5260b19284 100644 --- a/SimulationRuntime/cpp/Core/DataExchange/FactoryExport.cpp +++ b/SimulationRuntime/cpp/Core/DataExchange/FactoryExport.cpp @@ -2,8 +2,35 @@ #include #if defined(__TRICORE__) || defined(__vxworks) +#include #include - +#include +#include +#include +#include +#include +#include +#include +shared_ptr createMatFileWriterFactory(IGlobalSettings& globalSettings,size_t dim) +{ + shared_ptr writer= shared_ptr(new HistoryImpl(globalSettings,dim) ); + return writer; +} +shared_ptr createTextFileWriterFactory(IGlobalSettings& globalSettings,size_t dim) +{ + shared_ptr writer= shared_ptr(new HistoryImpl(globalSettings,dim) ); + return writer; +} +shared_ptr createBufferReaderWriterFactory(IGlobalSettings& globalSettings,size_t dim) +{ + shared_ptr writer= shared_ptr(new HistoryImpl(globalSettings,dim) ); + return writer; +} +shared_ptr createDefaultWriterFactory(IGlobalSettings& globalSettings,size_t dim) +{ + shared_ptr writer= shared_ptr(new HistoryImpl(globalSettings,dim) ); + return writer; +} #elif defined(OMC_BUILD) && !defined(RUNTIME_STATIC_LINKING) #include #include diff --git a/SimulationRuntime/cpp/Core/SimController/FactoryExport.cpp b/SimulationRuntime/cpp/Core/SimController/FactoryExport.cpp index c50d534feb4..5c0676f8d28 100644 --- a/SimulationRuntime/cpp/Core/SimController/FactoryExport.cpp +++ b/SimulationRuntime/cpp/Core/SimController/FactoryExport.cpp @@ -8,13 +8,20 @@ +#include #include +#include extern "C" ISimController* createSimController(PATH library_path, PATH modelicasystem_path) { return new SimController(library_path, modelicasystem_path); } +shared_ptr createSimObjects(PATH library_path, PATH modelicasystem_path,IGlobalSettings* settings) +{ + return shared_ptr(new SimObjects(library_path, modelicasystem_path,settings)); +} + #elif defined(SIMSTER_BUILD) @@ -58,4 +65,4 @@ shared_ptr createSimObjects(PATH library_path, PATH modelicasystem_ #else error "operating system not supported" #endif -/** @} */ // end of coreSimcontroller \ No newline at end of file +/** @} */ // end of coreSimcontroller diff --git a/SimulationRuntime/cpp/Core/System/FactoryExport.cpp b/SimulationRuntime/cpp/Core/System/FactoryExport.cpp index 475a2960dbb..79216497f76 100644 --- a/SimulationRuntime/cpp/Core/System/FactoryExport.cpp +++ b/SimulationRuntime/cpp/Core/System/FactoryExport.cpp @@ -9,8 +9,12 @@ #include #include -extern "C" IAlgLoopSolverFactory* createAlgLoopSolverFactory(IGlobalSettings* globalSettings,PATH library_path,PATH modelicasystem_path) + +extern "C" IAlgLoopSolverFactory* createAlgLoopSolverFactoryFunction(IGlobalSettings* globalSettings,PATH library_path,PATH modelicasystem_path) +//shared_ptr createAlgLoopSolverFactoryFunction(IGlobalSettings* globalSettings,PATH library_path,PATH modelicasystem_path) { + //shared_ptr algloopSolverFactory = shared_ptr(new AlgLoopSolverFactory(globalSettings,library_path,modelicasystem_path)); + //return algloopSolverFactory; return new AlgLoopSolverFactory(globalSettings,library_path,modelicasystem_path); } diff --git a/SimulationRuntime/cpp/Include/SimCoreFactory/Policies/FactoryConfig.h b/SimulationRuntime/cpp/Include/SimCoreFactory/Policies/FactoryConfig.h index 8d85c637959..8a87b038512 100644 --- a/SimulationRuntime/cpp/Include/SimCoreFactory/Policies/FactoryConfig.h +++ b/SimulationRuntime/cpp/Include/SimCoreFactory/Policies/FactoryConfig.h @@ -5,7 +5,7 @@ #if defined(__vxworks) /*Defines*/ - #define PATH string + #define PATH std::string #include #include @@ -28,6 +28,7 @@ #include #include #include + #include #include #include diff --git a/SimulationRuntime/cpp/Include/SimCoreFactory/Policies/FactoryPolicy.h b/SimulationRuntime/cpp/Include/SimCoreFactory/Policies/FactoryPolicy.h index 69dff6a8ba3..7d2259e8ea3 100644 --- a/SimulationRuntime/cpp/Include/SimCoreFactory/Policies/FactoryPolicy.h +++ b/SimulationRuntime/cpp/Include/SimCoreFactory/Policies/FactoryPolicy.h @@ -11,6 +11,7 @@ #include #include #include + #include #include /*Policy defines*/ @@ -18,6 +19,9 @@ typedef SystemVxWorksFactory SimControllerPolicy; typedef SolverVxWorksFactory ConfigurationPolicy; //typedef LinSolverVxWorksFactory NonLinSolverPolicy; + + typedef SimObjectVxWorksFactory SimObjectPolicy; + typedef NonLinSolverVxWorksFactory NonLinSolverPolicy; typedef SolverSettingsVxWorksFactory SolverSettingsPolicy; typedef LinSolverVxWorksFactory LinSolverPolicy; diff --git a/SimulationRuntime/cpp/SimCoreFactory/VxWorksFactory/VxWorksFactory.cpp b/SimulationRuntime/cpp/SimCoreFactory/VxWorksFactory/VxWorksFactory.cpp index 4072b2c375b..8406aaf37f2 100644 --- a/SimulationRuntime/cpp/SimCoreFactory/VxWorksFactory/VxWorksFactory.cpp +++ b/SimulationRuntime/cpp/SimCoreFactory/VxWorksFactory/VxWorksFactory.cpp @@ -10,7 +10,13 @@ extern "C" ISimController* createSimController(PATH library_path, PATH modelicasystem_path); extern "C" ISettingsFactory* createSettingsFactory(PATH library_path,PATH modelicasystem_path); -extern "C" IAlgLoopSolverFactory* createAlgLoopSolverFactory(IGlobalSettings* globalSettings,PATH library_path,PATH modelicasystem_path); + +extern "C" IAlgLoopSolverFactory* createAlgLoopSolverFactoryFunction(IGlobalSettings* globalSettings,PATH library_path,PATH modelicasystem_path); + + //shared_ptr createAlgLoopSolverFactory(IGlobalSettings* globalSettings); + + + extern "C" ISimData* createSimData(); extern "C" ISimVars* createSimVars(size_t dim_real,size_t dim_int,size_t dim_bool, size_t dim_string,size_t dim_pre_vars,size_t dim_z,size_t z_i); extern "C" ISolver* createRTEuler(IMixedSystem* system, ISolverSettings* settings); @@ -50,12 +56,19 @@ shared_ptr VxWorksFactory::LoadSettingsFactory() shared_ptr VxWorksFactory::LoadAlgLoopSolverFactory(IGlobalSettings* globalSettings) { - IAlgLoopSolverFactory* algloopsolverFactory = createAlgLoopSolverFactory(globalSettings, _library_path, _modelicasystem_path); + IAlgLoopSolverFactory* algloopsolverFactory = createAlgLoopSolverFactoryFunction(globalSettings, _library_path, _modelicasystem_path); return shared_ptr(algloopsolverFactory); } -shared_ptr VxWorksFactory::LoadSystem(IGlobalSettings* globalSettings, shared_ptr nonlinsolver, shared_ptr simObjects) +/* +shared_ptr VxWorksFactory::LoadAlgLoopSolverFactory(IGlobalSettings* globalSettings) +{ + return createAlgLoopSolverFactory(globalSettings); +} +*/ + +shared_ptr VxWorksFactory::LoadSystem(IGlobalSettings* globalSettings,shared_ptr simObjects) { IMixedSystem* system = createModelicaSystem(globalSettings, simObjects); return shared_ptr(system);