diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 7ad6939e..85904555 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -19,7 +19,7 @@ jobs: - name: Setup dotnet tooling uses: actions/setup-dotnet@master with: - dotnet-version: '6.0.x' + dotnet-version: '8.0.x' - name: Restore dependencies run: diff --git a/src/SpiceSharpParser.CodeAnalysis/SpiceSharpParser.CodeAnalysis.csproj b/src/SpiceSharpParser.CodeAnalysis/SpiceSharpParser.CodeAnalysis.csproj index f33b6c0b..bdf96f85 100644 --- a/src/SpiceSharpParser.CodeAnalysis/SpiceSharpParser.CodeAnalysis.csproj +++ b/src/SpiceSharpParser.CodeAnalysis/SpiceSharpParser.CodeAnalysis.csproj @@ -21,7 +21,7 @@ - + diff --git a/src/SpiceSharpParser.IntegrationTests/Examples/Circuits/band-pass_1.cir b/src/SpiceSharpParser.IntegrationTests/Examples/Circuits/band-pass_1.cir new file mode 100644 index 00000000..92dd4d88 --- /dev/null +++ b/src/SpiceSharpParser.IntegrationTests/Examples/Circuits/band-pass_1.cir @@ -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 diff --git a/src/SpiceSharpParser.IntegrationTests/Examples/Circuits/band-pass_2.cir b/src/SpiceSharpParser.IntegrationTests/Examples/Circuits/band-pass_2.cir new file mode 100644 index 00000000..b8bd8c10 --- /dev/null +++ b/src/SpiceSharpParser.IntegrationTests/Examples/Circuits/band-pass_2.cir @@ -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 diff --git a/src/SpiceSharpParser.IntegrationTests/Examples/ExampleBandPass.cs b/src/SpiceSharpParser.IntegrationTests/Examples/ExampleBandPass.cs new file mode 100644 index 00000000..f1dfe20c --- /dev/null +++ b/src/SpiceSharpParser.IntegrationTests/Examples/ExampleBandPass.cs @@ -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); + } + } +} diff --git a/src/SpiceSharpParser.IntegrationTests/SpiceSharpParser.IntegrationTests.csproj b/src/SpiceSharpParser.IntegrationTests/SpiceSharpParser.IntegrationTests.csproj index 6cd3a046..9bad3f35 100644 --- a/src/SpiceSharpParser.IntegrationTests/SpiceSharpParser.IntegrationTests.csproj +++ b/src/SpiceSharpParser.IntegrationTests/SpiceSharpParser.IntegrationTests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 {57920E91-873B-4E66-B0EC-4CAC45007AA9} false @@ -16,12 +16,12 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + @@ -30,7 +30,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -42,6 +42,12 @@ + + Always + + + Always + Always diff --git a/src/SpiceSharpParser.PerformanceTests/SpiceSharpParser.PerformanceTests.csproj b/src/SpiceSharpParser.PerformanceTests/SpiceSharpParser.PerformanceTests.csproj index bb9c6264..66eb5ea2 100644 --- a/src/SpiceSharpParser.PerformanceTests/SpiceSharpParser.PerformanceTests.csproj +++ b/src/SpiceSharpParser.PerformanceTests/SpiceSharpParser.PerformanceTests.csproj @@ -3,19 +3,20 @@ Exe {53D996E7-8D58-49D0-97F6-71CAD49670A2} - net6.0 + net8.0 - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/SpiceSharpParser.Tests/SpiceSharpParser.Tests.csproj b/src/SpiceSharpParser.Tests/SpiceSharpParser.Tests.csproj index bd066ce8..f0e47ffa 100644 --- a/src/SpiceSharpParser.Tests/SpiceSharpParser.Tests.csproj +++ b/src/SpiceSharpParser.Tests/SpiceSharpParser.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 {94394567-BC35-43EE-92CB-31AC780305FE} false @@ -14,12 +14,13 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + + @@ -32,7 +33,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/SpiceSharpParser/ModelWriters/CSharp/Events/ACWithEvents.cs b/src/SpiceSharpParser/ModelWriters/CSharp/Events/ACWithEvents.cs index c64eee27..743d4ee4 100644 --- a/src/SpiceSharpParser/ModelWriters/CSharp/Events/ACWithEvents.cs +++ b/src/SpiceSharpParser/ModelWriters/CSharp/Events/ACWithEvents.cs @@ -42,25 +42,25 @@ public IEnumerable InvokeEvents(IEnumerable codes) switch (code) { case Simulation.BeforeValidation: - EventBeforeValidation.Invoke(this, EventArgs.Empty); + EventBeforeValidation?.Invoke(this, EventArgs.Empty); break; case Simulation.AfterValidation: - EventAfterValidation.Invoke(this, EventArgs.Empty); + EventAfterValidation?.Invoke(this, EventArgs.Empty); break; case Simulation.BeforeSetup: - EventBeforeSetup.Invoke(this, EventArgs.Empty); + EventBeforeSetup?.Invoke(this, EventArgs.Empty); break; case Simulation.AfterSetup: - EventAfterSetup.Invoke(this, EventArgs.Empty); + EventAfterSetup?.Invoke(this, EventArgs.Empty); break; case Simulation.BeforeUnsetup: - EventBeforeUnSetup.Invoke(this, EventArgs.Empty); + EventBeforeUnSetup?.Invoke(this, EventArgs.Empty); break; case Simulation.BeforeExecute: - EventBeforeExecute.Invoke(this, EventArgs.Empty); + EventBeforeExecute?.Invoke(this, EventArgs.Empty); if (this is IBiasingSimulation) { @@ -70,7 +70,7 @@ public IEnumerable InvokeEvents(IEnumerable codes) break; case Simulation.AfterExecute: - EventAfterExecute.Invoke(this, EventArgs.Empty); + EventAfterExecute?.Invoke(this, EventArgs.Empty); break; case AC.ExportSmallSignal: diff --git a/src/SpiceSharpParser/SpiceSharpParser.csproj b/src/SpiceSharpParser/SpiceSharpParser.csproj index 9626bd10..33eb6675 100644 --- a/src/SpiceSharpParser/SpiceSharpParser.csproj +++ b/src/SpiceSharpParser/SpiceSharpParser.csproj @@ -2,10 +2,10 @@ {DF3DD787-71CC-4C89-9E33-DC4536A52278} - netstandard2.0;net6.0;net8.0 + netstandard2.0;net8.0 SpiceSharp https://github.com/SpiceSharp/SpiceSharpParser - Copyright 2024 + Copyright 2025 true https://github.com/SpiceSharp/SpiceSharpParser @@ -22,7 +22,7 @@ MIT latest - 3.2.3 + 3.2.4 @@ -35,10 +35,10 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive