Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make --suppressPath=true the default #980

Merged
merged 1 commit into from
Mar 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/FMUInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ namespace oms
oms_fmi_kind_enu_t getKind() const {return fmiKind;}

bool getCanInterpolateInputs() const {return canInterpolateInputs;}
unsigned int getMaxOutputDerivativeOrder() const {return maxOutputDerivativeOrder;}
bool getCanGetAndSetFMUstate() const {return canGetAndSetFMUstate;}
unsigned int getMaxOutputDerivativeOrder() const {return maxOutputDerivativeOrder;}

private:
// methods to copy the object
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/Flags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void oms::Flags::setDefaults()
startTime = 0.0;
stopTime = 1.0;
stripRoot = false;
suppressPath = false;
suppressPath = true;
timeout = 0.0;
tolerance = 1e-4;
wallTime = false;
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/Flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ namespace oms
{"--startTime", "-s", "Specifies the start time", re_double, Flags::StartTime, false},
{"--stopTime", "-t", "Specifies the stop time", re_double, Flags::StopTime, false},
{"--stripRoot", "", "Removes the root system prefix from all exported signals (true, [false])", re_bool, Flags::StripRoot, false},
{"--suppressPath", "", "Supresses path information in info messages; especially useful for testing (true, [false])", re_bool, Flags::SuppressPath, false},
{"--suppressPath", "", "Supresses path information in info messages; especially useful for testing ([true], false)", re_bool, Flags::SuppressPath, false},
{"--tempDir", "", "Specifies the temp directory", re_default, Flags::TempDir, false},
{"--timeout", "", "Specifies the maximum allowed time in seconds for running a simulation (0 disables)", re_number, Flags::Timeout, false},
{"--tolerance", "", "Specifies the relative tolerance", re_double, Flags::Tolerance, false},
Expand Down
17 changes: 10 additions & 7 deletions src/OMSimulatorLib/Variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,11 @@ oms::Variable::Variable(fmi2_import_variable_t *var, unsigned int index)
vr = fmi2_import_get_variable_vr(var);
causality = fmi2_import_get_causality(var);
initialProperty = fmi2_import_get_initial(var);

switch (fmi2_import_get_variable_base_type(var))
{
case fmi2_base_type_real:
type = oms_signal_type_real;
// mark derivatives
{
fmi2_import_real_variable_t* varReal = fmi2_import_get_variable_as_real(var);
fmi2_import_variable_t* varState = (fmi2_import_variable_t*)fmi2_import_get_real_variable_derivative_of(varReal);
if (varState)
markAsDer();
}
break;
case fmi2_base_type_int:
type = oms_signal_type_integer;
Expand All @@ -78,6 +72,15 @@ oms::Variable::Variable(fmi2_import_variable_t *var, unsigned int index)
type = oms_signal_type_real;
break;
}

// mark derivatives
if (oms_signal_type_real == type)
{
fmi2_import_real_variable_t* varReal = fmi2_import_get_variable_as_real(var);
fmi2_import_variable_t* varState = (fmi2_import_variable_t*)fmi2_import_get_real_variable_derivative_of(varReal);
if (varState)
is_der = true;
}
}

oms::Variable::~Variable()
Expand Down
5 changes: 2 additions & 3 deletions src/OMSimulatorLib/Variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ namespace oms
~Variable();

void markAsState() { is_state = true; }
void markAsDer() { is_der = true; }

// causality attribute
bool isParameter() const { return fmi2_causality_enu_parameter == causality; }
Expand All @@ -74,7 +73,7 @@ namespace oms
}

const ComRef& getCref() const { return cref; }
operator std::string() const {return std::string(cref);}
operator std::string() const { return std::string(cref); }

fmi2_value_reference_t getValueReference() const { return vr; }
oms_signal_type_enu_t getType() const { return type; }
Expand All @@ -88,7 +87,7 @@ namespace oms
oms_causality_enu_t getCausality() const;

unsigned int getIndex() const { return index; }
oms::Connector makeConnector() const {return oms::Connector(getCausality(), type, cref);}
oms::Connector makeConnector() const { return oms::Connector(getCausality(), type, cref); }

private:
ComRef cref;
Expand Down