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

Integer parameters not changeable when re-simulating

Integer parameters not changeable when re-simulating

Hello, i have a model which uses another model with integer parameter. The integer parameter is used for choosing different calculation methods.
The problem i have is that when i want to re-simulate the model after compiling, i can't change those integer parameters. To change those integers i always have to change them directly in the model and then recompile+resimulate to change those.

Is it generally not supported to change integer parameters in re-simulations? Or is it a cause of how i implemented them ? I'm using OMedit v1.13.2

Here is the snippet of how i the submodel

Code:


model Feder
    ...
    parameter Integer method = 1 "1-Analytic 2-Table1 3-Table2";
    SI.Torque M;
    ...
equation
    ...
    if (method == 1) then
        M = Feder_fnc(phi,a,b,d,L0,Lk,L_bogen,F0,R,z);
    elseif (method == 3) then
        M = z* combiTable1.y[1] / 2;
    else
        M = z* combiTable2.y[1] /2;
    end if;
    ...
end Feder;

Re: Integer parameters not changeable when re-simulating

Hi, if I understand it correctly, you used a parameter as a condition in a If-statement, thus makes "method" a structural parameter and you can not change it. Instead, maybe you can defined "method" as an input

Code:

 input Integer method 

.

Like i said, my understanding about sructural parameter might be wrong current/tongue

Edited by: Arinomo23 - Aug-23-19 11:37:29

Re: Integer parameters not changeable when re-simulating

Hi, it seems you are right.
I wanted to keep the integer parameter in that model as parameter, so i moved the if/else switching to diagramm layer via boolean blocks - essentially the same method as you proposed. This way it works.
thanks

Edited by: MSMI - Aug-23-19 13:32:19
There are 0 guests and 0 other users also viewing this topic
You are here: