From ff9b8bb838ecdfbfc1dc81038fcf3b2a87636982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Zrounba?= <6691770+clement-z@users.noreply.github.com> Date: Sat, 30 Sep 2023 23:06:01 +0200 Subject: Initial release --- src/devices/mzi.cpp | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/devices/mzi.cpp (limited to 'src/devices/mzi.cpp') diff --git a/src/devices/mzi.cpp b/src/devices/mzi.cpp new file mode 100644 index 0000000..6999fd9 --- /dev/null +++ b/src/devices/mzi.cpp @@ -0,0 +1,55 @@ +#include + +#define __modname(SUFFIX, IDX) \ + ((""s + this->name() + "_" + SUFFIX + to_string(IDX)).c_str()) + +using namespace std; + +void MZI::init() +{ + DC1.reset(); + DC2.reset(); + PS1.reset(); + PS2.reset(); + WG1.reset(); + WG2.reset(); + + // Creating instances + WG1 = make_unique((string(name()) + "/WG1").c_str(), + m_length_cm, m_attenuation_dB_cm, m_neff, m_ng); + WG2 = make_unique((string(name()) + "/WG2").c_str(), + m_length_cm, m_attenuation_dB_cm, m_neff, m_ng); + DC1 = make_unique((string(name()) + "/DC1").c_str(), 0.5, m_attenuation_coupler_dB); + DC2 = make_unique((string(name()) + "/DC2").c_str(), 0.5, m_attenuation_coupler_dB); + PS1 = make_unique((string(name()) + "/PS1").c_str(), m_attenuation_ps_dB); + PS2 = make_unique((string(name()) + "/PS2").c_str(), m_attenuation_ps_dB); + + // Connecting + + PS1->p_in(p_in1); + PS1->p_out(w1); + PS1->p_vin(p_vphi); + + DC1->p_in1(w1); + DC1->p_in2(p_in2); + DC1->p_out1(w2); + DC1->p_out2(w5); + + // Upper branch + PS2->p_in(w2); + PS2->p_out(w3); + PS2->p_vin(p_vtheta); + + WG1->p_in(w3); + WG1->p_out(w4); + + // Bottom branch + WG2->p_in(w5); + WG2->p_out(w6); + + // End + DC2->p_in1(w4); + DC2->p_in2(w6); + DC2->p_out1(p_out1); + DC2->p_out2(p_out2); +} \ No newline at end of file -- cgit v1.2.3