Skip to content

Commit

Permalink
Fix marshalling from FMU to MCL to include FMI local variables.
Browse files Browse the repository at this point in the history
Signed-off-by: Timothy Rule (VM/EMT3) <[email protected]>
  • Loading branch information
timrulebosch committed Dec 17, 2024
1 parent f346951 commit 5b1dc66
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
18 changes: 16 additions & 2 deletions dse/fmimcl/adapter/fmi2mcl.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,14 @@ static int32_t fmi2mcl_marshal_in(FmuModel* m)

log_trace("Marshal IN (FMU -> target):");
for (MarshalGroup* mg = m->data.mg_table; mg && mg->name; mg++) {
if (mg->dir != MARSHAL_DIRECTION_RXONLY) continue;
switch (mg->dir) {
case MARSHAL_DIRECTION_TXRX:
case MARSHAL_DIRECTION_RXONLY:
case MARSHAL_DIRECTION_LOCAL:
break;
default:
continue;
}

log_trace(
" (name: %s, count: %d, type: %d)", mg->name, mg->count, mg->type);
Expand Down Expand Up @@ -284,7 +291,14 @@ int32_t fmi2mcl_marshal_out(FmuModel* m)

log_trace("Marshal OUT (target -> FMU):");
for (MarshalGroup* mg = m->data.mg_table; mg && mg->name; mg++) {
if (mg->dir != MARSHAL_DIRECTION_TXONLY) continue;
switch (mg->dir) {
case MARSHAL_DIRECTION_TXRX:
case MARSHAL_DIRECTION_TXONLY:
case MARSHAL_DIRECTION_PARAMETER:
break;
default:
continue;
}

log_trace(
" (name: %s, count: %d, type: %d)", mg->name, mg->count, mg->type);
Expand Down
6 changes: 6 additions & 0 deletions dse/fmimcl/examples/input/data/simulation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ spec:
fmi_variable_name: real_A2_rx
fmi_variable_type: Real
fmi_variable_causality: output
- signal: local_var
annotations:
fmi_variable_vref: 12
fmi_variable_name: local_var
fmi_variable_type: Real
fmi_variable_causality: local
---
kind: SignalGroup
metadata:
Expand Down

0 comments on commit 5b1dc66

Please sign in to comment.