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
  • » CrH
  • » Profile

Posts

Posts

Jun-13-12 14:09:16
Problem when ploting a variable against an other

well, i might be not clear enough.
Here is a script that i wrote to handle this problem, but i would like to plug that directly in the model and not in a script


Code:


n=readTrajectorySize("dsres.mat"); // find the length of the simulation results vectors
traj_mass1=transpose(readTrajectory("dsres.mat",{"massWithStopAndFriction.s"},n));  //extract the mass one trajectory
traj_mass2=transpose(readTrajectory("dsres.mat",{"massWithStopAndFriction1.s"},n)); //extract the mass two trajectory
traj_Vmass1=transpose(readTrajectory("dsres.mat",{"massWithStopAndFriction.der(s)"},n)); //transpose tranformation
traj_Vmass2=transpose(readTrajectory("dsres.mat",{"massWithStopAndFriction1.der(s)"},n)); //transpose tranformation

// creation of a vector of 500 points
pos=fill(0,500,1);

//creation of a [500,3] matrix
vitessFpos=fill(0,500,3);

// I want to have a point pro millimeter (the masses move from 0 to 0.5m)
pos[:,1]=1:500;
pos[:,1]=0.001*pos[:,1];

//loop to find the index in trajectory mass vector where the mass  step from 1 mm
indexref=fill(0,500,2);
for i in 1:500 loop
    for j in 1:n loop
   
        if traj_mass1[j,1]-pos[i,1]<=0.0001 then
            indexref[i,1]=j;
        else
        end if;
        if traj_mass2[j,1]-pos[i,1]<=0.0001 then
            indexref[i,2]=j;
        else
        end if;
    end for;
end for;

vitessFpos[:,1]=pos[:,1]; //copy the first column of the position vector (it's the reference position vecotr)

// loop to find the velocity value in the velocity vector the point where we step from one millimeter to an other

for i in 1:500 loop

    vitessFpos[i,2]=traj_Vmass1[indexref[i,1],1];
    vitessFpos[i,3]=traj_Vmass2[indexref[i,2],1];
end for;

plotArrays(vitessFpos[:,1], vitessFpos[:,2:3]); // plot the result Velocities of the both masses against the absolut position

Jun-12-12 16:08:03
Problem when ploting a variable against an other

Hi modelers,

I'm facing a problem when i want to plot two simulation results against a reference variable:

Let's say that i've got 2 instantiations of the same model. The model describe a translating mass, driving by a motor. The difference between them are the parameter's values and in each model.

I would like to plot the motor torque against the mass-posistion. The problem is that, the Mass-position is function of the respective "model time" or "model integration step" (actually i don't know). Which means that :
- if one mass is faster than the other and if i plot the both torque variables against position( from Mass1 or Mass2) i will not have the same plot-result.

But, the path is the same for the both mass, so why isn't it an absolut reference for the both model?! What should i do to cancel this effect, any help will be really appreciate.

------------
if i summarize :

i have :
Torque_motor1=Function(Position_Mass1)
Torque_motor2=Function(Position_Mass1)
or
Torque_motor1=Function(Position_Mass2)
Torque_motor2=Function(Position_Mass2)

i want :

Torque_motor1=Function(Position)
Torque_motor2=Function(Position)

thanks

Jun-09-11 17:53:32
Motor model - Comparaison between Openmodelica and 20sim

i changed the solver and now use the Euler solver, with this solver the problem is fixed. I mean that the results are corrects.

thank you for your help.

thom

Jun-09-11 15:54:04
Motor model - Comparaison between Openmodelica and 20sim

sorry, I didn't check the images.

For the OMC version, I just download this release : OpenModelica-1.7.0-revision-8711.msi


OpenMolica model : (plz take a look at the begining of the movement of the inertia)
http://nsa19.casimages.com/img/2011/06/09/110609025027467996.gif
20sim model:
http://nsa19.casimages.com/img/2011/06/09/110609025100910627.gif
OM simulation results :
http://nsa20.casimages.com/img/2011/06/09/110609025008360213.jpg
20sim simulation results :
http://nsa20.casimages.com/img/2011/06/09/110609024727757398.jpg

Jun-09-11 14:44:32
Motor model - Comparaison between Openmodelica and 20sim

Did you mean that in Dymola, when you try to move a Inertia with a positif Torque, at the beginning of the movement the speed is negative as well as the position ?

I m sorry but i dont consider this result as normal...

Try to move a pen clockwise with your finger, and look if it s go countercloclwise... i don't think it will.

Jun-09-11 11:16:18
Motor model - Comparaison between Openmodelica and 20sim

I'm modeling a motor: as a torque source, a bearing friction (rotational), an ideal gear and an inertia. The torque source is control with a sinus source.
By looking the result of the simulation in OMEdit, i was skeptic, in fact at the begining of the simulation, the sinus source is positif and rises to 2 (is maximal amplitude) but the rotational speed and the position of the inertia are, during the transition phase, Negatives !

Then I try with 20sim, wich is an other physical modeling software. With the same parameters and same components, the simulation results are differents. In 20sim the results are corrects because there is no negative values for the rotationnal speed and position.

Parameters :

- sinus : freq 1Hz, Amp : 2 (if =1  : problem)
- bearing friction : [0,1], peak : 0.5
- ideal gear : ratio = 10
- inertia = 0.001

Here are screenshots from my models and their respective results.
OpenModelica model :
http://imagik.fr/thumb/429508.jpegimagik.fr

20sim model :
http://imagik.fr/thumb/429507.jpegimagik.fr

OpenModelica simulation results :
http://imagik.fr/thumb/429510.jpegimagik.fr

20sim simulation results :
http://imagik.fr/thumb/429511.jpegimagik.fr


could anyone explain me why is there a différence ? what need i do to avoid that ?
Is there any problems with OMC ?

I've got other problems :
- if the torque source is not enough "powered" (amplitud from the sinus source = 1 ), OMEdit stay in a loop : ...\OpenModelica\tmp\OMEdit\ NameOfMyModel_res becomes bigger but i never get my results... Is there no watch dog for this kind of issue?

that the results with 20sim for sinus.Amplitude = 1
http://imagik.fr/thumb/429515.jpegimagik.fr

I forget to say, I m working with OpenModelica 1.7.0 on a windows XP pro 64bits


kind regards
Thomas

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