aboutsummaryrefslogtreecommitdiff
path: root/src/devices/mzi.cpp
diff options
context:
space:
mode:
authorClément Zrounba <6691770+clement-z@users.noreply.github.com>2023-09-30 23:06:01 +0200
committerClément Zrounba <6691770+clement-z@users.noreply.github.com>2023-09-30 23:26:46 +0200
commitff9b8bb838ecdfbfc1dc81038fcf3b2a87636982 (patch)
tree21f27be782ce11c6d00b96ce100a2bff88141b2e /src/devices/mzi.cpp
downloadspecs-ff9b8bb838ecdfbfc1dc81038fcf3b2a87636982.tar.gz
specs-ff9b8bb838ecdfbfc1dc81038fcf3b2a87636982.zip
Initial release
Diffstat (limited to 'src/devices/mzi.cpp')
-rw-r--r--src/devices/mzi.cpp55
1 files changed, 55 insertions, 0 deletions
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 <mzi.h>
+
+#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<Waveguide>((string(name()) + "/WG1").c_str(),
+ m_length_cm, m_attenuation_dB_cm, m_neff, m_ng);
+ WG2 = make_unique<Waveguide>((string(name()) + "/WG2").c_str(),
+ m_length_cm, m_attenuation_dB_cm, m_neff, m_ng);
+ DC1 = make_unique<DirectionalCoupler>((string(name()) + "/DC1").c_str(), 0.5, m_attenuation_coupler_dB);
+ DC2 = make_unique<DirectionalCoupler>((string(name()) + "/DC2").c_str(), 0.5, m_attenuation_coupler_dB);
+ PS1 = make_unique<PhaseShifter>((string(name()) + "/PS1").c_str(), m_attenuation_ps_dB);
+ PS2 = make_unique<PhaseShifter>((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