Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Dymola: Variable missing in VariableBrowser after Translation

Dymola: Variable missing in VariableBrowser after Translation

Hello Forum,

I use Dymola Version 2016 FD01 64bit and I wrote a script for translating Dymola-Models, so the users can change the parameters before simulation. This works fine for 3 of 4 Models.

In one Model I use the Modelica LossyGear-Block and the parameter "ratio" does not show up in the VariableBrowser after the Translation. Strange because I use the same Block in the other Models too and there is no problem. I copied the Block from the good Model to the bad Model and there is no change. The Variable still does not show up in the VariableBrowser.

When I try to overwrite the non-existent variable, the following warning appears:

Warning: Setting gBFront.gear.ratio has no effect in model.
After translation you can only set literal start-values and non-evaluated parameters.

I hope you can help.

Best Regards and Thanks in advance.

Re: Dymola: Variable missing in VariableBrowser after Translation

"After translation you can only set literal start-values and non-evaluated parameters. " implies this parameter was evaluated by the tool (perhaps it is the dimension of an array or needed for a condition in an if-equation). You cannot change all parameters in a Modelica model after translation (a design limitation that there is no concept of structural parameters or requiring constants to define array sizes).

Re: Dymola: Variable missing in VariableBrowser after Translation

But in the same way I use the Block in another Model without any problems.

Can you please explain to me, what you mean by:

sjoelund.se wrote:


... (a design limitation that there is no concept of structural parameters or requiring constants to define array sizes).

Is there any workaround to solve this? I already searched for a solution an found out, that i can write
parameter Real gearRatio=10 annotation(Evaluate=false);
So the parameter should not be evaluated, but still it does not show up in the VariableBrowser.

Re: Dymola: Variable missing in VariableBrowser after Translation

The Modelica tool decides which parameters it needs to evaluate. The only thing you can do if you want to be able to change a parameter value is to make sure this value is not propagated to any array dimension, etc Evaluate=false is a hint that the compiler should not evaluate the parameter if possible. But if it is used in array dimensions, it will be evaluated anyway.

Re: Dymola: Variable missing in VariableBrowser after Translation

sjoelund.se wrote:


The Modelica tool decides which parameters it needs to evaluate. The only thing you can do if you want to be able to change a parameter value is to make sure this value is not propagated to any array dimension, etc Evaluate=false is a hint that the compiler should not evaluate the parameter if possible. But if it is used in array dimensions, it will be evaluated anyway.

Thanks for the information. I will check, if somewhere is a propagation to an array dimension.

Re: Dymola: Variable missing in VariableBrowser after Translation

I found out, that the parameter is missing, because there was an Inertia-Block upwards the Lossy-Gear-Block. My workaround is to add a Clutch-Block between the Inertia and the LossyGear. By this, the parameter LossyGear.ratio appears in the VariableBrowser and I can overwrite it.

This is not a elegant way to solve this issue. Maybe anyone has another solution. I am also trying to understand, why this happens. I found out, that in the "dsin.txt"-File there are 3 more variables for the LossyGear. These are the initial-conditions phi, w, der(w).

Re: Dymola: Variable missing in VariableBrowser after Translation

I unchecked the 'fixed=true'-checkbox inside the Inertia-Block. Now it works, also without the Clutch.

There are 0 guests and 0 other users also viewing this topic
You are here: