Simulation of Analog Devices AD8232 Chip

Discussion on both general simulation and Proteus VSM microcontroller simulation.
Locked
rintronic
Professional User
Posts: 32
Joined: Mon 2009-09-21 21:06

Simulation of Analog Devices AD8232 Chip

Post by rintronic »

Hi everybody,

I am helping a group of students at the USB university who are designing some circuits around the AD8232 chip.

They have downloaded the Spice model from Analog Devices but it doesn't work correctly in Proteus simulation, we understand that we must adapt it but can't find as yet how to make the "if" statements to work, other than that the rest of the model works.

These are the 3 statements that cause problems, if we change those lines with static values or statements without the "if", they work.

EV38 17 0 VALUE = { if(V(VVV)<0,-V(VVV)+50m,V(VVV)+50m) }
GI16 ppp 0 VALUE = { if(V(VVV)<0,V(YYY)*.17*(V(VVV)/-.3),0) }
GI15 ppp 0 VALUE = { if(V(VVV)>0,V(XXX)*.17*(V(VVV)/.3),0) }

The complete script is attached.

Thanks a lot for your help.

Regards,

Roberto Iglesias
Attachments
AD8232.rar
(1.84 KiB) Downloaded 105 times
Ettore
Labcenter Staff
Posts: 2935
Joined: Fri 2006-03-03 11:56
Location: Milan
Contact:

Re: Simulation of Analog Devices AD8232 Chip

Post by Ettore »

These are the translation that (hopefully) work and you were searching for.
I have tested them all alone and found consistent results, however I didn't test them in the model.

EV38 17 0 VALUE = { if(V(VVV)<0,-V(VVV)+50m,V(VVV)+50m) }
Translated to:
EV38 17 0 VALUE = { (1-U(V(VVV)))*(-V(VVV)+50e-3)+(U(V(VVV)))*(V(VVV)+50e-3) }
or (should be equivalent):
EV38 17 0 VALUE = { ABS(V(VVV))+50e-3 }

GI16 ppp 0 VALUE = { if(V(VVV)<0,V(YYY)*.17*(V(VVV)/-.3),0) }
Translated to:
GI16 ppp 0 VALUE = { (1-U(V(VVV)))*(V(YYY)*0.17*V(VVV)/0.3) }

GI15 ppp 0 VALUE = { if(V(VVV)>0,V(XXX)*.17*(V(VVV)/.3),0) }
Translated to:
GI15 ppp 0 VALUE = { (U(V(VVV)))*(V(XXX)*0.17*V(VVV)/0.3) }

It should be noted that models written for PSPICE may not to work correctly sometime even if they have been translated correctly.
It is a matter of the PSPICE engine solver which is obviously different than the one implemented in SPICE3F5. In such the specific case you might find issues with U function used in the translation, in particular you may get convergence problems because of discontinuity around the switching points.

Do not duplicate topics in different forum sections, please.
Kind regards,
Ettore Arena - Labcenter Electronics.
rintronic
Professional User
Posts: 32
Joined: Mon 2009-09-21 21:06

Re: Simulation of Analog Devices AD8232 Chip

Post by rintronic »

Hi Ettore,

Thanks for your reply and solutions.

The model now works although the general gain of the circuit is too low, but waveforms are correct, will check the rest of the circuit.

Regarding PSpice and Spice3F5, where can I find more information regarding these topics, as I spent a lot of days and nowhere I could find information about U or V functions.

Thanks a lot for your help.

Regards,

Roberto Iglesias
rintronic
Professional User
Posts: 32
Joined: Mon 2009-09-21 21:06

Re: Simulation of Analog Devices AD8232 Chip

Post by rintronic »

Hi Ettore,

Performing more testings we have some doubts, and we are not experts with PSpice so we would like to ask you if you could explain the following:

Your first solution for EV38 is ok as it actually does what it is meant as to keep the VALUE positive and over 50mv.
* Original: EV38 17 0 VALUE = {if((V(VVV)<0,-V(VVV)+50m,V(VVV)+50m))}*
* Optional Solution: EV38 17 0 VALUE = { ABS(V(VVV))+50e-3 }*
FIRST SOLUTION: EV38 17 0 VALUE = { (1-U(V(VVV)))*(-V(VVV)+50e-3)+(U(V(VVV)))*(V(VVV)+50e-3) }

For the second and third we as yet don't understand the use of the unitary step function as:
Second:
* Original: GI16 ppp 0 VALUE = { if(V(VVV)<0,V(YYY)*.17*(V(VVV)/-.3),0) }*
Solution: GI16 ppp 0 VALUE = { (1-U(V(VVV)))*(V(YYY)*0.17*V(VVV)/-0.3) }
In this case, we understand that if the evaluation of V(VVV) is greater than 0, VALUE = 0.
We don't understand how we can get 0 for positive values, and we should have two results for two different conditions.

Third:
* ORIGINAL: GI15 ppp 0 VALUE = { if(V(VVV)>0,V(XXX)*.17*(V(VVV)/.3),0) }*
Solution: GI15 ppp 0 VALUE = { (U(V(VVV)))*(V(XXX)*0.17*V(VVV)/0.3) }
In this case, we understand that if the evaluation of V(VVV) is less than 0, VALUE = 0.
We don't understand how we can get 0 for negative values, and we should have two results for two different conditions.

We tried all day to look for information about the use of this function on PSPICE and have found nothing, if you could please help us in this matter we will appreciate it very much.

