本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例6: step
public override void step(Circuit sim)
{
if(waveform != WaveType.DC)
sim.updateVoltageSource(lead_node[0], lead_node[1], voltSource, getVoltage(sim));
}
示例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);
}
}
示例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);
}
示例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);
}
示例10: doStep
public override void doStep(Circuit sim)
{
sim.updateVoltageSource(0, lead_node[0], voltSource, v);
}
示例11: step
public override void step(Circuit sim)
{
sim.updateVoltageSource(0, lead_node[0], voltSource, getVoltage(sim.time));
}
示例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("--");
}
示例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;
}
}