This example shows how to convert a metal–oxide–semiconductor field-effect transistor (MOSFET) subcircuit into an equivalent Simscape™ component and compare the Spice and Simscape plots for some standard MOSFET characteristics, namely Id versus Vgs, Id versus Vds, Qiss/ Gate charge, Qoss/ Output charge, and Breakdown voltage. The
subcircuit2ssc function converts all the subcircuit components inside a SPICE netlist file into one or more equivalent Simscape files.
In this example, you will convert this MOSFET subcircuit to a Simscape component. To open the SPICE netlist, in the MATLAB command window, enter edit IAUC100N04S6L014.cir.
Run this command to convert the SPICE subcircuit of the
IAUC100N04S6L014.cir model to a Simscape component and place the generated files in the newly created directory called
iauc100n04s6l014.ssc file stored in the
+myMOSFET directory is the converted Simscape component obtained by running the
subcircuit2ssc function on the modified SPICE netlist. The
subcircuit2ssc function also converted all the functions implemented in the SPICE subcircuit. To edit the generated simscape component, in the MATLAB command window, enter edit +myMOSFET/iauc100n04s6l014.ssc.
subcircuit2ssc function fully imports this particular subcircuit, with no need for any further manual steps. However, in this example, to review the simulation results more easily, you can access the gate, drain, and source currents. To access the drain, gate, and source currents in simlog, add to the % generated simscape component the drainInternal, gateInternal, and % sourceInternal internal nodes, and the idrain, igate, and isource % corresponding through variables. Then, save the changes into a new file named
iauc100n04s6l014_updated.ssc and pass the file as an argument to the ee_convertedMosfetValidation MATLAB function.
Create the file named
iauc100n04s6l014_wrapped.ssc. This file is the component file for the Simscape component block in the model
ee_MOSFET_subckt_results script calls the
ee_convertedMosfetValidation function to generate some standard characteristics such as Id versus Vgs, Id versus Vds, Qiss/ Gate charge, Qoss/ Output charge, and Breakdown voltage.
To plot these characteristics with different settings, double-click the block labeled Define Conditions and define the parameters. In the model, to run the simulations and plot the results, click check results.
Finally, delete the temporary directory and all its subdirectories.