|
Bouncing Ball
<<Previous<<
>>Next>>
-- VHDL-AMS model of
Bouncing Ball
-- (c) Southampton University
2005 -- Southampton VHDL-AMS
Validation Suite -- author: Tom
Kazmierski
-- Department of Electronics
and Computer Science, University of Southampton
-- Highfield, Southampton
SO17 1BJ, United Kingdom
-- Tel. +44 2380
593520 Fax +44 2380 592901
-- e-mail: tjk@ecs.soton.ac.uk
-- Created: 28 May 1997
-- Last revised:
1 September 2005 (by Shaolin Wang)
--
--------------------------------------------------------------------------------
--1. VHDL-AMS Model & Testbench of
Bouncing Ball
library IEEE;
use IEEE.mechanical_systems.all;
entity bouncer is
end entity bouncer;
architecture simple of bouncer is
quantity v: velocity;
quantity s: displacement;
constant G: real := 9.81;
constant Air_Res: real := 0.03;
signal vchange: velocity:=0.0;
-- used to record v at s=0
begin
if domain=quiescent_domain use
-- Specify initial conditions
s==10.0;
v==0.0;
else
s'dot == v;
if not s'above(0.0) use
-- v changes sign at s=0
v==-vchange;
elsif v > 0.0 use
-- acceleration when going up
v'dot == -G -
v**2*Air_Res;
else
-- acceleration when falling down
v'dot == -G +
v**2*Air_Res;
end use;
end use;
-- announce discontinuity and reset velocity value at s-0
break when not s'above(0.0);
-- record v in vchange when s=0
process(s'above(0.0))
begin
if not s'above(0.0) then
vchange<=v;
end if;
end process;
end architecture simple;
-----------------------------------------------------------------------
--2. Simulation Results

<<Previous<<
>>Next>>
Top^
|