Hiya,
Right my code is below. Basically I have to right a peice of software for a water filter. It is a large tank with and inlet_gate at one end, an outlet_gate and a dirty wash water outlet at the other end of the tank (the dirty wash water gate is not shown because I couldn't get the simple stuff to work). It has sand on the bottom to filter water, the dirty wash water and inlet gates are opposite each other, and the outlet gate is under the sand to let clean water out to drink.
The inputs are turbitidty (lumps in the water), loss_of_head (dirt in the sand), dayly (timer every 24hrs), manual (operator pushes button), clk (clock). When one of these inputs displays a fault e.g. goes to 1 then an alarm signal is raised, this then closes the inlet gate (should really go from '1' to '0' but mine goes the other way around). After a short time period e.g. 5secs the water will have drained out of the filter to a level, hence the level should go to '1', then the outlet should close. Once both gates are closed no more water can come into or leave the filter. Next an air scourer vavle would open and a pump would run for 20 secs, this is air that disturbs the sand. After this has finished a short time in left for the sand and dirt to settle, then a backwash valve and pump start, this pumps water up from underneath the filter sand to lift the dirt up into a channel which then flows out the dirty wash water gate. Once this is done it closes again after say 15 sec then the inlet gate opens and the filter fills up to its original level and continues to filter, opens the outlet.
e.g.
1. Dayly - time to wash the filter
2. Inlet closes
3.Water drains down to level
4. Outlet valve closes
5 Air valve/pump runs for 20 secs
6. Settle time of 10 secs
7. Backwash valve opens/pump runs for 10 secs
8. Dirty wash water opens for 15 secs
9. Backwash valve closes/pumps stops
9. Dirty wash water closes
12. Inlet gate opens
13. Fills to level
14. Outlet gate opens (filtering again)
15. Reset alarm and inputs
--Andrew Cadey
library ieee;
use ieee.std_logic_1164.all;
entity wash is --Wash sequence entity
port (turbitidty, loss_of_head, dayly, manual, clk : in std_logic;
alarm, inlet_gate, outlet_gate, level, air_scourer_valve_pump, backwash_valve_pump :buffer std_logic);
end wash;
architecture wash of wash is -- timer settings
begin
process
begin
wait until clk='1' and clk'event;
if dayly='1' or loss_of_head='1' or turbitidty='1' or manual='1'
then alarm<='1';
else alarm<='0';
end if;
if alarm<='0'
then inlet_gate<='0';
else inlet_gate<='1';
end if;
if inlet_gate<='0'
then level<='0';
else level<='1';
end if;
if level<='0'
then outlet_gate<='0';
else outlet_gate<='1';
end if;
if outlet_gate<='0'
then air_scourer_valve_pump<='0';
else air_scourer_valve_pump<='1';
end if;
if air_scourer_valve_pump<='0'
then backwash_valve_pump<='0';
else backwash_valve_pump<='1';
end if;
end process;
end wash;
Ideal system overveiw is : (washing on dayly input)
Clk _-_-_-_-_-_ etc
Turbitidty __________________________________________________
Dayly __----------------------------------------------------------------------______
Loss of head ______________________________________________________
Manual ______________________________________________________
Alarm __-----------------------------------------------------------------------______
Inlet ----______________________________________________-----------
Outlet ----______________________________________________-----------
Level __________---------------------------------------------------------________
Air pump/valve _______________________--------------------____________________
Backwash pump/valve ____________________________________------------------________
Washout ___________________________________ ------------------________
Hope this helps, sorry not very good at this, and help is much appreciated.
AnDy dippytw@hotmail.com