|
KiCad PCB EDA Suite
|
Text handling for simulator signal expressions and measurement commands. More...
Enumerations | |
| enum class | PART { VALUE , GAIN , PHASE , AMPLITUDE } |
| Which part of a complex signal a plotted row shows. More... | |
Functions | |
| bool | IsSingleVoltageRef (const wxString &aExpression) |
| bool | IsMeasVector (const wxString &aSignal) |
| bool | MeasurableSignal (const wxString &aBase, PART aPart, wxString &aResult) |
| Build the signal a measurement should read so it matches what is plotted. | |
| void | SplitMeasurement (const wxString &aCmd, wxString &aFunc, wxString &aSignal, wxString &aParams) |
| Split "MAX V(out) from=1m to=2m" into its function, signal and trailing parameters. | |
| wxString | ExpandDeviceVoltages (const wxString &aExpression, const std::map< wxString, wxString > &aDeviceExprs) |
| Replace V(R1), VDB(R1), VM(R1), ... with the terminal voltage expression of the part. | |
| wxString | QuoteNetNames (const wxString &aExpression, const std::vector< wxString > &aNetnames) |
| Quote every whole occurrence of a net name that ngspice would otherwise parse as an expression. | |
| bool | ParensBalanced (const wxString &aExpression) |
| std::vector< wxString > | ExtractSignalRefs (const wxString &aExpression) |
| Extract the V() and I() and P() node or device references from an expression, unquoted. | |
| wxString | DeviceVoltageExpression (const std::vector< std::string > &aModelPins, const std::vector< std::string > &aPinNumbers, const std::vector< std::string > &aPinNetNames) |
| Build the voltage across a two-terminal part in its model's pin order, matching the sign of I() and P(). | |
| bool | IsDerivedSignalVector (const wxString &aVectorName) |
Variables | |
| const wxString | DEVICE_VECTOR_PREFIX = wxS( "kicad_vdev" ) |
| Vector name prefix for the voltage across a component, "kicad_vdev3". | |
Text handling for simulator signal expressions and measurement commands.
These work on the strings the simulator frame hands to ngspice and hold no frame state.
|
strong |
Which part of a complex signal a plotted row shows.
| Enumerator | |
|---|---|
| VALUE | |
| GAIN | AC magnitude, plotted in dB. |
| PHASE | |
| AMPLITUDE | S-parameter magnitude, plotted linear. |
Definition at line 38 of file sim_signal_utils.h.
| wxString SIM_SIGNAL::DeviceVoltageExpression | ( | const std::vector< std::string > & | aModelPins, |
| const std::vector< std::string > & | aPinNumbers, | ||
| const std::vector< std::string > & | aPinNetNames ) |
Build the voltage across a two-terminal part in its model's pin order, matching the sign of I() and P().
| aModelPins | symbol pin numbers in the order the SPICE model declares its terminals. |
| aPinNumbers | symbol pin numbers of the netlist item. |
| aPinNetNames | SPICE net names, parallel to aPinNumbers. |
Definition at line 482 of file sim_signal_utils.cpp.
References index.
Referenced by BOOST_AUTO_TEST_CASE(), and SIMULATOR_FRAME_UI::rebuildDeviceVoltages().
| wxString SIM_SIGNAL::ExpandDeviceVoltages | ( | const wxString & | aExpression, |
| const std::map< wxString, wxString > & | aDeviceExprs ) |
Replace V(R1), VDB(R1), VM(R1), ... with the terminal voltage expression of the part.
| aDeviceExprs | maps a reference ("R1") to its expression ("V(a) - V(b)"). Matching ignores case, like ngspice. Inserted text is never rescanned. |
Definition at line 200 of file sim_signal_utils.cpp.
References result.
Referenced by BOOST_AUTO_TEST_CASE(), and SIMULATOR_FRAME_UI::expandDeviceVoltages().
| std::vector< wxString > SIM_SIGNAL::ExtractSignalRefs | ( | const wxString & | aExpression | ) |
Extract the V() and I() and P() node or device references from an expression, unquoted.
A two-node V(a,b) yields one reference per node; ground is omitted. VDB(), VM(), VP(), VR() and VI() count as voltage references.
Definition at line 382 of file sim_signal_utils.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), and DIALOG_USER_DEFINED_SIGNALS::onCheckSyntax().
| bool SIM_SIGNAL::IsDerivedSignalVector | ( | const wxString & | aVectorName | ) |
Definition at line 525 of file sim_signal_utils.cpp.
References DEVICE_VECTOR_PREFIX.
Referenced by BOOST_AUTO_TEST_CASE(), DIALOG_USER_DEFINED_SIGNALS::onScintillaCharAdded(), SIMULATOR_FRAME_UI::UpdateMeasurement(), and SIMULATOR_FRAME_UI::updateTrace().
| bool SIM_SIGNAL::IsMeasVector | ( | const wxString & | aSignal | ) |
Definition at line 71 of file sim_signal_utils.cpp.
Referenced by SIMULATOR_FRAME_UI::UpdateMeasurement().
| bool SIM_SIGNAL::IsSingleVoltageRef | ( | const wxString & | aExpression | ) |
Definition at line 48 of file sim_signal_utils.cpp.
Referenced by MeasurableSignal().
| bool SIM_SIGNAL::MeasurableSignal | ( | const wxString & | aBase, |
| PART | aPart, | ||
| wxString & | aResult ) |
Build the signal a measurement should read so it matches what is plotted.
Definition at line 103 of file sim_signal_utils.cpp.
References AMPLITUDE, GAIN, IsSingleVoltageRef(), PHASE, and VALUE.
Referenced by BOOST_AUTO_TEST_CASE(), and SIMULATOR_FRAME_UI::measurementSignal().
| bool SIM_SIGNAL::ParensBalanced | ( | const wxString & | aExpression | ) |
Definition at line 350 of file sim_signal_utils.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), and DIALOG_USER_DEFINED_SIGNALS::onCheckSyntax().
| wxString SIM_SIGNAL::QuoteNetNames | ( | const wxString & | aExpression, |
| const std::vector< wxString > & | aNetnames ) |
Quote every whole occurrence of a net name that ngspice would otherwise parse as an expression.
Matching ignores case because ngspice node names do; the text keeps the user's spelling. Names already in quotes are left alone.
Definition at line 264 of file sim_signal_utils.cpp.
References end.
Referenced by BOOST_AUTO_TEST_CASE(), and SIMULATOR_FRAME_UI::quoteNetNames().
| void SIM_SIGNAL::SplitMeasurement | ( | const wxString & | aCmd, |
| wxString & | aFunc, | ||
| wxString & | aSignal, | ||
| wxString & | aParams ) |
Split "MAX V(out) from=1m to=2m" into its function, signal and trailing parameters.
Parameters start at the first whitespace-delimited "name=" outside quotes and parentheses, so comparison operators such as ">=" stay part of the signal.
Definition at line 131 of file sim_signal_utils.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), SIMULATOR_FRAME_UI::rebuildMeasurementsTree(), and SIMULATOR_FRAME_UI::UpdateMeasurement().
|
inline |
Vector name prefix for the voltage across a component, "kicad_vdev3".
Definition at line 47 of file sim_signal_utils.h.
Referenced by deviceVectorName(), and IsDerivedSignalVector().