eisgenerator 2.1.x
eis::Cpe Class Reference

Constant phase element, model character p. More...

#include <constantphase.h>

Inherits eis::Componant.

Collaboration diagram for eis::Cpe:
Collaboration graph

Public Member Functions

 Cpe (std::string paramStr, size_t count=10, bool defaultToRange=false)
 Cpe (fvalue q, fvalue alpha)
virtual std::complex< fvalue > execute (fvalue omega) override
virtual size_t paramCount () const override
virtual char getComponantChar () const override
virtual std::string componantName () const override
virtual std::vector< eis::Range > getDefaultParameters (bool range=true) const override
virtual std::string getCode (std::vector< std::string > &parameters) override
virtual std::string getTorchScript (std::vector< std::string > &parameters) override
Public Member Functions inherited from eis::Componant
virtual void setParamRanges (const std::vector< eis::Range > &ranges)
virtual std::vector< eis::Range > & getParamRanges ()
virtual std::vector< eis::Range > getParamRanges () const
virtual std::string getComponantString (bool currentValue=true, bool withCount=false) const
 Gets this componant as a model string.
virtual bool compileable ()
std::string getUniqueName ()
bool hasDefaultedParameters () const
 Checks if this componant had to use default parameters.

Static Public Member Functions

static constexpr char staticGetComponantChar ()
Static Public Member Functions inherited from eis::Componant
static Componant * copy (Componant *componant)
static Componant * createNewComponant (char componant, std::string paramStr="", size_t count=1, bool defaultToRange=false)
static bool isValidComponantChar (char componant)

Additional Inherited Members

Protected Member Functions inherited from eis::Componant
void initRanges (const std::string &paramStr, size_t count, bool defaultToRange)
Protected Attributes inherited from eis::Componant
std::vector< eis::Range > ranges
std::string uniqueName
bool defaultedParameters = false

Detailed Description

Constant phase element, model character p.

Z(omega) = 1 / (Q (j omega)^alpha)
= cos(alpha pi/2) / (Q omega^alpha) - j sin(alpha pi/2) / (Q omega^alpha)
|Z(omega)| = 1 / (Q omega^alpha)
phase = -alpha pi/2 constant over frequency

Parameters: p{Q,alpha}

  • Q : admittance coefficient (often Y0 or T) in S s^alpha
  • alpha : exponent, dimensionless, conventionally 0 <= alpha <= 1

The general element of which the others are special cases. Substituting an exponent turns p into a different element exactly:

alpha = 1 capacitor C = Q
alpha = 0.5 Warburg A = 1 / (Q sqrt(2))
alpha = 0 resistor R = 1 / Q
alpha = -1 inductor L = 1 / Q (outside the usual range)
Warburg element (semi-infinite linear diffusion), model character w.
Definition warburg.h:57

Because of these identities a p whose exponent sits on one of those values is interchangeable with the corresponding element; eis::Model::getEquivalentParameterPermutations() finds them by fitting rather than by comparing model characters.

Numerically the real and imaginary parts are computed as separate cos and sin terms, so at alpha = 1 the real part is not exactly zero but about 6e-17 / (Q omega), the rounding of cos(pi/2). Harmless for spectra, but do not test Re(Z) == 0 against a p.

alpha is the least sensitive parameter in a model string and Q the most, which matters when budgeting sweep steps; see the find-range mode.

Member Function Documentation

◆ componantName()

virtual std::string eis::Cpe::componantName ( ) const
inlineoverridevirtual

Implements eis::Componant.

◆ execute()

virtual std::complex< fvalue > eis::Cpe::execute ( fvalue omega)
overridevirtual

Reimplemented from eis::Componant.

◆ getCode()

virtual std::string eis::Cpe::getCode ( std::vector< std::string > & parameters)
overridevirtual

Reimplemented from eis::Componant.

◆ getComponantChar()

virtual char eis::Cpe::getComponantChar ( ) const
overridevirtual

Implements eis::Componant.

◆ getDefaultParameters()

virtual std::vector< eis::Range > eis::Cpe::getDefaultParameters ( bool range = true) const
overridevirtual

Reimplemented from eis::Componant.

◆ getTorchScript()

virtual std::string eis::Cpe::getTorchScript ( std::vector< std::string > & parameters)
overridevirtual

Reimplemented from eis::Componant.

◆ paramCount()

virtual size_t eis::Cpe::paramCount ( ) const
overridevirtual

Reimplemented from eis::Componant.