public class Aorta extends java.applet.Applet
{
double t,dt,i,j,Plv,PlvMax,f,Qao,Pao,Vao,Qp,Rp,Cao;
int iy=0,ix=0,n=0,youd,xoud;
public void paint(Graphics g)
{
youd = iy;
xoud = ix;
t = 0.0;
dt = 0.02;
Plv = 0.0;
PlvMax = 120.0;
f = 1.0;
Qao = 80.0;
Pao = 80.0;
Vao = 80.0;
Qp = 70.0;
Rp = 1.25;
Cao = 1.1;
i = 50.0 * t + 0.0;
j = -1.0 * Pao + 200.0;
for ( n=0; n < size().width; n=n+1 )
{
t = t + dt;
Plv = PlvMax * Math.sin (2.0 * 3.14 * f * t);
if (Plv < 0.0) Plv = 0.0;
Qao = 33.0 * (Plv - Pao);
if ((Plv-Pao) < 0.0) Qao = 0.0;
Vao = Vao + (Qao - Qp) * dt;
Qp = Pao / Rp;
Pao = Vao / Cao;
if ( t > 2.0 ) { Cao = 0.50; } // <--- a hiden case
i = 50.0 * t + 0.0;
j = -1.0 * Pao + 200.0;
iy = (int) j; // <-- the transformation of the coordinates
ix = (int) i;
System.out.println("tijd, Pao, iy: "+t+", "+Pao+", "+iy);
g.drawLine (xoud, youd, ix, iy);
xoud = ix;
youd = iy;
}
}
}
You see graphical output are drawing. See the model (of Aorta) in the html-source-code.
Enschede, 1996; updated March, 2003.