Skip to content

Commit da694c4

Browse files
Merge pull request #163 from SpiceSharp/fix_plot
Fix .PLOT directive
2 parents 074807d + 910aa0a commit da694c4

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

src/SpiceSharpParser/ModelReaders/Netlist/Spice/Readers/Controls/PlotControl.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,33 @@ private void AddPlotToResultIfValid(string plotImage, IReadingContext context, X
155155
}
156156
else
157157
{
158-
context.Result.ValidationResult.AddError(ValidationEntrySource.Reader, $"{plotImage} is not valid for: {simulation.Name}");
158+
context.Result.ValidationResult.AddError(ValidationEntrySource.Reader, $"{plotImage} is not valid for: {simulation.Name}");
159159
}
160160
}
161161

162162
private void CreatePointForSeries(ISimulationWithEvents simulation, IReadingContext context, object eventArgs, List<Export> exports, List<Series> series)
163163
{
164164
double x = 0;
165165

166-
//TODO
166+
if (simulation is Transient transient)
167+
{
168+
x = transient.Time;
169+
}
170+
171+
if (simulation is AC frequency)
172+
{
173+
x = frequency.Frequency;
174+
}
175+
176+
if (simulation is Noise noise)
177+
{
178+
x = noise.Frequency;
179+
}
180+
181+
if (simulation is DC dc)
182+
{
183+
x = dc.GetCurrentSweepValue().FirstOrDefault();
184+
}
167185

168186
for (var i = 0; i < exports.Count; i++)
169187
{

src/SpiceSharpParser/SpiceSharpParser.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<StartupObject />
2323
<PackageLicenseExpression>MIT</PackageLicenseExpression>
2424
<LangVersion>latest</LangVersion>
25-
<Version>3.2.0</Version>
25+
<Version>3.2.1</Version>
2626
</PropertyGroup>
2727

2828
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard1.5|AnyCPU'">

0 commit comments

Comments
 (0)