Saarland University
Lehrstuhl für Automatisierungstechnik

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Bouncing problem (Modelica in Scilab/Scicos implementation)
Daniel_Nitecki
post Feb 28 2009, 03:38 PM
Post #1


Newbie
*

Group: Members
Posts: 1
Joined: 28-February 09
Member No.: 31,842



Hi,
I'm another newbie in Modelica wink.gif

In general my problem is connected with demo "bouncing ball", which is implemented in Scilab's help.
  • I use Modelica language in Scicos's MBLOCK element.
  • Attachment contains a picture that describes the model: Attached Image
  • I can't attach a .cos file, because of some forum's problem, so I did a print screen Attached Image
Variables for "From workspace" blocks can be generated like this:
CODE

k=struct('values',=10*ones(100+1,1),'time',[0:100]');
v_koncowe=struct('values',12.81*ones(100+1,1),'time',[0:100]');
masa_wozka=struct('values',10*ones(100+1,1),'time',[0:100]');
dlugosc_toru=struct('values',37.61*ones(100+1,1),'time',[0:100]');
punkt_zwolnienia=struct('values',12.19*ones(100+1,1),'time',[0:100]');
max_dlugosc_hamowania=struct('values',(2.5+37.61)*ones(100+1,1),'time',[0:100]');



Here is the model in Modelica block:

CODE

class zderzenie
      //input variables
      Real k,v_koncowe,masa_wozka,dl_toru,punkt_zwolnienia;
      //output variables
      Real x,v,a;

equation    
der(x)=v;
der(v)=a;

a =    if (x<=punkt_zwolnienia and v>=0) then (v_koncowe*v_koncowe)/(2*punkt_zwolnienia)
    else if (x>dl_toru) then -k*(x-dl_toru)/masa_wozka
    else if (x<=punkt_zwolnienia and v<0) then 0
    else 0;

when x<punkt_zwolnienia and v<0 then
  reinit(v,-v);
end when;

end zderzenie;


My question is:
Why reinit(v,-v); doesn't work?

Currently I get the blue process on Graphic 1: Attached Image
My goal is to achieve the red-dotted "bounce".

Please help me with this problem.

Best regards
Daniel
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 23rd January 2019 - 02:51 AM