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
  • Index
  • » Users
  • » MSMI
  • » Profile

Posts

Posts

Nov-10-20 08:22:51
ways to debug script?

sjoelund.se wrote:

Call getErrorString() to get messages

I already had getErrorString(); behind every line in the script, it doesnt seem to do much.

Code:

loadFile("model.mo");

getErrorString();
buildModel(model);
getErrorString();
system("model");
getErrorString();

just produces "failed" for me, if the model asserts. Calling it after i get "Failed" also produces nothing.

Nov-09-20 16:23:57
ways to debug script?

Is there a way to debug .mos scripts / their execution more efficiently?
I'm running them from OMShell, but if there is an error in the script it just says "fail", which is not very helpfull at all.

Just now i had a self defined assert (that i had forgotten about) in the model trigger for one of the parameters, and i was mistakenly looking inside the script itself for the failure ...

I would like to visualize the movements of some 1D Models , because they are a bit hard to follow just by looking at diagrams. So i thought about using the 3D visualizers - without rebuilding the entire model with 3D Multibody elements. Unfortunately i dont know how to properly make it happen.

Is there a simple way to display a visualizer at a specific fixed position in 3D space + 2 fixed rotation axis - and have 1 axis of the rotation be dependant on a variable ?  (e.g. the rotation of a 1D inertia element.

Thanks

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

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;

Feb-27-19 10:24:02
Simple model fails when initialising with 0 startingvalue - looking for clues

Hi, i have a problem with a simple spring model (see bottom) that is nonlinear, based on some simple geometric relations. I put it in a simple test rig:
Inertia component has fixed initial values w=6 &  phi=some value
When i set phi to anything other than 0 (e.g. 1e-6) , the simulation executes without problem
When phi= 0 i get the following error:
I can only assume it is some floatingpoint error as it says "outside the domain -1.0 <= -1 <= 1.0" but -1 should in theory be = -1.0   .

How do i find the cause of this?  I enabled the debug operations option and  looked at the debug more option, but i'm at a loss what the issue could be. I only found relations of the variables in the debugger, not the specific values the variables have at the point of failure. How would i find the cause of this issue? Or is it a case where the model is not properly written? Do i have to use algorithm here?

  • Index
  • » Users
  • » MSMI
  • » Profile
You are here: