modelExample8
Common subexpression elimination example
Extends from Modelica.Icons.Example (Icon for runnable examples).
Information
This is a very simple example demonstrating common subexpression elimination.
The Dymola generated C-code of this model is:
W_[0] = sin(Time+1); W_[1] = W_[0];
Hence, the sine and addition are evaluated once only, which is more efficient.
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Real | a | sin(k*time + 1) | |
| Real | b | sin(k*time + 1) |
Revisions
-
March 6, 2023, by Michael Wetter:
Added a constant in order for unit check to pass.
See #1711 for a discussion. -
July 14, 2015, by Michael Wetter:
Revised documentation. -
June 18, 2015, by Filip Jorissen:
First implementation.