本文整理汇总了C#中Circuit.stampResistor方法的典型用法代码示例。如果您正苦于以下问题:C# Circuit.stampResistor方法的具体用法?C# Circuit.stampResistor怎么用?C# Circuit.stampResistor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Circuit
的用法示例。
在下文中一共展示了Circuit.stampResistor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: stamp
public override void stamp(Circuit sim)
{
resistance1 = maxResistance * position;
resistance2 = maxResistance * (1 - position);
sim.stampResistor(lead_node[0], lead_node[2], resistance1);
sim.stampResistor(lead_node[2], lead_node[1], resistance2);
}
示例2: step
public override void step(Circuit sim)
{
open = (lead_volt[3] < 2.5);
if(invert) open = !open;
if(open) {
sim.stampResistor(lead_node[0], lead_node[2], r_on);
sim.stampResistor(lead_node[0], lead_node[1], r_off);
} else {
sim.stampResistor(lead_node[0], lead_node[1], r_on);
sim.stampResistor(lead_node[0], lead_node[2], r_off);
}
}
示例3: stamp
public override void stamp(Circuit sim)
{
// output pin
sim.stampVoltageSource(0, lead_node[1], pins[1].voltSource);
// attach Vi to R1 pin so its current is proportional to Vi
sim.stampVoltageSource(lead_node[0], lead_node[4], pins[4].voltSource, 0);
// attach 5V to R2 pin so we get a current going
sim.stampVoltageSource(0, lead_node[5], pins[5].voltSource, 5);
// put resistor across cap pins to give current somewhere to go
// in case cap is not connected
sim.stampResistor(lead_node[2], lead_node[3], cResistance);
sim.stampNonLinear(lead_node[2]);
sim.stampNonLinear(lead_node[3]);
}
示例4: stamp
public void stamp(Circuit sim, double deltaTime, int n0, int n1)
{
// inductor companion model using trapezoidal or backward euler
// approximations (Norton equivalent) consists of a current
// source in parallel with a resistor. Trapezoidal is more
// accurate than backward euler but can cause oscillatory behavior.
// The oscillation is a real problem in circuits with switches.
nodes[0] = n0;
nodes[1] = n1;
if(isTrapezoidal) {
compResistance = 2 * inductance / deltaTime;
} else {
compResistance = inductance / deltaTime; // backward euler
}
sim.stampResistor(nodes[0], nodes[1], compResistance);
sim.stampRightSide(nodes[0]);
sim.stampRightSide(nodes[1]);
}
示例5: step
public override void step(Circuit sim)
{
double vac = lead_volt[anode] - lead_volt[cnode]; // typically negative
double vag = lead_volt[anode] - lead_volt[gnode]; // typically positive
if(Math.Abs(vac - lastvac) > 0.01 || Math.Abs(vag - lastvag) > .01)
sim.converged = false;
lastvac = vac;
lastvag = vag;
diode.doStep(sim, lead_volt[inode] - lead_volt[gnode]);
double icmult = 1 / triggerI;
double iamult = 1 / holdingI - icmult;
aresistance = (-icmult * ic + ia * iamult > 1) ? 0.0105 : 10E5;
sim.stampResistor(lead_node[anode], lead_node[inode], aresistance);
}
示例6: stamp
public override void stamp(Circuit sim)
{
sim.stampNonLinear(lead_node[anode]);
sim.stampNonLinear(lead_node[cnode]);
sim.stampNonLinear(lead_node[gnode]);
sim.stampNonLinear(lead_node[inode]);
sim.stampResistor(lead_node[gnode], lead_node[cnode], cresistance);
diode.stamp(sim, lead_node[inode], lead_node[gnode]);
}
示例7: stamp
public override void stamp(Circuit sim)
{
if(needsPullDown)
sim.stampResistor(lead_node[0], 0, 1E6);
}
示例8: return
/*public override double getPower() {
return (lead_volt[0] - lead_volt[2]) * current;
}*/
public override void step(Circuit sim)
{
double[] vs = new double[3];
vs[0] = lead_volt[0];
vs[1] = lead_volt[1];
vs[2] = lead_volt[2];
if(vs[1] > lastv1 + 0.5) vs[1] = lastv1 + 0.5;
if(vs[1] < lastv1 - 0.5) vs[1] = lastv1 - 0.5;
if(vs[2] > lastv2 + 0.5) vs[2] = lastv2 + 0.5;
if(vs[2] < lastv2 - 0.5) vs[2] = lastv2 - 0.5;
int grid = 1;
int cath = 2;
int plate = 0;
double vgk = vs[grid] - vs[cath];
double vpk = vs[plate] - vs[cath];
if(Math.Abs(lastv0 - vs[0]) > 0.01 || Math.Abs(lastv1 - vs[1]) > 0.01 || Math.Abs(lastv2 - vs[2]) > 0.01)
sim.converged = false;
lastv0 = vs[0];
lastv1 = vs[1];
lastv2 = vs[2];
double ids = 0;
double gm = 0;
double Gds = 0;
double ival = vgk + vpk / mu;
currentg = 0;
if(vgk > .01) {
sim.stampResistor(lead_node[grid], lead_node[cath], gridCurrentR);
currentg = vgk / gridCurrentR;
}
if(ival < 0) {
// should be all zero, but that causes a singular matrix,
// so instead we treat it as a large resistor
Gds = 1E-8;
ids = vpk * Gds;
} else {
ids = Math.Pow(ival, 1.5) / kg1;
double q = 1.5 * Math.Sqrt(ival) / kg1;
// gm = dids/dgk;
// Gds = dids/dpk;
Gds = q;
gm = q / mu;
}
currentp = ids;
currentc = ids + currentg;
double rs = -ids + Gds * vpk + gm * vgk;
sim.stampMatrix(lead_node[plate], lead_node[plate], Gds);
sim.stampMatrix(lead_node[plate], lead_node[cath], -Gds - gm);
sim.stampMatrix(lead_node[plate], lead_node[grid], gm);
sim.stampMatrix(lead_node[cath], lead_node[plate], -Gds);
sim.stampMatrix(lead_node[cath], lead_node[cath], Gds + gm);
sim.stampMatrix(lead_node[cath], lead_node[grid], -gm);
sim.stampRightSide(lead_node[plate], rs);
sim.stampRightSide(lead_node[cath], -rs);
}
示例9: 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);
}
示例10: 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);
}
示例11: step
public override void step(Circuit sim)
{
resistance = (state) ? onresistance : offresistance;
sim.stampResistor(lead_node[0], lead_node[1], resistance);
}
示例12: step
public override void step(Circuit sim)
{
open = (lead_volt[2] < 2.5);
if(invert) open = !open;
resistance = (open) ? r_off : r_on;
sim.stampResistor(lead_node[0], lead_node[1], resistance);
}
示例13: stamp
public override void stamp(Circuit sim)
{
nodes[0] = lead_node[0];
nodes[1] = lead_node[1];
if(isTrapezoidal) {
compResistance = 2 * inductance / sim.timeStep;
} else {
compResistance = inductance / sim.timeStep; // backward euler
}
sim.stampResistor(nodes[0], nodes[1], compResistance);
sim.stampRightSide(nodes[0]);
sim.stampRightSide(nodes[1]);
}
示例14: stamp
public override void stamp(Circuit sim)
{
sim.stampVoltageSource(lead_node[4], lead_node[0], voltSource1);
sim.stampVoltageSource(lead_node[5], lead_node[1], voltSource2);
sim.stampResistor(lead_node[2], lead_node[4], impedance);
sim.stampResistor(lead_node[3], lead_node[5], impedance);
}
示例15: step
public override void step(Circuit sim)
{
sim.stampResistor(lead_node[0], lead_node[1], resistance);
}