Southampton VHDL-AMS Validation Suite

School of Electronics and Computer Science, University of Southampton

 

  Home Example Models Web Parser Acknowledgement ESD Group ECS University of Southampton
 

Van der Pol Oscillator

Lorenz Chaos

Bouncing Ball

Level3 MOS Transistor

Bipolar Transistor with Thermal Effects

AnalogueSchmitt Trigger

VoltageControlled Oscillator with Integration of Phase

Phase-Locked-LoopFrequency Multiplier

Switch-modePower Regulator

Ferromagnetic Hysteresis

Sigma-Delta Modulator

MEMS Accelerometer with SD control loop

 

 

MEMS Accelerometer with Sigma-Delta control loop

 

<<Previous<<        >>Next>>

 

-- VHDL-AMS model of MEMS accelerometer with Sigma-Delta control loop
-- (c) Southampton University 2009
-- Southampton VHDL-AMS Validation Suite
-- author: Chenxu Zhao and Tom J Kazmierski
-- School of Electronics and Computer Science, University of Southampton
-- Highfield, Southampton SO17 1BJ, United Kingdom
-- Tel. +44 2380 593520   Fax +44 2380 592901
-- e-mail: cz05r@ecs.soton.ac.uk, tjk@ecs.soton.ac.uk
-- Created: 03 April 2009
-- Last revised:  03 April 2009 (by Chenxu Zhao)


-- Description
-- This is a distributed model for MEMS sensing element. The model includes
-- sense finger dynamics which allow accurate performance prediction of a MEMS

-- accelerometer in a Sigma-Delta control loop

--------------------------------------------------------------------------------

 

 

1. VHDL-AMS Model of mechanical sensing element

 

library IEEE;
use
IEEE.ENERGY_SYSTEMS.all;
use
IEEE.ELECTRICAL_SYSTEMS.all;
use
IEEE.MECHANICAL_SYSTEMS.all;
use
IEEE.MATH_REAL.all;


entity
COMB_DRIVE is


generic(
        
N1: real :=50.0;    --Number of sense fingers
         N : real :=5.0;     --Number of sections
         L : real :=1.50e-4; --Finger length
         E: real :=1.3e+11;  --Young's modulus
         I: real:=0.17e-24;  --Moment of inertia
        
rou: real:=2330.0;  --Density
         d0: real:=1.5e-6;   --Initial gap
         K: STIFFNESS:=100.0;--Spring stiffness
         D:DAMPING:=0.005;   --Damping constant
        
S:real:= 2.0e-6*1.0e-6; --Cross section area
         C: real:=0.01e-20;  --Internal damping modulus of finger
         M:MASS:=3.0e-7      --Mass
       );
port(
      terminal
PROOF_MASS,PROOF_MASS1,PROOF_MASS2,PROOF_MASS3: TRANSLATIONAL;

      terminal PROOF_MASS4,PROOF_MASS5, REF : TRANSLATIONAL;
      terminal
MID_EL : ELECTRICAL
    );


end entity
COMB_DRIVE;

architecture
BCR of COMB_DRIVE is

   quantity
FE1,FE2,FE3,FE4:REAL;   --Electrostatic force
   quantity
Y: REAL;                --Average position of sense fingers
   quantity
dx: REAL;               --Length of each section
   quantity
A:REAL;                 --Area of each section

   quantity VM across IM through MID_EL to electrical_ref;

   quantity
x across F0 through PROOF_MASS to REF;
   quantity
y0 across F through PROOF_MASS1 to REF;
   quantity
y1 across F1 through PROOF_MASS2 to REF;
   quantity
y2 across F2 through PROOF_MASS3 to REF;
   quantity
y3 across F3 through PROOF_MASS4 to REF;
   quantity
y4 across F4 through PROOF_MASS5 to REF;


begin


   dx==L/N;
   A== 2.0e-6*L/N;


--Electrostatic forces along the finger--
  
FE1==0.5*8.85e-12*A* ( 9.0 /((d0-y1)**2)-9.0/((d0+y1)**2));
   FE2==0.5*8.85e-12*A* ( 9.0 /((d0-y2)**2)-9.0/((d0+y2)**2));
   FE3==0.5*8.85e-12*A* ( 9.0 /((d0-y3)**2)-9.0/((d0+y3)**2));
   FE4==0.5*8.85e-12*A* ( 9.0 /((d0-y4)**2)-9.0/((d0+y4)**2));


-- Sense finger is diveded into 5 segments--
  
