- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » extrapolation for a table
extrapolation for a table
extrapolation for a table
I have a model "Driver" which uses a CombiTable "table".
In Driver I defined
parameter Modelica.Blocks.Types.Extrapolation myExtrapolation
that I pass to table.
For OpenModelica extrapolation in CombiTables is structural, and therefore cannot be changed for re-runs.
However, when run Driver, from OMEdit myExtrapolation appears to be modifiable. If I modify it, however, the simulation does not change because the table does not accept changes in its extrapolation when re-simulating.
Is there a way allowing to avoid myExtrapolation to appear modifiable from OMEdit plotting perspective?
Thanks
- ceraolo
- 147 Posts
Re: extrapolation for a table
How did you pass the parameter in your model?
using the code below the parameter became structural and thus cannot be changed when re-simulating
Code:
parameter Modelica.Blocks.Types.Extrapolation myExtrapolation = Modelica.Blocks.Types.Extrapolation.HoldLastPoint ;
Boolean isOne;
equation
if myExtrapolation == Modelica.Blocks.Types.Extrapolation.HoldLastPoint then
isOne = true;
end if;
- Arinomo23
- 120 Posts
Re: extrapolation for a table
Excellent!
I did as you recommended and solved my issue.
But your solution requires the definition of a new variable. Smart tools can drop it from the equations considering that its defining equation is trivial.
But probably better is defining isOne as a parameter (here I use the name dummy):
parameter Modelica.Blocks.Types.Extrapolation myExtrapolation = Modelica.Blocks.Types.Extrapolation.LastTwoPoints "Extrapolation of data outside the definition range";
protected
parameter Boolean dummy( fixed=false);
public
[...]
initial equation
if myExtrapolation == Modelica.Blocks.Types.Extrapolation.HoldLastPoint then
dummy = true;
end if;
- ceraolo
- 147 Posts
Re: extrapolation for a table
Or could we use final prefix for the parameter? Modelica Langage Spec 3.4 chapter 7.2.6
Code:
final parameter Modelica.Block.Type.Extrapolation myExtrapolation = ...
my first idea was a bit hacky and i didn't like it
- Arinomo23
- 120 Posts
Re: extrapolation for a table
This won't do the job, since it hides extrapolation from the final user.
I want the final user to be able to choose which extrapolation to apply.
- ceraolo
- 147 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » extrapolation for a table