Skip to content

Commit

Permalink
Update to ModelC v2.1
Browse files Browse the repository at this point in the history
Signed-off-by: Rule Timothy (VM/EMT3) <[email protected]>
  • Loading branch information
timrulebosch committed Sep 17, 2024
1 parent c2ad640 commit 06bfcec
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 64 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

###############
## DSE C Library
export DSE_CLIB_VERSION ?= 1.0.17
export DSE_CLIB_VERSION ?= 1.0.18


###############
## DSE Model C Library
export DSE_MODELC_VERSION ?= 2.0.29
export DSE_MODELC_VERSION ?= 2.1.0


###############
Expand Down
1 change: 0 additions & 1 deletion dse/fmimodelc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ add_library(fmi2modelcfmu SHARED
ascii85.c
fmi2fmu.c
runtime.c
signal_api_backport.c # Backport of ModelC 2.1.0 api.
$<$<BOOL:${WIN32}>:clock_gettime.c>
)
target_include_directories(fmi2modelcfmu
Expand Down
4 changes: 2 additions & 2 deletions dse/fmimodelc/examples/network_fmu/sim/model.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ typedef struct {

static inline NCODEC* _index(ExtendedModelDesc* m, const char* v, const char* s)
{
ModelSignalIndex idx = m->model.index((ModelDesc*)m, v, s);
ModelSignalIndex idx = signal_index((ModelDesc*)m, v, s);
if (idx.binary == NULL) log_fatal("Signal not found (%s:%s)", v, s);

NCODEC* nc = idx.sv->codec(idx.sv, idx.signal);
NCODEC* nc = signal_codec(idx.sv, idx.signal);
if (nc == NULL) log_fatal("NCodec object not available (%s:%s)", v, s);

return nc;
Expand Down
11 changes: 6 additions & 5 deletions dse/fmimodelc/runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void fmimodelc_index_scalar_signals(
for (uint32_t i = 0; i < sv->count; i++) {
/* Value Reference. */
const char* vref =
signal_annotation(sv, i, "fmi_value_reference");
signal_annotation(sv, i, "fmi_value_reference", NULL);
if (vref == NULL) continue;

/* Locate the SimBus variable. */
Expand All @@ -109,7 +109,7 @@ void fmimodelc_index_scalar_signals(

/* Index based on causality. */
const char* causality =
signal_annotation(sv, i, "fmi_variable_causality");
signal_annotation(sv, i, "fmi_variable_causality", NULL);
if (strcmp(causality, "output") == 0) {
hashmap_set(output, vref, scalar);
} else if (strcmp(causality, "input") == 0) {
Expand All @@ -134,7 +134,7 @@ void fmimodelc_index_binary_signals(
for (uint32_t i = 0; i < sv->count; i++) {
/* Value Reference. */
const char* vref =
signal_annotation(sv, i, "fmi_value_reference");
signal_annotation(sv, i, "fmi_value_reference", NULL);
if (vref == NULL) continue;

/* Index according to bus topology. */
Expand Down Expand Up @@ -200,12 +200,13 @@ void fmimodelc_index_text_encoding(

for (uint32_t i = 0; i < sv->count; i++) {
/* Value Reference. */
const char* _ = signal_annotation(sv, i, "fmi_value_reference");
const char* _ = signal_annotation(
sv, i, "fmi_value_reference", NULL);
if (_ == NULL) continue;

/* Encoding. */
const char* encoding = signal_annotation(
sv, i, "dse.standards.fmi-ls-text-encoding.encoding");
sv, i, "dse.standards.fmi-ls-text-encoding.encoding", NULL);
if (strcmp(encoding, "ascii85") != 0) continue;

/* Index, all with same encoding (for now). */
Expand Down
52 changes: 0 additions & 52 deletions dse/fmimodelc/signal_api_backport.c

This file was deleted.

1 change: 0 additions & 1 deletion tests/cmocka/fmimodelc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ project(test_fmimodelc)
set(DSE_FMIMODELC_SOURCE_DIR ../../../dse/fmimodelc)
set(DSE_FMIMODELC_SOURCE_FILES
${DSE_FMIMODELC_SOURCE_DIR}/runtime.c
${DSE_FMIMODELC_SOURCE_DIR}/signal_api_backport.c
${DSE_FMIMODELC_SOURCE_DIR}/ascii85.c
)
set(DSE_FMIMODELC_INCLUDE_DIR "${DSE_FMIMODELC_SOURCE_DIR}/../..")
Expand Down
2 changes: 1 addition & 1 deletion tests/cmocka/fmimodelc/test_index.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ int test_index_setup(void** state)
*m = (RuntimeModelDesc){
.runtime = {
.runtime_model = "network_fmu",
.sim_path = EXAMPLE_MODEL_PATH,
.sim_path = (const char*)EXAMPLE_MODEL_PATH,
.simulation_yaml = "data/simulation.yaml",
.end_time = 3600,
.log_level = 5,
Expand Down

0 comments on commit 06bfcec

Please sign in to comment.