當前位置: 首頁>>代碼示例>>C#>>正文


C# Circuit.updateVoltageSource方法代碼示例

本文整理匯總了C#中Circuit.updateVoltageSource方法的典型用法代碼示例。如果您正苦於以下問題:C# Circuit.updateVoltageSource方法的具體用法?C# Circuit.updateVoltageSource怎麽用?C# Circuit.updateVoltageSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Circuit的用法示例。


在下文中一共展示了Circuit.updateVoltageSource方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: step

 public override void step(Circuit sim)
 {
     double v0 = lead_volt[1];
     double @out;
     if(state) {
         // Output is high
         if(lead_volt[0] > upperTrigger) {
             // Input voltage high enough to set output high
             state = false;
             @out = 5;
         } else {
             @out = 0;
         }
     } else {
         // Output is low
         if(lead_volt[0] < lowerTrigger) {
             // Input voltage low enough to set output low
             state = true;
             @out = 0;
         } else {
             @out = 5;
         }
     }
     double maxStep = slewRate * sim.timeStep * 1e9;
     @out = Math.Max(Math.Min(v0 + maxStep, @out), v0 - maxStep);
     sim.updateVoltageSource(0, lead_node[1], voltSource, @out);
 }
開發者ID:DotNetSparky,項目名稱:SharpCircuit,代碼行數:27,代碼來源:SchmittTrigger.cs

示例2: step

 public override void step(Circuit sim)
 {
     double v0 = lead_volt[1];
     double @out = lead_volt[0] > 2.5 ? 0 : 5;
     double maxStep = slewRate * sim.timeStep * 1e9;
     @out = Math.Max(Math.Min(v0 + maxStep, @out), v0 - maxStep);
     sim.updateVoltageSource(0, lead_node[1], voltSource, @out);
 }
開發者ID:DotNetSparky,項目名稱:SharpCircuit,代碼行數:8,代碼來源:Inverter.cs

示例3: step

 public override void step(Circuit sim)
 {
     int ival = 0;
     for(int i = 0; i != bits; i++)
         if(lead_volt[i] > 2.5)
             ival |= 1 << i;
     int ivalmax = (1 << bits) - 1;
     double v = ival * lead_volt[bits + 1] / ivalmax;
     sim.updateVoltageSource(0, lead_node[bits], pins[bits].voltSource, v);
 }
開發者ID:DotNetSparky,項目名稱:SharpCircuit,代碼行數:10,代碼來源:DACElm.cs

示例4: step

 public override void step(Circuit sim)
 {
     bool f = calcFunction();
     if(isInverting()) f = !f;
     sim.updateVoltageSource(0, lead_node[inputCount], voltSource, f ? 5 : 0);
 }
開發者ID:DotNetSparky,項目名稱:SharpCircuit,代碼行數:6,代碼來源:LogicGate.cs

示例5: step

        public override void step(Circuit sim)
        {
            double vc = lead_volt[3] - lead_volt[2];
            double vo = lead_volt[1];
            int dir = (vo < 2.5) ? 1 : -1;
            // switch direction of current through cap as we oscillate
            if (vo < 2.5 && vc > 4.5) {
                vo = 5;
                dir = -1;
            }
            if (vo > 2.5 && vc < .5) {
                vo = 0;
                dir = 1;
            }

            // generate output voltage
            sim.updateVoltageSource(0, lead_node[1], pins[1].voltSource, vo);
            // now we set the current through the cap to be equal to the
            // current through R1 and R2, so we can measure the voltage
            // across the cap
            int cur1 = sim.nodeCount + pins[4].voltSource;
            int cur2 = sim.nodeCount + pins[5].voltSource;
            sim.stampMatrix(lead_node[2], cur1, dir);
            sim.stampMatrix(lead_node[2], cur2, dir);
            sim.stampMatrix(lead_node[3], cur1, -dir);
            sim.stampMatrix(lead_node[3], cur2, -dir);
            cDir = dir;
        }
開發者ID:DotNetSparky,項目名稱:SharpCircuit,代碼行數:28,代碼來源:VCOElm.cs

示例6: step

 public override void step(Circuit sim)
 {
     if(waveform != WaveType.DC)
         sim.updateVoltageSource(lead_node[0], lead_node[1], voltSource, getVoltage(sim));
 }
