Skip to content

Zero values in connectors are replaced with initial value #1553

@rruusu

Description

@rruusu

Description

Zero simulated values are not read from system connectors, but are replaced with initial values.

Steps to reproduce the behavior

  1. Create a model where data is read from a connector with a non-zero initial value.
  2. Pass a value of zero to the connector.
  3. Read the connector.
  4. Instead of zero, the initial value is returned.

Screenshots

The attached simple SSP with an SCSystem inside a WCSystem:

Image

Output from "pulse" is an alternating value between 220 and 0. Input to "SCSystem" is a flat line of 220.0.

Image

Cause

This is caused by the condition in oms::System::getReal() for checking the existence of a simulated value.

        if (oms_modelState_simulation == getModel().getModelState() && values.realValues[cref] != 0.0)

It should check for the existence of a value in the map instead of comparing it against zero.

PWMTest.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions