The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Aug 3rd, 2024, 3:16am
Pages: 1
Send Topic Print
zero diagonal found in Jacobian. (Read 17440 times)
senyou78
New Member
*
Offline



Posts: 9
germany
zero diagonal found in Jacobian.
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.
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: zero diagonal found in Jacobian.
Reply #1 - 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
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: zero diagonal found in Jacobian.
Reply #2 - Apr 2nd, 2007, 6:26am
 
This post probably should have been in "Verilog-AMS"
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2386
Silicon Valley
Re: zero diagonal found in Jacobian.
Reply #3 - 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
Back to top
 
 
View Profile WWW   IP Logged
senyou78
New Member
*
Offline



Posts: 9
germany
Re: zero diagonal found in Jacobian.
Reply #4 - Apr 5th, 2007, 2:24pm
 
thanks for answering. Smiley
senyou78
Back to top
 
 
View Profile   IP Logged
jovial
Junior Member
**
Offline



Posts: 19

Re: zero diagonal found in Jacobian.
Reply #5 - 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.??
Back to top
 
 
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: zero diagonal found in Jacobian.
Reply #6 - 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
Back to top
 
 
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: zero diagonal found in Jacobian.
Reply #7 - Jul 1st, 2013, 1:44am
 
Geoffrey,
IMO, the switch model should use a cross event for both directions.
- B O E
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: zero diagonal found in Jacobian.
Reply #8 - 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.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: zero diagonal found in Jacobian.
Reply #9 - 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.
Back to top
 
 
View Profile   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.