Support : Knowledge base

Knowledge Base

Welcome to OPAL-RT’s Knowledge Base

OPAL-RT offers a repository of support information for optimal use of its technology.

Loading…

Please note that OPAL-RT knowledge base is not fully optimized for mobile platforms.

For optimal experience, use a desktop computer.

Reference Number: AA-02134// Views: AA-02134// Created: 2023-03-02 11:56:35// Last Updated: 2023-03-02 13:13:04
General Article
See Only 0 in Variable Viewer or Variable Table / Values Do Not Update

See Only 0 in Variable Viewer / Variable Table

Context:

Let's take this barebone model, with nothing in it except a few basic elements:




When compiling and running this model, we would expect to see in the Variable Viewer the value 1000 x 514 = 514 000 at the output of the gain and 2000 x 50 = 10 000 at the output of Gain1. However, what we see is that the upper gain is 0 and the lower gain is the correct value.



Furthermore, if the constant1 is changed from 0 to 1, then the values seem to be correct:




However, if something is changed in the lower branch (e.g. the value of the gain), then the signal of Gain1 does not seem to update properly.



Solution


It is not a bug. The code in the 'unused' branch of the switch does not get recomputated, as long as it is not being used. This is normal, since a switch is generated as an if / else statement in the code under the hood.