The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Simulators >> Circuit Simulators >> zero diagonal found in Jacobian.
https://designers-guide.org/forum/YaBB.pl?num=1174829499

Message started by senyou78 on Mar 25th, 2007, 6:31am

Title: zero diagonal found in Jacobian.
Post by senyou78 on Mar 25th, 2007, 6:31am

hi,

I am coding in VerilogA and I want switched capacitor model for resistor. But capacitor is behaving very ackwardly. And when i simulate then i get zero diagonal found Jacobian. Codes for switch and capacitor are geiven . Used software is cadence.


// VerilogA  switch, veriloga

`include "constants.vams"
`include "disciplines.vams"



module switch(pc,nc,p,c);
input pc , nc;
output p , c;
electrical pc,nc,p,n;
     
 
parameter real vth =0.6;
parameter real dir = +1  from [-1:1] exclude 0;
analog begin

 @(cross(V(pc,nc)-vth, dir));
  if(V(pc,nc) > vth)
            V(p,n) <+ 0;
 else
        I(p,n) <+ 0;

     
end


endmodule






/ VerilogA for  Ca, veriloga

`include "constants.vams"
`include "disciplines.vams"

module C(p, n);

inout p, n;
electrical p, n;
parameter real c=1 from (0:inf);

analog begin
   I(p,n) <+ c*ddt(V(p,n));
end
endmodule


help would be highly appreciated.

Title: Re: zero diagonal found in Jacobian.
Post by Geoffrey_Coram on Apr 2nd, 2007, 6:25am


senyou78 wrote on Mar 25th, 2007, 6:31am:
I am coding in VerilogA and I want switched capacitor model for resistor. But capacitor is behaving very ackwardly. And when i simulate then i get zero diagonal found Jacobian. Codes for switch and capacitor are geiven . Used software is cadence.


Your capacitor looks fine to me; I suspect the switch is what's really giving you trouble.  In some simulators, it's better to explicitly declare two branches when you want a switch:



module switch(pc,nc,p,c);
 input pc , nc;
 inout p, n;
 branch (p, n) zeroi, zerov;
 electrical pc,nc,p,n;

 parameter real vth =0.6;
 parameter real dir = +1  from [-1:1] exclude 0;
 analog begin

   @(cross(V(pc,nc)-vth, dir))
     ; // for timestep control

   if(V(pc,nc) > vth)  
     V(zerov) <+ 0;
   else
     I(zeroi) <+ 0;
 end
endmodule

Title: Re: zero diagonal found in Jacobian.
Post by Geoffrey_Coram on Apr 2nd, 2007, 6:26am

This post probably should have been in "Verilog-AMS"

Title: Re: zero diagonal found in Jacobian.
Post by Ken Kundert on Apr 2nd, 2007, 7:19am

This problem is most likely caused by a switch opening up and leaving no path to ground.

Your models look okay, but be aware that connecting ideal switches to capacitors can cause a lot of trouble in the simulator as it tends to also create infinite current pulses.

-Ken

Title: Re: zero diagonal found in Jacobian.
Post by senyou78 on Apr 5th, 2007, 2:24pm

thanks for answering. :)
senyou78

Title: Re: zero diagonal found in Jacobian.
Post by jovial on Jun 27th, 2013, 9:54pm


Geoffrey_Coram wrote on Apr 2nd, 2007, 6:25am:

senyou78 wrote on Mar 25th, 2007, 6:31am:
I am coding in VerilogA and I want switched capacitor model for resistor. But capacitor is behaving very ackwardly. And when i simulate then i get zero diagonal found Jacobian. Codes for switch and capacitor are geiven . Used software is cadence.


Your capacitor looks fine to me; I suspect the switch is what's really giving you trouble.  In some simulators, it's better to explicitly declare two branches when you want a switch:



module switch(pc,nc,p,c);
 input pc , nc;
 inout p, n;
 branch (p, n) zeroi, zerov;
 electrical pc,nc,p,n;

 parameter real vth =0.6;
 parameter real dir = +1  from [-1:1] exclude 0;
 analog begin

   @(cross(V(pc,nc)-vth, dir))
     ; // for timestep control

   if(V(pc,nc) > vth)  
     V(zerov) <+ 0;
   else
     I(zeroi) <+ 0;
 end
endmodule

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

Dear Geoffrey,
I tried to use ur code as an ideal switch.
This gives the following error-
"FATAL: The following branches form a loop of rigid branches (shorts) when added to the circuit:
       V1:p (from vin to 0)
       I21:out_flow (from net2 to 0)"
Cn u plz suggest me how to solve this problem.??

Title: Re: zero diagonal found in Jacobian.
Post by boe on Jul 1st, 2013, 1:43am


jovial wrote on Jun 27th, 2013, 9:54pm:
...
I tried to use ur code as an ideal switch.
This gives the following error-
"FATAL: The following branches form a loop of rigid branches (shorts) when added to the circuit:
       V1:p (from vin to 0)
       I21:out_flow (from net2 to 0)"
Cn u plz suggest me how to solve this problem.??
You have shorted two voltage sources.
- B O E

Title: Re: zero diagonal found in Jacobian.
Post by boe on Jul 1st, 2013, 1:44am

Geoffrey,
IMO, the switch model should use a cross event for both directions.
- B O E

Title: Re: zero diagonal found in Jacobian.
Post by Geoffrey_Coram on Aug 2nd, 2013, 8:58am

Six years later, someone's looking at this old code ...  Yes, B O E, I agree that the cross event should test both directions, but it appears this was in the original model.

Title: Re: zero diagonal found in Jacobian.
Post by boe on Aug 9th, 2013, 1:59am

jovial,
A search would have given you http://www.designers-guide.org/Forum/YaBB.pl?num=1177054990

- B O E
PS: @Geoffrey: yes, it seems the original model already included the bug.

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.