Skip to content

Commit d99ce9b

Browse files
reino-ruusu-semantumrruusu
authored andcommitted
Eliminate setting of discrete input variables in continuous time mode
Even though the inputs values shouldn't change in continuous time mode, calling setters for such inputs is against the FMI standard and may result in error responses from FMUs. refs #1326
1 parent d3ea515 commit d99ce9b

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/OMSimulatorLib/SystemSC.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ int oms::cvode_rhs(realtype t, N_Vector y, N_Vector ydot, void* user_data)
6565
if (oms_status_ok != status) return status;
6666
}
6767

68-
system->updateInputs(system->eventGraph);
68+
system->updateInputs(system->simulationGraph);
6969

7070
// get state derivatives
7171
for (size_t j=0, k=0; j < system->fmus.size(); ++j)
@@ -107,7 +107,7 @@ int oms::cvode_roots(realtype t, N_Vector y, realtype *gout, void *user_data)
107107
if (oms_status_ok != status) return status;
108108
}
109109

110-
system->updateInputs(system->eventGraph);
110+
system->updateInputs(system->simulationGraph);
111111

112112
for (size_t i = 0, j=0; i < system->fmus.size(); ++i)
113113
{
@@ -634,7 +634,7 @@ oms_status_enu_t oms::SystemSC::doStepEuler(double stopTime)
634634
if (oms_status_ok != status) return status;
635635
}
636636

637-
updateInputs(eventGraph);
637+
updateInputs(simulationGraph);
638638

639639
// b. Event Detection
640640
event_detected = event_time == tnext;
@@ -722,6 +722,7 @@ oms_status_enu_t oms::SystemSC::doStepEuler(double stopTime)
722722
fmus[i]->doEventIteration();
723723
}
724724

725+
// Update all inputs, including non-continuous ones
725726
updateInputs(eventGraph);
726727

727728
// emit the right limit of the event
@@ -857,7 +858,7 @@ oms_status_enu_t oms::SystemSC::doStepCVODE(double stopTime)
857858
if (oms_status_ok != status) return status;
858859
}
859860

860-
updateInputs(eventGraph);
861+
updateInputs(simulationGraph);
861862
if (isTopLevelSystem())
862863
getModel().emit(time, false);
863864

0 commit comments

Comments
 (0)