Changeset 9fdfa27 in OpenModelica


Ignore:
Timestamp:
2015-04-10T17:45:03+02:00 (9 years ago)
Author:
Ruediger Franke <ruediger.franke@…>
Branches:
Added-citation-metadata, maintenance/v1.14, maintenance/v1.15, maintenance/v1.16, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
Children:
305ab23b
Parents:
d9e3df5
Message:

adapt FMI2 to new SimVars

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@25500 f25d12d1-65f4-0310-ae8a-bbce733d8d8e

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Compiler/Template/CodegenFMUCpp.tpl

    r14ffb43 r9fdfa27  
    8787  class <%lastIdentOfPath(modelInfo.name)%>WriteOutput {
    8888   public:
    89     <%lastIdentOfPath(modelInfo.name)%>WriteOutput(IGlobalSettings* globalSettings, boost::shared_ptr<IAlgLoopSolverFactory> nonLinSolverFactory, boost::shared_ptr<ISimData> simData) {}
     89    <%lastIdentOfPath(modelInfo.name)%>WriteOutput(IGlobalSettings* globalSettings, boost::shared_ptr<IAlgLoopSolverFactory> nonLinSolverFactory, boost::shared_ptr<ISimData> simData, boost::shared_ptr<ISimVars> simVars) {}
    9090    virtual ~<%lastIdentOfPath(modelInfo.name)%>WriteOutput() {}
    9191
     
    175175  class <%modelIdentifier%>FMU: public <%modelIdentifier%>Extension {
    176176   public:
     177    // create simulation variables
     178    static ISimVars *createSimVars();
     179
    177180    // constructor
    178181    <%modelIdentifier%>FMU(IGlobalSettings* globalSettings,
    179182        boost::shared_ptr<IAlgLoopSolverFactory> nonLinSolverFactory,
    180         boost::shared_ptr<ISimData> simData);
     183        boost::shared_ptr<ISimData> simData,
     184        boost::shared_ptr<ISimVars> simVars);
    181185
    182186    // initialization
     
    236240    '#include "FMU/FMULibInterface.cpp"'%>
    237241
     242  // create simulation variables
     243  #include <System/FactoryExport.h>
     244  #include <System/SimVars.h>
     245
     246  ISimVars *<%modelIdentifier%>FMU::createSimVars() {
     247    return new SimVars(<%numRealvars(modelInfo)%>, <%numIntvars(modelInfo)%>, <%numBoolvars(modelInfo)%>, <%getPreVarsCount(simCode)%>, <%numStatevars(modelInfo)%>, <%numStateVarIndex(modelInfo)%>);
     248  }
     249
    238250  // constructor
    239251  <%modelIdentifier%>FMU::<%modelIdentifier%>FMU(IGlobalSettings* globalSettings,
    240252      boost::shared_ptr<IAlgLoopSolverFactory> nonLinSolverFactory,
    241       boost::shared_ptr<ISimData> simData):
    242     PreVariables(<%getPreVarsCount(simCode)%>),
    243     <%modelIdentifier%>(globalSettings, nonLinSolverFactory, simData),
    244     <%modelIdentifier%>Extension(globalSettings, nonLinSolverFactory, simData) {
     253      boost::shared_ptr<ISimData> simData,
     254      boost::shared_ptr<ISimVars> simVars):
     255    <%modelIdentifier%>(globalSettings, nonLinSolverFactory, simData, simVars),
     256    <%modelIdentifier%>Extension(globalSettings, nonLinSolverFactory, simData, simVars) {
    245257  }
    246258
  • SimulationRuntime/cpp/Core/System/CMakeLists.txt

    rcdfcc84 r9fdfa27  
    4646        ${CMAKE_SOURCE_DIR}/Include/Core/System/DiscreteEvents.h
    4747        ${CMAKE_SOURCE_DIR}/Include/Core/System/ContinuousEvents.h
     48        ${CMAKE_SOURCE_DIR}/Include/Core/System/SimVars.h
     49        ${CMAKE_SOURCE_DIR}/Core/System/FactoryExport.h
    4850  DESTINATION include/omc/cpp/Core/System)
    4951install (FILES
  • SimulationRuntime/cpp/Include/FMU2/FMU2Wrapper.cpp

    ra9009b7e r9fdfa27  
    7676  _model = boost::shared_ptr<MODEL_CLASS>
    7777    (new MODEL_CLASS(&_global_settings, solver_factory,
    78                      boost::shared_ptr<ISimData>(new SimData())));
     78                     boost::shared_ptr<ISimData>(new SimData()),
     79                     boost::shared_ptr<ISimVars>(MODEL_CLASS::createSimVars())));
    7980  _model->initialize();
    8081  _string_buffer.resize(_model->getDimString());
Note: See TracChangeset for help on using the changeset viewer.