Esempio n. 1
0
        /// <summary>
        /// Create a MOSFET
        /// </summary>
        /// <param name="name">Name</param>
        /// <param name="d">Drain</param>
        /// <param name="g">Gate</param>
        /// <param name="s">Source</param>
        /// <param name="b">Bulk</param>
        /// <param name="modelname">Model name</param>
        /// <param name="modelparams">Model parameters</param>
        /// <returns></returns>
        protected Mosfet1 CreateMOS1(Identifier name, Identifier d, Identifier g, Identifier s, Identifier b,
                                     Identifier modelname, string modelparams)
        {
            // Create model
            Mosfet1Model model = new Mosfet1Model(modelname);

            ApplyParameters(model, modelparams);

            // Create mosfet
            Mosfet1 mos = new Mosfet1(name);

            mos.SetModel(model);
            mos.Connect(d, g, s, b);
            return(mos);
        }
Esempio n. 2
0
        /// <summary>
        /// Create a MOSFET
        /// </summary>
        /// <param name="name">Name</param>
        /// <param name="d">Drain</param>
        /// <param name="g">Gate</param>
        /// <param name="s">Source</param>
        /// <param name="b">Bulk</param>
        /// <param name="modelname">Model name</param>
        /// <param name="modelparams">Model parameters</param>
        /// <returns></returns>
        protected Mosfet1 CreateMOS1(string name, string d, string g, string s, string b,
                                     string modelname, string modelparams)
        {
            // Create model
            var model = new Mosfet1Model(modelname);

            ApplyParameters(model, modelparams);

            // Create mosfet
            var mos = new Mosfet1(name);

            mos.SetModel(model);
            mos.Connect(d, g, s, b);
            return(mos);
        }
        public void When_NMOSIVCharacteristic_Expect_NoException()
        {
            // <example_DC>
            // Make the bipolar junction transistor
            var nmos = new Mosfet1("M1");

            nmos.Connect("d", "g", "0", "0");
            var nmosmodel = new Mosfet1Model("example");

            nmosmodel.SetParameter("kp", 150.0e-3);
            nmos.SetModel(nmosmodel);

            // Build the circuit
            var ckt = new Circuit(
                new VoltageSource("Vgs", "g", "0", 0),
                new VoltageSource("Vds", "d", "0", 0),
                nmos
                );

            // Sweep the base current and vce voltage
            var dc = new DC("DC 1", new[]
            {
                new SweepConfiguration("Vgs", 0, 3, 0.2),
                new SweepConfiguration("Vds", 0, 5, 0.1),
            });

            // Export the collector current
            var currentExport = new RealPropertyExport(dc, "M1", "id");

            // Run the simulation
            dc.ExportSimulationData += (sender, args) =>
            {
                var vgsVoltage = dc.Sweeps[0].CurrentValue;
                var vdsVoltage = dc.Sweeps[1].CurrentValue;
                var current    = currentExport.Value;
            };
            dc.Run(ckt);
            // </example_DC>
        }