I'm another newbie in Modelica
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: Click to view attachment
- I can't attach a .cos file, because of some forum's problem, so I did a print screen Click to view attachment
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: Click to view attachment
My goal is to achieve the red-dotted "bounce".
Please help me with this problem.
Best regards
Daniel