開發者ID:DotNetSparky,項目名稱:SharpCircuit,代碼行數:5,代碼來源:Voltage.cs

示例7: step

 public override void step(Circuit sim)
 {
     for(int i = 0; i != getLeadCount(); i++) {
         Pin p = pins[i];
         if(p.output && pins[9].value)
             p.value = lead_volt[i] > 2.5;
         if(!p.output)
             p.value = lead_volt[i] > 2.5;
     }
     execute(sim);
     for(int i = 0; i != getLeadCount(); i++) {
         Pin p = pins[i];
         if(p.output && !pins[9].value)
             sim.updateVoltageSource(0, lead_node[i], p.voltSource, p.value ? 5 : 0);
     }
 }
開發者ID:DotNetSparky,項目名稱:SharpCircuit,代碼行數:16,代碼來源:SRAMElm.cs

示例8: step

 public override void step(Circuit sim)
 {
     // if output is low, discharge pin 0. we use a small
     // resistor because it's easier, and sometimes people tie
     // the discharge pin to the trigger and threshold pins.
     // We check setOut to properly emulate the case where
     // trigger is low and threshold is high.
     if([email protected] && !setOut)
         sim.stampResistor(lead_node[N_DIS], 0, 10);
     // output
     sim.updateVoltageSource(0, lead_node[N_OUT], pins[N_OUT].voltSource, @out ? lead_volt[N_VIN] : 0);
 }
開發者ID:DotNetSparky,項目名稱:SharpCircuit,代碼行數:12,代碼來源:TimerElm.cs

示例9: step

 public override void step(Circuit sim)
 {
     open = (lead_volt[2] < 2.5);
     resistance = (open) ? r_off : r_on;
     sim.stampResistor(lead_node[3], lead_node[1], resistance);
     sim.updateVoltageSource(0, lead_node[3], voltSource, lead_volt[0] > 2.5 ? 5 : 0);
 }
開發者ID:DotNetSparky,項目名稱:SharpCircuit,代碼行數:7,代碼來源:TriStateBuffer.cs

示例10: doStep

 public override void doStep(Circuit sim)
 {
     sim.updateVoltageSource(0, lead_node[0], voltSource, v);
 }
開發者ID:DotNetSparky,項目名稱:SharpCircuit,代碼行數:4,代碼來源:SweepElm.cs

示例11: step

 public override void step(Circuit sim)
 {
     sim.updateVoltageSource(0, lead_node[0], voltSource, getVoltage(sim.time));
 }
開發者ID:DotNetSparky,項目名稱:SharpCircuit,代碼行數:4,代碼來源:AMSource.cs

示例12: step

        public override void step(Circuit sim)
        {
            for(int i = 0; i != getLeadCount(); i++) {
                Pin p = pins[i];
                if(!p.output)
                    p.value = lead_volt[i] > 2.5;
            }

            execute(sim);

            for(int i = 0; i != getLeadCount(); i++) {
                Pin p = pins[i];

                if(p.output) {
                    //Debug.Log(i, p.name, p.value, p.voltSource);
                    sim.updateVoltageSource(0, i, p.voltSource, p.value ? 5 : 0);
                }
            }
            //Debug.Log("--");
        }
開發者ID:DotNetSparky,項目名稱:SharpCircuit,代碼行數:20,代碼來源:Chip.cs

示例13: step

        public override void step(Circuit sim)
        {
            if(voltageL == null) {
                sim.panic("Transmission line delay too large!", this);
                return;
            }

            sim.updateVoltageSource(lead_node[4], lead_node[0], voltSource1, -voltageR[ptr]);
            sim.updateVoltageSource(lead_node[5], lead_node[1], voltSource2, -voltageL[ptr]);

            if(Math.Abs(lead_volt[0]) > 1e-5 || Math.Abs(lead_volt[1]) > 1e-5) {
                sim.panic("Need to ground transmission line!", this);
                return;
            }
        }
開發者ID:DotNetSparky,項目名稱:SharpCircuit,代碼行數:15,代碼來源:TransLineElm.cs


注:本文中的Circuit.updateVoltageSource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。