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

Iterating a model

Iterating a model

Hi.

I have created a simple cantilever beam model which gives me the deflection at a certain point along the beam. I basically have the deflection equation

y = P/(6*E* I)*(-a^3+3*L^2*a-2*L^3)
where y is the deflection (y is a variable of type Real ).

and I input the parameters to it and tell which point I need the deflection. I was wondering if I can iterate this over the entire length of the beam and and store all the deflections in a variable so that when plotting this variable, I can visually get the deflections over the entire length of the beam. Is this possible? What kind of variable should y be in this case?


Thanks in Advance,
Sanjay

Re: Iterating a model

I'm not quite sure whether I understand this right. So this formula is for the bending of a beam? and y is how much it is of the neutral position?
I guess L ist the length of the beam, so it's also the x-variable. Just set x = time then and simulate as long as your beam is in seconds. After that just plot y.

Re: Iterating a model

Thanks, SKD. That's a brilliant idea.

But is there any way where I can do this without introducing x = time?  Also in the solution you gave, is there a way I can set the length of the beam as the simulation End time? Giving stopTime = L gives me a warning telling its an 'Unknown experiment annotation'

Regards,
Sanjay

Re: Iterating a model

In the OMEdit plot window there are two icons showing a little graph, one x(t) and the other x(y). If you select the last one you can plot one  variables above another variable.
So you don't need to set x = time.

For the second problem. I'm not quite sure, I guess you have to this from "outside" with commands in the OMShell console.

Re: Iterating a model

Correct SKD, I can plot x(y) using parametric plot. I think you may not have got my question.

In the beginning I had the deflection,y as a function of x. i.e. y=f(x). In this case, I could get the deflection for only a specific x value. I wanted to iterate this over the length,L of the beam i.e from x = 0 to x = L. For this you suggested to put x = time and to make the simulation end time as the beam length.

What i want is, to get the same result without using the time variable and without needing to override simulation End Time as the beam length. Is this possible?

Re: Iterating a model

I'm still not whether I get the point. So you want to plot y over x without any relation of x to the time? I think this won't be possible since Modelica always simulates over a time. And if you want to do this you would have the problem that there is an infinitely large amount of different values for x for one time step. So there has to be some relation of any variable to the time (or constant values). At least this is what I think about that problem.

Re: Iterating a model

Yes. You got my question correctly. Thanks for the reply.

There are 0 guests and 0 other users also viewing this topic