Changeset 12187


Ignore:
Timestamp:
Dec 20, 2018 3:19:01 PM (12 months ago)
Author:
Christian Andersson
Message:

Added a solver used for when there a no states in the model. Related to ticket:5720

Location:
branches/dev-cw-ii/RuntimeLibrary/src
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-cw-ii/RuntimeLibrary/src/fmi2/fmi2_cs.c

    r11712 r12187  
    260260   
    261261    /* Evaluate the derivatives */
    262     if (sizes.states > 0) {
    263         retval = fmi2_get_derivatives(cs_data->fmix_me, rhs, sizes.states);
    264         if (retval != fmi2OK) {
    265             return -1;
    266         }
     262    retval = fmi2_get_derivatives(cs_data->fmix_me, rhs, sizes.states);
     263    if (retval != fmi2OK) {
     264        return -1;
    267265    }
    268266   
  • branches/dev-cw-ii/RuntimeLibrary/src/fmi2/fmi2_me.c

    r11712 r12187  
    274274        /* These options for the solver need to be found in a better way. */
    275275        options = jmi_ode_solver_default_options();
    276         options.method                  = jmi->options.cs_solver;
     276        if (ode_problem->sizes.states > 0) {
     277            options.method                  = jmi->options.cs_solver;
     278        } else {
     279            options.method                  = JMI_ODE_NO_STATE;
     280        }
    277281        options.euler_options.step_size = jmi->options.cs_step_size;
    278282        options.cvode_options.rel_tol   = jmi->options.cs_rel_tol;
  • branches/dev-cw-ii/RuntimeLibrary/src/jmi/CMakeLists.txt

    r12148 r12187  
    6868    jmi_ode_cvode.h
    6969    jmi_ode_euler.h
     70    jmi_ode_no_state.h
    7071    jmi_ode_solver.h
    7172    jmi_ode_solver_impl.h
     
    7475    jmi_ode_cvode.c
    7576    jmi_ode_euler.c
     77    jmi_ode_no_state.c
    7678    jmi_ode_solver.c
    7779    jmi_ode_problem.c
  • branches/dev-cw-ii/RuntimeLibrary/src/jmi/jmi_ode_solver.c

    r10722 r12187  
    2222#include "jmi_ode_euler.h"
    2323#include "jmi_ode_cvode.h"
     24#include "jmi_ode_no_state.h"
    2425#include "jmi_math.h"
    2526
     
    7576        solver->solve = jmi_ode_euler_solve;
    7677        solver->delete_solver = jmi_ode_euler_delete;
     78    }
     79        break;
     80    case JMI_ODE_NO_STATE: {
     81        jmi_ode_no_state_t* integrator;   
     82        flag = jmi_ode_no_state_new(&integrator, solver);
     83        solver->integrator = integrator;
     84        solver->solve = jmi_ode_no_state_solve;
     85        solver->delete_solver = jmi_ode_no_state_delete;
    7786    }
    7887        break;
  • branches/dev-cw-ii/RuntimeLibrary/src/jmi/jmi_ode_solver.h

    r10657 r12187  
    3939typedef enum {
    4040    JMI_ODE_CVODE,
    41     JMI_ODE_EULER
     41    JMI_ODE_EULER,
     42    JMI_ODE_NO_STATE
    4243} jmi_ode_method_t;
    4344
Note: See TracChangeset for help on using the changeset viewer.