E*I*(Y3-4.0*Y2+6.0*Y1-3.0*Y0)/dx**4+ROU*S*Y1'DOT'DOT+C*(Y3'DOT-

   4.0*Y2'DOT+6.0*Y1'DOT-3.0*Y0'DOT)/dx**4==(F1+FE1)/dx;

   E*I*(Y4-4.0*Y3+6.0*Y2-4.0*Y1+Y0)/dx**4+ROU*S*Y2'DOT'DOT+C*(Y4'DOT-

   4.0*Y3'DOT+6.0*Y2'DOT-4.0*Y1'DOT+Y0'DOT)/dx**4==(F2+FE2)/dx;

   E*I*(-2.0*Y4+5.0*Y3-4.0*Y2+Y1)/dx**4+ROU*S*Y3'DOT'DOT+C*(-

   2.0*Y4'DOT+5.0*Y3'DOT-4.0*Y2'DOT+Y1'DOT)/dx**4==(F3+FE3)/dx;

   E*I*(Y4-2.0*Y3+Y2)/dx**4+ROU*S*Y4'DOT'DOT+C*(Y4'DOT-2.0*Y3'DOT+Y2'DOT)

   /dx**4==(F4+FE4)/dx;

--Structural mass motion equation--
   M*X'DOT'DOT+D*X'DOT+K*X==F0;
   y0==X;
   Y==(Y1+Y2+Y3+Y4+Y0)/5.0;
   VM==N1*Y/D0;


end architecture
BCR;

 

--------------------------------------------------------------------------------

 

2. Compensator

 

library IEEE;
use IEEE.math_real.all;
use IEEE.electrical_systems.all;

entity compensator is

generic (
          K : real := 4.0; -- gain
          Fp : real := 2.0e+4; -- pole frequency
          Fz : real := 1000.0 -- zero frequency
        );
port (terminal input, output : electrical);
end entity compensator;

architecture behavioral of compensator is

quantity vin across input to electrical_ref;
quantity vout across output to electrical_ref;
constant num : real_vector := (Fz, 1.0);
constant den : real_vector := (Fp, 1.0);
 

begin
    vout == K * vin'ltf(num, den);
end architecture behavioral;

 

--------------------------------------------------------------------------------

3. Quantizer

 

LIBRARY IEEE;
USE IEEE.MATH_REAL.ALL;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.ELECTRICAL_SYSTEMS.ALL;

ENTITY quantizer IS
   GENERIC(threshod : REAL := 0.0);
   PORT(

         SIGNAL clk : IN STD_LOGIC;
         TERMINAL ip : ELECTRICAL; --input analog signal
         SIGNAL op : OUT STD_LOGIC); --output digital signal
END ENTITY quantizer;

ARCHITECTURE bhv OF quantizer IS
QUANTITY vip ACROSS ip;

BEGIN
PROCESS(clk)
BEGIN
IF(rising_edge(clk)) THEN
IF vip>threshod THEN
op <= '1';

ELSE
op <= '0';

END IF;
END IF;
END PROCESS;

END ARCHITECTURE bhv;

 

--------------------------------------------------------------------------------

4. DAC

 

LIBRARY IEEE;
USE IEEE.MATH_REAL.ALL;
USE IEEE.STD_LOGIC_1164.ALL;USE IEEE.ELECTRICAL_SYSTEMS.ALL;
use IEEE.MECHANICAL_SYSTEMS.all;

ENTITY DAC IS

PORT(SIGNAL ip : IN STD_LOGIC; -- input digital signal
QUANTITY fin: force;
TERMINAL op1: TRANSLATIONAL); -- output analog signal
END ENTITY DAC;

ARCHITECTURE bhv OF DAC IS
SIGNAL Fe : force := 0.0;
QUANTITY F through op1;

BEGIN


Fe<=35.0E-6 WHEN ip <= '0' ELSE -35.0E-6;

F==-Fe+fin;

END ARCHITECTURE bhv;

--------------------------------------------------------------------------------

5. Top level

 

library IEEE;
use IEEE.ELECTRICAL_SYSTEMS.all;
use IEEE.MECHANICAL_SYSTEMS.all;
use IEEE.MATH_REAL.all;
use IEEE.STD_LOGIC_1164.all;


entity ACCELEROMETER is
   PORT( SIGNAL clk : IN STD_LOGIC;
   quantity f :IN force);
end entity ACCELEROMETER;

architecture TOP_LEVEL of ACCELEROMETER is
   terminal SMASS,SMASS1,SMASS2,SMASS3,SMASS4,SMASS5: TRANSLATIONAL;
   terminal MID,como: ELECTRICAL;
signal output: std_logic;

begin

A1:entity WORK.COMB_DRIVE

port map (
    PROOF_MASS => SMASS,
    PROOF_MASS1 => SMASS1,
    PROOF_MASS2 => SMASS2,
    PROOF_MASS3 => SMASS3,
    PROOF_MASS4 => SMASS4,
    PROOF_MASS5 => SMASS5,
    REF => TRANSLATIONAL_ref,
    MID_EL => MID);

COM: entity compensator
     port map(input => MID, output => como);

Q : entity quantizer
     generic map(threshod => 0.0)
     port map(clk => clk,ip => como, op => output);

DAC2: entity WORK.DAC(bhv)
     port map (ip=>output,fin=>f, op1=>smass);

end architecture TOP_LEVEL;

--------------------------------------------------------------------------------

6. Testbench

 

library IEEE;
use IEEE.math_real.all;
use IEEE.std_logic_1164.all;
use IEEE.ENERGY_SYSTEMS.all;
use IEEE.ELECTRICAL_SYSTEMS.all;
use IEEE.MECHANICAL_SYSTEMS.all;

entity test is
end entity test;

architecture bhv of test is

  signal clk : std_logic;
  quantity f: force;

begin

  acc : entity ACCELEROMETER(top_level)
  port map(clk =>clk,f=>f);

process
  begin

    clk <= '1';
    wait for 0.5us;
    clk <= '0';
    wait for 0.5us;
end process;

   f==-3.0E-7*10.0*9.8*sin(MATH_2_PI*1000.0*NOW); --Input sine wave force

end architecture bhv;

--------------------------------------------------------------------------------

 

 

 

3. Simulation Results

 

 

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

 

School of Electronics and Computer Science, University of Southampton, Highfield, Southampton S017 1BJ, United Kingdom