Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current through resistor issue #56

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a unit tests that shows the issue
  • Loading branch information
marcin-golebiowski committed Apr 14, 2021
commit 1a99c24723cd3563be2b71661d37263e6e4e2230
18 changes: 18 additions & 0 deletions SpiceSharpBehavioralTest/Components/MixedTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,24 @@ namespace SpiceSharpBehavioralTest.Components
[TestFixture]
public class MixedTests
{
[Test]
public void When_Resistor_Current_In_Expression_Expected_Reference()
{
var ckt = new Circuit(
new VoltageSource("V1", "2", "0", 200),
new Resistor("R1", "2", "0", 100),
new VoltageSource("V2", "1", "0", 10),
new BehavioralResistor("R2", "1", "0", "I(R1)"));
var op = new OP("I(Resistor) used in expression");
var refExport = new RealCurrentExport(op, "V2");
op.ExportSimulationData += (sender, args) =>
{
Assert.AreEqual(5, refExport.Value, 1e-8);
};

op.Run(ckt);
}

[Test]
public void When_MixedSources_Expect_Reference()
{
Expand Down