ESim/C2/Creating-a-Device-Model/English
Creating a Device Model
Author: Gloria N
Keywords: eSim, Device model, KiCad, Eeschema, Simulation, Analysis, Knee voltage, Forward characteristics, Forward current, schematic, Ngspice netlist
Visual cue | Narration |
Show Slide:
Opening Slide |
Welcome to the spoken tutorial on Creating a Device Model in eSim. |
Show Slide:
Learning Objectives |
In this tutorial, using eSim we will learn -
|
Show Slide:
Systems Requirements |
To record this tutorial, we will use-
|
Show Slide:
Prerequisites |
To practice this tutorial, you should know to-
If not, watch the prerequisite eSim tutorials on this website. |
Show Slide:
Device Models |
The device model file begins with a dot model statement.
|
Show Slide:
Device Models in eSim |
The model components are already added in eSim.
They are referred to as templates. The templates are in a tabular form with parameter names and values. The Device Model libraries are used for the components present in eSim underscore Devices. |
System Computer:
Desktop icon |
To launch eSim, you need to double-click on the eSim icon on your Desktop. |
System Computer:
eSim startup window |
I have already opened eSim. |
eSim Main Window:
Click on Model Editor |
Let us now create a Device model of a Germanium diode 1N34A.
On the eSim window, click on the Model Editor button from the left toolbar. |
Model Editor tab | The Model Editor tab opens. |
Model Editor tab:
Click New |
Click the New button in the Model Editor tab. |
Enter New Model Name as Germanium_Diode >>
Click OK |
A New Model pop-up window appears.
Type the Model Name as Germanium underscore Diode. Click on the OK button. |
Model Editor tab:
Hover the mouse on the Diode, BJT,MOS options below. |
A list of model components appears on the left corner of the Model Editor tab.
These are the models you can choose from. |
Model Editor tab:
Click on Diode. Hover the cursor on the Parameter and Value column. |
Since we are creating a new model of a Diode, click on Diode.
The diode model opens up in a tabular form with the Parameter name and value. You can see the default values. |
Show Slide:
Code File |
Let us now add the spice parameters of Germanium diode.
The parameters of Germanium Diode model 1N34A can also be downloaded from the Code File section. Download and open the file in a text editor. Copy-paste the parameter values in the respective text-box in the Model Editor window. |
Model Editor tab:
Enter the values in the tabular column. |
Here I am entering the values.
To enter a value, click on the value field. Enter Rs as 7. Enter Cjo as 0.5 exponential minus 12. Enter N as 1.3. Enter Ibv as 0.018. Enter tt as 144 exponential minus 9. Enter M as 0.27. Enter Vj as 0.1. Enter Is as 2.0 exponential minus 7. Enter Bv as 75. The sequence of parameters may vary. |
Model Editor tab:
Hover the mouse on ADD and 'Delete buttons. Click Save. |
You can also add or delete the parameter.
After the parameters are entered, click on the Save button in the Model editor tab. |
eSim Main Window:
Click OK. |
An information pop-up window, 'Model saved successfully is displayed.
Click on the OK button. These libraries will be saved in the Diode folder of deviceModelLibrary directory. If the component model was chosen as BJT, then the library would be saved in the Transistor folder. Each template chosen will be saved in their respective folders of deviceModelLibrary directory. |
eSim Main Window: | Now let us simulate the characteristics of Germanium Diode. |
eSim Main Window:
Click on Open Project from the top toolbar >> Double click on eSim-2.0 >> Click on Examples>> select Diode_characteristics >> click Open. |
We will open the Diode characteristic example from the Examples folder of eSim.
On the eSim window, click on the Open Project button from the top menu. Locate the directory where the eSim is installed. Double-click on the Examples folder. Scroll down and select the Diode underscore characteristics. Click on the Open button. The Diode characteristics example is added to the eSim window under Projects. |
eSim Main Window:
Select Diode_Characteristics under Projects>> Click on the Open Schematic>> Click Yes |
To see the schematic, select Diode characteristics.
Click on the Open Schematic button from the left toolbar. It directs us to the schematic editor. |
eSim Schematic editor:
Press F1 key. |
Press F1 key to zoom in the schematic. |
eSim Main Window:
Select Diode_characteristics>> click on Convert Kicad to Ngspice |
Let us go back to the eSim window.
Select the Diode underscore characteristics. Click on the Convert Kicad to Ngspice button from the left toolbar. |
Kicad to Ngspice Converter:
Analysis Tab >> Select DC Enter the values. |
Select DC in the Analysis tab.
Scroll down to enter values. Enter Source as V1. Enter Start as 0. Enter Increment as 0.1. Enter Stop as 2. |
Kicad to Ngspice Converter:
Source Details Tab: Enter 1 for DC source V1. |
In the Source Details tab, enter value as 1. |
Kicad to Ngspice Converter:
Device Modeling Tab Click on ADD>> Double click on Diode folder>> click on 'Germanium_ Diode.lib file>> click Open. |
Skip the Ngspice Model tab.
Click on the 'Device Modeling tab, click on the ADD button. Double-click on the Diode folder. Select Germanium underscore Diode dot lib file. Click on the Open button. This adds the Germanium Diode library file from the Diode folder. |
Kicad to Ngspice Converter:
Click on Convert>> Click OK |
On the Kicad to Ngspice tab, click on the Convert button.
Click on the OK button in the Information dialog box. |
eSim Main Window:
Click on Simulation. |
Now, let us simulate the Ngspice netlist.
On the eSim window, click on the Simulation button from the left toolbar. An Ngspice terminal and plot window opens along with a Python plot window. |
Ngspice Window:
Maximize the i(v_u1) ngspice plot. Hover the mouse on X-axis to point voltage. Hover the mouse on Y-axis to point current. On Ngspice terminal, hover the mouse on .model Germanium_Diode. |
The plot waveforms show DC analysis of the Germanium Diode model 1N34A.
This diode has a knee voltage or turn-on voltage around 0.3. The forward current is around 1.7 milliampere. Close the Ngspice plot and Ngspice terminal windows. |
Python Plot Window:
Check In and Out node>> click Plot Hover the mouse on python plots after plot. |
In the Python plot window, check the In node and Out node.
And click on the Plot button. You can see the forward characteristics of the Germanium diode. Close the Python plot window. |
Show Slide:
Shockley Diode Equation |
The Shockley diode equation relates the diode current I with the diode voltage Vd.
The main spice parameters that determine the DC analysis are
For an ideal diode, N is equal to 1. This factor mainly accounts for carrier recombination. |
eSim Main Window:
Click on 'Model Editor>> Click on EDIT >> Double click on Diode folder >>click on Germanium_Diode >> click Open Click on N value>> enter 4.0>> click 'Save>> click OK |
Now let us learn how to edit a model library.
On the eSim window, click on the 'Model editor button from the left toolbar. We will edit the Germanium diode parameters. On the Model editor tab, click on the Edit button. Double-click on the Diode folder. Select Germanium underscore diode dot lib file. Click on the Open button. A tabular form of Germanium Diode parameters and its corresponding values will appear. Let us now change the value of the parameter N . Click on the parameter N Value field and enter 4. Click on the SAVE button in the Model editor tab. In the Information dialog box, click on the OK button. |
eSim Main Window:
Select Diode_characteristics>> click on Convert Kicad to Ngspice>> Click on Device Modeling Tab Click on ADD>> Double click on Diode folder>> click on Germanium_ Diode.lib file >> click Open.
|
Let us now simulate the characteristics.
On the eSim window, select Diode underscore Characteristics. Click on Convert Kicad to Ngspice button from the left toolbar. Let us keep the default values for the Analysis tab and the Source Details tab. Skip the Ngspice Model tab. Click on Device Modeling tab. Click on the ADD button. Double-click on the Diode folder. Select Germanium underscore Diode dot lib file and click on the Open button. This step was done because we have edited the Germanium diode library file. |
eSim Main Window:
Click on Convert>> click OK Click on Simulation.
|
On the Kicad to Ngspice tab, click on the Convert button.
Click on the OK button in the Information dialog box. Let us now generate the plots. On the eSim window, click on the Simulation button from the left toolbar. |
Ngspice terminal and plots
Maximize the i(u,v1) ngspice plot. Point the cursor on the X-axis for voltage. Point the cursor on the Y-axis for the current. |
The Ngspice terminal and plots opens along with the Python plot.
Notice a decrease in the forward characteristics. The knee voltage is around 0.5 volts, which is similar to a Silicon diode. The forward current is 1.1 milliampere. Close the Ngspice terminal and plots. |
Python Plot:
Check In and Out node>> click Plot
|
In the Python plot window, check the In and Out nodes.
Then click on the Plot button. You can see the input and output plot. Now close the Python plot window. |
Show Slide:
Summary |
Let us summarise.
In this tutorial, we learnt:
|
Show Slide:
Forum to answer questions |
Do you have questions in this Spoken Tutorial?
Choose the minute and second where you have the question. Explain your question briefly. Someone from the FOSSEE team will answer them. Please visit this site. |
Show Slide:
FOSSEE Forum |
For any general or technical questions on eSim, visit the FOSSEE forum and post your question. |
Show Slide:
Circuit Simulation |
The FOSSEE team coordinates the Circuit Simulation project.
We give Certificates and Honorarium to the contributors. For more details, please visit this site. |
Show Slide:
Lab Migration |
The FOSSEE team coordinates the Lab Migration project.
For more details, please visit this site. |
Show Slide:
Acknowledgment |
Spoken Tutorial Project is funded by NMEICT, MHRD, Govt. of India.
For more details, visit this site. |
Thank you slide | This is Gloria N from IIT Bombay signing off.
Thank you |