diff --git a/openems.cpp b/openems.cpp index 33f23ae..b9e8568 100644 --- a/openems.cpp +++ b/openems.cpp @@ -882,6 +882,12 @@ void openEMS::SetStepExcite(double f_max) m_Exc->SetupStepExcite(f_max); } +void openEMS::SetCustomExcite(std::string str, double f0, double fmax) +{ + this->InitExcitation(); + m_Exc->SetupCustomExcite(str, f0, fmax); +} + Excitation* openEMS::InitExcitation() { delete m_Exc; diff --git a/openems.h b/openems.h index 2ff3aee..2bbf6a3 100644 --- a/openems.h +++ b/openems.h @@ -105,6 +105,7 @@ public: void SetSinusExcite(double f0); void SetDiracExcite(double f_max); void SetStepExcite(double f_max); + void SetCustomExcite(std::string str, double f0, double fmax); Excitation* InitExcitation(); diff --git a/python/openEMS/openEMS.pyx b/python/openEMS/openEMS.pyx index 0737735..e49d9b9 100644 --- a/python/openEMS/openEMS.pyx +++ b/python/openEMS/openEMS.pyx @@ -259,6 +259,17 @@ cdef class openEMS: """ self.thisptr.SetStepExcite(f_max) + def SetCustomExcite(self, _str, f0, fmax): + """ SetCustomExcite(_str, f0, fmax) + + Set a custom function as excitation signal. The custom function is supplied as a string which gets + parsed using `Function Parser for C++ `_. + + :param _str: str -- Custom function as string literal + :param f0: -- Base frequency. + :param fmax: -- Maximum frequency. + """ + self.thisptr.SetCustomExcite(_str, f0, fmax) def SetBoundaryCond(self, BC): """ SetBoundaryCond(BC)