-
Notifications
You must be signed in to change notification settings - Fork 0
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 #95 from Akhetonics/feature/NonLinearity
Feature/non linearity
- Loading branch information
Showing
50 changed files
with
996 additions
and
338 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
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
4 changes: 2 additions & 2 deletions
4
CAP-DataAccess/Components/ComponentDraftMapper/ComponentJSONFinder.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
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
42 changes: 37 additions & 5 deletions
42
CAP-DataAccess/Components/ComponentDraftMapper/DTOs/Connection.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 |
---|---|---|
@@ -1,10 +1,42 @@ | ||
namespace Components.ComponentDraftMapper.DTOs | ||
using System.Numerics; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace CAP_DataAccess.Components.ComponentDraftMapper.DTOs | ||
{ | ||
public class Connection | ||
{ | ||
public int fromPinNr { get; set; } | ||
public int toPinNr { get; set; } | ||
public float magnitude { get; set; } | ||
public float wireLengthNM { get; set; } | ||
[JsonPropertyName("fromPinNr")] | ||
public int FromPinNr { get; set; } | ||
[JsonPropertyName("toPinNr")] | ||
public int ToPinNr { get; set; } | ||
[JsonPropertyName("nonLinearFormula")] | ||
public string? Formula { get; set; } | ||
[JsonPropertyName("real")] | ||
public double? Real { get; set; } | ||
[JsonPropertyName("imaginary")] | ||
public double? Imaginary { get; set; } | ||
[JsonPropertyName("phase")] | ||
public double? Phase { get; set; } | ||
[JsonPropertyName("magnitude")] | ||
public double? Magnitude { get; set; } | ||
public Complex ToComplexNumber() | ||
{ | ||
if (Real.HasValue && Imaginary.HasValue) | ||
{ | ||
return new Complex(Real.Value, Imaginary.Value); | ||
} | ||
else if (Magnitude.HasValue && Phase.HasValue) | ||
{ | ||
return Complex.FromPolarCoordinates(Magnitude.Value, Phase.Value); | ||
} | ||
else if (!string.IsNullOrWhiteSpace(Formula)) | ||
{ | ||
return 0; | ||
} | ||
else | ||
{ | ||
throw new InvalidOperationException("Not enough data to create a complex number for the connection"); | ||
} | ||
} | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
CAP-DataAccess/Components/ComponentDraftMapper/DTOs/PinDraft.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
Oops, something went wrong.