Thanks a lot for your help.

Regards,

Roberto Iglesias
Ettore
Labcenter Staff
Posts: 2935
Joined: Fri 2006-03-03 11:56
Location: Milan
Contact:

Re: Simulation of Analog Devices AD8232 Chip

Post by Ettore »

In Proteus PROSPICE implementation (PROSPICE is based on SPICE3F5 version for Proteus) the unit step function "u(x)" gives 0 for x<0 and 1 for x>0.
The logic is: if the voltage at the node V(VVV) is less than 0 then the term 1-U(V(VVV)) is 1 so the whole expression is evaluated as 1*(V(YYY)*0.17*V(VVV)/0.3.
If, conversely, the node V(VVV)>0 then the expression (1-U(V(VVV)))*(V(YYY)*0.17*V(VVV)/0.3 is evaluated as 0 as 1-U(V(VVV))) is 0.
In the third line the logic is reverted.

The logic above is referred to SPICE not PSPICE(R) as Proteus uses an enhanced version of SPICE3F5.
If you need PSPICE(R) information you should search them to other specialized sources. PSPICE(R) is a trademark of Cadence(R).

At any rate you find all you need to know about Berkeley’s SPICE3 in the book 'THE SPICE BOOK' by Andrei Vladimirescu, ISBN 0-471-60926-9.
Kind regards,
Ettore Arena - Labcenter Electronics.
rintronic
Professional User
Posts: 32
Joined: Mon 2009-09-21 21:06

Re: Simulation of Analog Devices AD8232 Chip

Post by rintronic »

Hi Ettore,

Ok, finally got it, thanks a lot for your explanations and help.

Will take a look at the information you mentioned.

Thanks a lot.

Regards,

Roberto Iglesias
rintronic
Professional User
Posts: 32
Joined: Mon 2009-09-21 21:06

Re: Simulation of Analog Devices AD8232 Chip

Post by rintronic »

Hi Ettore,

Just another question for the AD8232 model.

The students at the USB university were using the model you helped us to adapt and it fails again with some simulations.

I know I requested your help for another part already but would like to ask you again if you could please take a look at the AD8232 AFE chip, and produce the complete Spice model for Proteus.

I think that the problem is that it has received a lot of patches and now there are a lot of problems.

Thanks a lot for your attention and support.

Regards,

Roberto Iglesias
Ettore
Labcenter Staff
Posts: 2935
Joined: Fri 2006-03-03 11:56
Location: Milan
Contact:

Re: Simulation of Analog Devices AD8232 Chip

Post by Ettore »

rintronic wrote: Fri 2021-03-12 4:33 ...it fails again with some simulations.
This is just a little point for me to judge what's going wrong.
If I cannot see at your modified model I can't tell if this has been modified following the suggestion.

However, and just for your info, there are a number of features not supported by the original AD model (if that's the problem).
Actually the pins LOD- and LOD+, SW, AC/DC, SDN, FR are connected to the internal node 32 but they are doing nothing.
Of course I'm not going to modify the original model and support what Analog Device did not!

At any rate I do confirm that with lines I've suggested above I get the same LTspice results. This is more than suffice for me.
Attachments
Immagine 2021-03-15 110736.jpg
Immagine 2021-03-15 110736.jpg (291.34 KiB) Viewed 830 times
Immagine 2021-03-12 172043.jpg
Immagine 2021-03-12 172043.jpg (336.02 KiB) Viewed 830 times
Kind regards,
Ettore Arena - Labcenter Electronics.
rintronic
Professional User
Posts: 32
Joined: Mon 2009-09-21 21:06

Re: Simulation of Analog Devices AD8232 Chip

Post by rintronic »

Hi Ettore,

We have edited the if statements with your suggestions but still the model doesn't work for us.

I have attached it here so that you can verify if there is an error on file.

Thanks.

Regards,

Roberto Iglesias
AD8232.rar
AD8232 modified
(1.84 KiB) Downloaded 124 times
Ettore
Labcenter Staff
Posts: 2935
Joined: Fri 2006-03-03 11:56
Location: Milan
Contact:

Re: Simulation of Analog Devices AD8232 Chip

Post by Ettore »

I had to fix the line GI16 for negative denominator.
Additionally I have modified the line .model DX D(IS=5) to .model DX D(IS=5e-005) as this is a more reasonable IS value for SPICE3F5 engine.
I'm attaching the Proteus file with the configuration supported by the Analog Device model; this configuration simulates in LTspice as well.
Other configurations may not to work because of not supported features I mentioned above.
AD8232.zip
(36.92 KiB) Downloaded 102 times
Kind regards,
Ettore Arena - Labcenter Electronics.
rintronic
Professional User
Posts: 32
Joined: Mon 2009-09-21 21:06

Re: Simulation of Analog Devices AD8232 Chip

Post by rintronic »

Hi Ettore,

We tested the model you corrected and it finally works ok for the lab's purposes at the university, as you said there are things not implemented by AD so we will skip them.

Again thanks a lot for your help.

Regards.

Roberto Iglesias
Ettore
Labcenter Staff
Posts: 2935
Joined: Fri 2006-03-03 11:56
Location: Milan
Contact:

Re: Simulation of Analog Devices AD8232 Chip

Post by Ettore »

Good, so topic closed.
Kind regards,
Ettore Arena - Labcenter Electronics.
Locked