// Simulation EPaper Cell 

`include "disciplines.vams"
`include "constants.vams"
`include "otft.va"

module am_epd_pixel(gate, source, n);
   electrical gate, source, n;
   ground n;
   electrical v_cell;
   
   // v_cell ist am drain vom oTFT
   oTFT #(.selectQS(0), .LOV(0), .eBov(0)) tft1(gate, source, v_cell); 
   resistor #(.r(67.445e9)) EPDload(v_cell, n); 
   capacitor #(.c(8.6e-12)) CS(v_cell, n);
endmodule // am_epd_pixel

module demo;
   electrical v_gate, v_source, gnd;
   ground gnd;

   parameter real on_V = 0.0;
   parameter real off_V = 7.5;

   parameter real on_T = 0.5m;
   parameter real off_T = 16.7m-on_T;
   parameter real startDelay = 1m;

   // Puls-Quelle 
   /*prameters expected for 'pulse' are '[dc] [mag [phase]] val0 val1 [td [rise [fall [width [period]]]]] */
   vpulse #(.val0(off_V), .val1(on_V), .td(startDelay), .rise(1n), .fall(1n), .width(on_T), .period(on_T + off_T)) PL(v_gate, gnd);

   parameter real on_V2 = 5.0;
   parameter real off_V2 = 0.0;

   parameter real on_T2 = 3m;
   parameter real off_T2 = 16.7m-on_T2;
   parameter real startDelay2 = 0;

   vpulse #(.val0(off_V2), .val1(on_V2), .td(startDelay2), .rise(1n), .fall(1n), .width(on_T2), .period(on_T2 + off_T2)) PL2(v_source, gnd);

   // Pixel
   am_epd_pixel pixel1(v_gate, v_source, gnd);
endmodule // demo 
