Closed tmpusr123 closed 1 year ago
It is suggested in [1] and [2]
The math notes have two references but the links are missing...
@biergaizi, find below.
[2] González, Oscar, et al. "An extension of the lumped-network FDTD method to linear two-port lumped circuits." IEEE transactions on Microwave Theory and Techniques 54.7 (2006): 3045-3051.
Reference [1] is given in the original pull request
Here are the main changes:
It was decided to keep maing the operator\engine extensions here *_ext_lumpedRLC.*
. This is due to an assumption that non-linear elements will be handled somewhat differently. No specific idea in mind, right now.
In openems.cpp
, the extensions are still created with this condition,
if (m_CSX->GetQtyPropertyType(CSProperties::LUMPED_RLC)>0)
FDTD_Op->AddExtension(new Operator_Ext_LumpedRLC(FDTD_Op));
but it does not overlap with CSProperties::LUMPED_ELEMENT
, if it is necessary to use CSXCAD in other projects.
In operator.cpp
, a condition was added in Operator::Calc_LumpedElements
to avoid recalculating the EC_* arrays, if the property object is anything other than just CSProperties::LUMPED_ELEMENT
.
// Check: Is this some sort of lumped element extension?
int i_propType = props.at(i)->GetType();
// Shut down LUMPED_ELEMENT bits
i_propType &= ~(CSProperties::LUMPED_ELEMENT);
if (i_propType) // If this is non-zero, skip this lumped element. This is an extension.
continue;
Although this is set in CSXCAD, anything other than a pure RC circuit will cause the program to skip this loop iteration. Only R or only C is fine, as well. An inductor will add the additional type.
A method to determine if this is a parallel RC was added to Operator
bool Operator::IsLEparRC(const CSPropLumpedElement* const p_prop)
and is used as following, in Operator::Calc_LumpedElements
if (!(this->IsLEparRC(PLE)))
continue;
Previous condition that required LUMPED_RLC
removed.
In Operator_Ext_LumpedRLC
, in case Operator_Ext_LumpedRLC::RLC_count
is zero, no memory is allocated for the containers. Hence, the engine will do nothing, when called.
In Engine_Ext_LumpedRLC
, in case the linked operator RLC_count
member is zero, no memory is allocated, apart for the 6 array pointers, v_Vdn
and v_Jn
. This is just to avoid transferring junk from one cell to another. It would have compiled and run, either way, as these values are unused, anywhere.
openems
slightly changed
if (m_CSX->GetQtyPropertyType(CSProperties::LUMPED_ELEMENT)>0)
FDTD_Op->AddExtension(new Operator_Ext_LumpedRLC(FDTD_Op));
I don't know if this was reviewed, but squashing here is Ok, also.
We had to do some modifications to enable python support.
G'day
Both this and the CSXCAD changes have been extensively tested and are ready to merge.
Cheers
I think we covered everything. Ready to (re) review
Adding an engine extension that enables parallel and series lumped RLC. This extension is based on formulations found in article [1].
Adding a parallel inductor is simple, and requires only updating the voltage, in a manner similar to what is performed in
LorentzMaterial
, with only a non-zero plasma frequency.Adding a series resistor and inductor is somewhat more complex. In practice, a series RLC branch is added in parallel to the capacitor while G is set to 0: 1) It is assumed that the parallel capacitor is still connected to an RLC circuit, but its impedance throughout the entire frequency range of the excited signal needs to be sufficiently large. 2) An auxiliary differential equation is defined for the current flowing through the series RLC branch. 3) The node voltage on the primary mesh is updated with respect to the auxiliary current quantity.
This approach assumes that each mesh node contains an RLC circuit, similar to the functionality of
LumpedElement
. When all these branches are connected in series and parallel, the correct RLC values are modeled.Comparison with additional simulation tools is also available:
Minor modifications to several classes were also required, e.g.
engine_extension.cpp
,operator_extension.cpp
andopenems.cpp
.Mathematical formulation: Lumped_RLC_Formulation.pdf
[1] Pereda, José A., et al. "A new algorithm for the incorporation of arbitrary linear lumped networks into FDTD simulators." IEEE transactions on microwave theory and techniques 47.6 (1999): 943-949.