You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enhance LAPLACE source support in SpiceSharpParser
- Renamed UnsupportedLaplaceOptions to InvalidLaplaceOptions and updated test cases to reflect new validation rules for LAPLACE options.
- Added tests for multiplier and delay functionality in LAPLACE sources, ensuring correct scaling and validation.
- Implemented scaling of numerator coefficients in LaplaceTransferFunction based on multiplier.
- Updated LaplaceSourceParser to handle multiplier and delay options, enforcing single-instance constraints and proper error handling.
- Revised documentation to clarify supported LAPLACE syntax and options, including multiplier and delay usage.
Copy file name to clipboardExpand all lines: roadmap/laplace-pspice-feasibility.md
+26-18Lines changed: 26 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,18 +68,20 @@ This approach keeps the implementation small, aligns with existing source-genera
68
68
69
69
## Current Status
70
70
71
-
`E`-source and `G`-source `LAPLACE` support is implemented by SpiceSharpParser for canonical assignment, no-equals expression-pair, and equals-after-keyword expression-pair syntax. `F`, `H`, `B`, function-like `VALUE={LAPLACE(...)}`, delay, and `M=` support remain deferred.
71
+
`E`-source and `G`-source `LAPLACE` support is implemented by SpiceSharpParser for canonical assignment, no-equals expression-pair, and equals-after-keyword expression-pair syntax. Constant `M=`, `TD=`, and `DELAY=` options are implemented for those supported voltage-controlled forms. `F`, `H`, `B`, function-like `VALUE={LAPLACE(...)}`, and explicit internal-state options remain deferred.
72
72
73
73
Phase 1 grammar groundwork is implemented: expression-to-expression assignments such as `{V(in)} = {1/(1+s*tau)}` and `{V(in1,in2)} = {1/(1+s*tau)}` are preserved as `ExpressionAssignmentParameter`.
74
74
75
75
Phase 2 transfer-function math is implemented: internal polynomial, rational-polynomial, transfer-function, and expression-parser types convert rational expressions in `s` into ascending numerator / denominator coefficients with focused validation and broad unit coverage.
76
76
77
77
Phase 3 `E`-source mapping is implemented: canonical `Ename out+ out- LAPLACE {V(ctrl)}``= {H(s)}` and `V(ctrl+,ctrl-)` forms map to `LaplaceVoltageControlledVoltageSource`, produce reader validation errors for semantic failures, and have OP / AC integration coverage.
78
78
79
-
Phase 4 `G`-source mapping is implemented: canonical `Gname out+ out- LAPLACE {V(ctrl)}``= {H(s)}` and `V(ctrl+,ctrl-)` forms map to `LaplaceVoltageControlledCurrentSource`, preserve the existing `G` current-source sign convention, reject unsupported`M=` / delay options, and have OP / AC integration coverage.
79
+
Phase 4 `G`-source mapping is implemented: canonical `Gname out+ out- LAPLACE {V(ctrl)}``= {H(s)}` and `V(ctrl+,ctrl-)` forms map to `LaplaceVoltageControlledCurrentSource`, preserve the existing `G` current-source sign convention, support constant`M=` / delay options, and have OP / AC integration coverage.
80
80
81
81
Phase 5 syntax compatibility is implemented: `E` / `G` sources accept `LAPLACE {V(...)} = {H(s)}`, `LAPLACE {V(...)} {H(s)}`, and `LAPLACE = {V(...)} {H(s)}` as equivalent voltage-controlled forms, while known deferred `VALUE={LAPLACE(...)}` and `B`-source forms produce targeted reader diagnostics.
82
82
83
+
Phase 6 option and transient verification is implemented: supported `E` / `G` Laplace forms accept one constant `M=` multiplier and either `TD=` or `DELAY=` as a constant non-negative runtime delay parameter. Transient first-order step-response tests cover undelayed `E` / `G` low-pass behavior; delayed transient response shape is not currently claimed.
84
+
83
85
Adjacent features already exist:
84
86
85
87
-`VALUE={expr}` behavioral sources.
@@ -168,7 +170,7 @@ Input-expression subset:
168
170
- Alternative `E` / `G` Laplace syntax variants that omit `=` or put `=` directly after `LAPLACE`.
- Explicit delay syntax such as `TD=` or `DELAY=`.
173
+
- Explicit internal-state syntax.
172
174
- Initial-condition syntax for Laplace internal state.
173
175
- Generated C# writer support, unless the MVP delivery explicitly includes writer parity.
174
176
@@ -476,16 +478,18 @@ Prefer parsing with the existing expression parser and accepting only the expect
476
478
477
479
Do not silently ignore `M=`.
478
480
479
-
Recommended MVP behavior: reject `M=` on Laplace sources with a clear diagnostic until tests define the intended semantics. `M=` is a multiplier for the effective source or device contribution, typically equivalent to multiple parallel instances or a scaled current/voltage contribution. If support is added for Laplace sources, multiply the transfer output by `M`, most likely by evaluating `M` to a finite constant and scaling the numerator coefficients.
481
+
Implemented behavior: accept one `M=`assignment on supported `E` / `G` Laplace sources. Evaluate `M` as a finite constant and scale the numerator coefficients, equivalent to putting the multiplier directly in `H(s)`.
480
482
481
483
### Delay Policy
482
484
483
-
The runtime supports`Delay`, but PSpice delay syntax for Laplace sources needs confirmation.
485
+
The runtime exposes`Delay`; SpiceSharpParser accepts one constant non-negative delay assignment on supported `E` / `G`Laplace sources and maps it to the runtime delay parameter.
484
486
485
-
MVP behavior:
487
+
Implemented behavior:
486
488
487
-
- Set `Delay = 0.0`.
488
-
- Reject `TD=`, `DELAY=`, or trailing delay-like parameters with a clear diagnostic.
489
+
-`TD=<expr>` and `DELAY=<expr>` are aliases.
490
+
- The expression must evaluate to a finite non-negative constant in seconds.
491
+
- Only one delay option may be used.
492
+
- Bare forms such as `TD 1n` remain unsupported.
489
493
490
494
## Diagnostics
491
495
@@ -503,8 +507,12 @@ laplace transfer function is improper; numerator degree exceeds denominator degr
503
507
laplace transfer function has singular DC gain
504
508
laplace transfer coefficients must be constant expressions
505
509
laplace transfer expression reserves symbol 's'; use a different parameter name
506
-
laplace delay syntax is not supported yet
507
-
laplace multiplier M is not supported yet
510
+
laplace delay must be a finite constant expression
511
+
laplace delay must be non-negative
512
+
laplace delay can be specified only once
513
+
laplace multiplier M must be a finite constant expression
514
+
laplace multiplier M can be specified only once
515
+
laplace options must use assignment syntax
508
516
laplace syntax variant is recognized but not supported yet
509
517
laplace function-like VALUE form is not supported yet; use E/G LAPLACE {V(...)} = {H(s)}
510
518
laplace source supports only E and G voltage-controlled forms in this version
@@ -527,8 +535,8 @@ Good diagnostics are part of compatibility. A precise rejection is better than f
527
535
|`E ... LAPLACE {V(n1,n2)} = {H(s)}`| Support | Keep |
528
536
|`G ... LAPLACE {V(n)} = {H(s)}`| Support | Keep |
529
537
|`G ... LAPLACE {V(n1,n2)} = {H(s)}`| Support | Keep |
530
-
|`E` / `G ... LAPLACE {V(n)} {H(s)}`|Targeted unsupported diagnostic until canonical form is stable | Add recognizer that lowers to the same model|
531
-
|`E` / `G ... LAPLACE = {V(n)} {H(s)}`|Targeted unsupported diagnostic until canonical form is stable | Add recognizer that lowers to the same model|
| Singular DC gain (`1/s`) | Reject unless verified safe | Possible AC-only or IC-aware mode |
539
547
| Improper transfer (`deg N > deg D`) | Reject | Allow only if proven safe for claimed analyses |
540
-
| Explicit delay |Reject | Map after syntax and behavior tests|
541
-
| Transient |Verify before documenting | Document verified subset|
548
+
| Explicit delay |Support `TD=` / `DELAY=` assignments on `E` / `G`| Other delay-like forms remain unsupported|
549
+
| Transient |Verified for undelayed first-order `E` / `G` low-pass step responses | Delayed transient shape not currently claimed|
542
550
| Generated C# writer | Defer or include as final polish | Emit built-in Laplace entities |
543
551
544
552
### PSpice Variants to Investigate Later
@@ -606,7 +614,7 @@ The last recognizer is deliberate. If a user writes a known PSpice Laplace varia
606
614
| Current-controlled |`F1 out 0 LAPLACE {I(Vsense)} = {H(s)}`| Later milestone | Runtime entities exist, but controlling-source parsing and PSpice compatibility need tests. |
607
615
| Function-like `VALUE`|`E1 out 0 VALUE = {LAPLACE(V(in), H(s))}`| Investigate later | Must be handled as source-level Laplace, not a scalar expression function. |
608
616
|`B` source ABM |`B1 out 0 V = {LAPLACE(V(in), H(s))}`| Investigate later | May require arbitrary input-expression lowering or custom behavior. |
609
-
| Delay/options |`TD=...`, `DELAY=...`| Reject initially | Runtime has `Delay`; PSpice syntax and semantics need confirmation. |
617
+
| Delay/options |`TD=...`, `DELAY=...`, `M=...`| Supported for `E` / `G` voltage-controlled forms | Values must be constant; only one delay option may be used. |
0 commit comments