-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #166 from SpiceSharp/cir
Fix null reference exceptions
- Loading branch information
Showing
10 changed files
with
98 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/SpiceSharpParser.IntegrationTests/Examples/Circuits/band-pass_1.cir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
* Band pass filter - AC simulation | ||
V1 IN 0 AC 1 | ||
LI IN MIDDLE {mc(0.6, tol)} | ||
C1 MIDDLE OUT {mc(10e-6, tol)} | ||
R1 OUT 0 {mc(1000, tol)} | ||
.ac oct 100 1 500 | ||
.param tol=0.2 | ||
.plot ac v(OUT) | ||
.end |
10 changes: 10 additions & 0 deletions
10
src/SpiceSharpParser.IntegrationTests/Examples/Circuits/band-pass_2.cir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
* Band pass filter - AC simulation stepping with mc() | ||
V1 IN 0 AC 1 | ||
LI IN MIDDLE {mc(0.6, tol)} | ||
C1 MIDDLE OUT {mc(10e-6, tol)} | ||
R1 OUT 0 {mc(1000, tol)} | ||
.ac oct 100 1 500 | ||
.step param X 0 10 1 | ||
.param tol=0.2 | ||
.plot ac v(OUT) merge | ||
.end |
44 changes: 44 additions & 0 deletions
44
src/SpiceSharpParser.IntegrationTests/Examples/ExampleBandPass.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System.IO; | ||
using Xunit; | ||
|
||
namespace SpiceSharpParser.IntegrationTests.Examples | ||
{ | ||
public class ExampleBandPass : BaseTests | ||
{ | ||
[Fact] | ||
public void When_SimulatedBandPass_Expect_NoExceptions() | ||
{ | ||
string path = Path.Combine(Directory.GetCurrentDirectory(), "Examples/Circuits/band-pass_1.cir"); | ||
var netlistContent = File.ReadAllText(path); | ||
|
||
var parser = new SpiceNetlistParser(); | ||
parser.Settings.Lexing.HasTitle = true; | ||
|
||
var parseResult = parser.ParseNetlist(netlistContent); | ||
|
||
var spiceSharpReader = new SpiceSharpReader(); | ||
spiceSharpReader.Settings.ExpandSubcircuits = false; | ||
var spiceSharpModel = spiceSharpReader.Read(parseResult.FinalModel); | ||
|
||
RunSimulations(spiceSharpModel); | ||
} | ||
|
||
[Fact] | ||
public void When_SimulatedBandPass2_Expect_NoExceptions() | ||
{ | ||
string path = Path.Combine(Directory.GetCurrentDirectory(), "Examples/Circuits/band-pass_2.cir"); | ||
var netlistContent = File.ReadAllText(path); | ||
|
||
var parser = new SpiceNetlistParser(); | ||
parser.Settings.Lexing.HasTitle = true; | ||
|
||
var parseResult = parser.ParseNetlist(netlistContent); | ||
|
||
var spiceSharpReader = new SpiceSharpReader(); | ||
spiceSharpReader.Settings.ExpandSubcircuits = false; | ||
var spiceSharpModel = spiceSharpReader.Read(parseResult.FinalModel); | ||
|
||
RunSimulations(spiceSharpModel); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters