Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

New branch of visualizer for osi-2.2.1 maintenance #20

Open
wants to merge 11 commits into
base: maintenance/v-for-osi2.2.1
Choose a base branch
from

Conversation

Yang-Wu-Altran
Copy link
Contributor

No description provided.

@ghost ghost requested a review from pmai April 20, 2018 12:08
Copy link
Contributor

@pmai pmai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FMU access should always be mediated through the variable names, since that is the only thing that is specified to be well-defined. VRs are internal to the FMU, the mapping name -> vr must be looked up upon loading the FMU. For the non-OSMP specified parameters (like sender, receiver, ...), setting those should be under the control of the user (hard-coding for now should be done on compiling the FMU, it seems to me).

return;
}

if (fmi2_import_get_fmu_kind(fmu_) == fmi2_fmu_kind_me)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test should follow logic in warning message, i.e. test for != fmi2_fmu_kind_cs, rather than me.

// start values
fmi2_string_t instanceName = "Test CS model instance";

fmi2_string_t fmuLocation = "";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fmuLocation should be changed to be FMI compliant (i.e. needs to point to resource directory location of unpacked FMU).

fmiStatus_ = fmi2_import_enter_initialization_mode(fmu_);
fmiStatus_ = fmi2_import_exit_initialization_mode(fmu_);

vr_[FMI_INTEGER_SENSORDATA_IN_BASELO_IDX] = FMI_INTEGER_SENSORDATA_IN_BASELO_IDX;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable accesses should be done via the specified variable names, not through hard-coded VRs (these can change at any time, only the Variable names are guaranteed to remain constant through the OSMP spec). E.g. variables can be looked up via fmi2_import_get_variable_by_name and their VR via fmi2_import_get_variable_vr, all to be done at load-time of the FMU.

// #define FMI_BOOLEAN_DUMMY_IDX 0
// #define FMI_BOOLEAN_SENDER_IDX 1
// #define FMI_BOOLEAN_RECEIVER_IDX 2
fmi2_boolean_t booleanVars_[3];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dito for the booleans, but here OSMP does not guarantee that they exist at all, so this should be user configurable...

bool
FMUReceiver::get_fmi_sensor_data_in(osi::SensorData& data)
{
fmiStatus_ = fmi2_import_get_integer(fmu_, vr_, FMI_INTEGER_VARS, integerVars_);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also gets the inputs, which does not seem to make sense for the code base here; since inputs are not set anywhere here, they should not be accessed at all, it seems to me.

if (!fmu_ && errMsg.isEmpty())
errMsg = "Error parsing modeldescription.xml of fmu ";

if (fmi2_import_get_fmu_kind(fmu_) == fmi2_fmu_kind_me && errMsg.isEmpty())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comments as for fmu receiver apply.

integerVars_[FMI_INTEGER_SENSORDATA_IN_BASELO_IDX]);
integerVars_[FMI_INTEGER_SENSORDATA_IN_SIZE_IDX] = (fmi2_integer_t)currentBuffer_.length();

fmiStatus_ = fmi2_import_set_integer(fmu_, vr_, FMI_INTEGER_VARS, integerVars_);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comments as for the receiver: The outputs should not be set here at all.

@ghost
Copy link

ghost commented Jun 4, 2018

@haoyuanying this needs to be fixed for the maintenance branch

@ghost ghost requested a review from haoyuanying June 4, 2018 07:48
@ghost ghost added the feature request Proposals which enhance the interface or add additional features. label Jun 4, 2018
@jdsika jdsika requested review from vkresch and removed request for haoyuanying September 19, 2019 09:17
Copy link
Contributor

@jdsika jdsika left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vkresch I think this should be runnable (also in docker) in order to close the support for OSI 2.2.1 gracefully for the visualizer.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature request Proposals which enhance the interface or add additional features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants