-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
131 lines (95 loc) · 3.44 KB
/
main.py
File metadata and controls
131 lines (95 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
from LaserPy_Quantum import Clock
from LaserPy_Quantum import Connection, Simulator
from LaserPy_Quantum import (
StaticWave, PulseWave, AlternatingPulseWave,
ArbitaryWaveGenerator
)
from LaserPy_Quantum import ModulationFunction, CurrentDriver
from LaserPy_Quantum import Laser
from LaserPy_Quantum import VariableOpticalAttenuator
from LaserPy_Quantum import AsymmetricMachZehnderInterferometer
from LaserPy_Quantum import (
display_class_instances_data,
get_time_delay_phase_correction
)
# Control Constants (all in SI units)
modulation_bits = [0] * 20
dt = 1e-12
t_unit = 1e-9
t_final = t_unit * len(modulation_bits) / 2
sampling_rate = 2
RESET_MODE = True
# Current Constants
I_th = 0.0178
MASTER_BASE_DC = 1.4 * I_th
# Time duration are in fration of t_unit
MASTER_AC_DURATION = 0.4
MASTER_AC = 0.3 * I_th
# Time duration are in fration of t_unit
SLAVE_DC_DURATION = 0.6
SLAVE_DC = 0.85 * I_th
SLAVE_PULSE = 1.15 * I_th
# Steady above lasing current
mBase = StaticWave("mBase", MASTER_BASE_DC)
# Modulation current
mModulation = AlternatingPulseWave("mModulation", 0, MASTER_AC, t_unit, total_spread=MASTER_AC_DURATION)
# Gain Switch mode for slave laser
sBase = PulseWave("sBase", SLAVE_PULSE, SLAVE_DC, t_unit, total_spread=SLAVE_DC_DURATION)
AWG = ArbitaryWaveGenerator()
AWG.set((mBase, mModulation))
AWG.set(sBase)
############################################################################
current_driver1 = CurrentDriver(AWG)
current_driver1.set(mBase)
current_driver2 = CurrentDriver(AWG)
current_driver2.set(sBase)
master_laser = Laser(name= "master_laser")
slave_laser = Laser(name= "slave_laser")
simulator_clock = Clock(dt, sampling_rate)
simulator_clock.set(t_final)
simulator = Simulator(simulator_clock)
VOA1 = VariableOpticalAttenuator(5)
VOA2 = VariableOpticalAttenuator(15)
AMZI = AsymmetricMachZehnderInterferometer(simulator_clock, time_delay= t_unit)
simulator.set((
Connection(simulator_clock, (current_driver1, current_driver2)),
Connection(current_driver1, master_laser),
Connection(master_laser, VOA1),
Connection((current_driver2, VOA1), slave_laser),
Connection(slave_laser, VOA2),
Connection(VOA2, AMZI)
))
simulator.reset(True)
simulator.simulate()
time_data = simulator.get_data()
#display_class_instances_data((master_laser, slave_laser), time_data)
#exit(code= 0)
############################################################################
if(RESET_MODE):
simulator.reset_data()
else:
t_final = 2 * t_final
simulator_clock.set(t_final)
slave_laser.set_slave_Laser()
simulator.reset(True)
simulator.simulate()
time_data = simulator.get_data()
#display_class_instances_data((master_laser, slave_laser), time_data)
#exit(code= 0)
############################################################################
modulation_bits = (0,0) + (1,0,1,0,1,1,1,0,0,1) # Sequence
mod_func = ModulationFunction("modulation_function", t_unit, dt, modulation_bits)
if(RESET_MODE):
simulator.reset_data()
t_final = t_unit * (len(modulation_bits) - 1)
simulator_clock.set(t_final)
else:
t_final += t_unit * (len(modulation_bits) - 1)
simulator_clock.set(t_final)
current_driver1.set(mBase, (mBase, mModulation), mod_func)
simulator.reset(True)
AMZI.set_phases(short_arm_phase= get_time_delay_phase_correction(slave_laser, time_delay= t_unit))
simulator.simulate()
time_data = simulator.get_data()
#display_class_instances_data((master_laser, slave_laser), time_data)
AMZI.display_SPD_data(time_data)