
Tank controller in VHDL-AMS
In VHDL-AMS Im trying to model a controller for a tank filled with liquid.
Qo is the outgoing flow. The input flow depends on the status of a valve and
is 0.0 or Qmax
The controller keeps the height of the liquid (h) between two levels, using
a hysteresis hhys of 0.1. If the liquid in the tank drops below
hset-hhys(=0.9), the valve is opened. If the liquid in the tank rises above
hset (=1.0) the valve is closed. The status of the valve is given using the
signal alpha, which gets his value in the process valve.
The simulation of the following process hangs at time 0.04 sec. (no. Asp=0)
If line X or line Y would be replaced with wait for 5 sec; the process
works correctly. So it seems that no more then one wait until habove(E)
statement is possible.
Is the written model illegal VHDL or is it something else?
Thanks already,
Ramon
ENTITY fill IS
END ENTITY fill;
ARCHITECTURE behav OF fill IS
QUANTITY h : real;
QUANTITY Qo : real;
signal alpha : real := 1.0;
constant A : real := 10.0;
CONSTANT h0 : real := 0.1;
CONSTANT hset : real := 1.0;
CONSTANT hhys : real := 0.1;
CONSTANT k : real := 0.5;
CONSTANT Qmax : real := 1.0;
BEGIN
break h=>0.1;
Qo==k * sqrt(h);
h'dot==((alpha * Qmax) - (Qo))/A;
break on alpha;
valve: process
begin
alpha<=1.0;
wait until h'above(1.0); --[line X]
alpha<=0.0;
wait until not(h'above(0.9)); --[line Y]
end process valve;
END ARCHITECTURE behav;