Geoffrey_Coram 
		
	 | 
	
		
		 
			@(initial_step) integ = 0;
  @(cross(V(ctrl), +1)) integ = 1; // triggers when V(ctrl) crosses 0 in the positive direction @(cross(V(ctrl)-2,+1)) integ = 0; // triggers when V(ctrl) crosses 2 in the positive direction
  V(out) <+ idt(integ * V(in), 0);
 
  Note that V(ctrl) must start below zero, or else the cross function won't detect a crossing. 
		 
	 |