Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions Ring_Resonator/DelayInterfExp.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
function [ Eout1,Eout2 ] = DelayInterfExp( f,TimDel,PhaDel,E1,E0,CoupConst,...
ExpCoef,MutCoef )
%% Delay Interferometer
%c function[Eout1,Eout2] = DelayInterf( t,TimDel,PhaDel,E1,E0,CoupConst,...
%c ExpCoef,MutCoef )
%c This function is responsible for implementing an Delay Interferometer
%c (DI). There many ways that this device can be implemented such as MZM,
%c passive components and couples with diffe light paths. This script will
%c inplement a DI ussing 3dB couples with 2-input and 2-outputs. The delay
%c given will be implement by light paths with different lengths and the
%c phase delay will be achieve with a phase controler. This will be the
%c principal and only device used to implement an All Optica FFT. Aiming to
%c separate subcarriers from an OFDM signal and convert from serial to
%c paralel.
%c
%c
%c Created by P.Marciano LG
%c 02/11/2017
%c pablorafael.mcx@gmail.com
%c
%c Refences:
%c@article{hillerkuss2010simple,
%c title={Simple all-optical FFT scheme enabling Tbit/s real-time signal processing},
%c author={Hillerkuss, D and Winter, M and Teschke, M and Marculescu, A and Li, J and Sigurdsson, G and Worms, K and Ezra, S Ben and Narkiss, N and Freude, W and others},
%c journal={Optics express},
%c volume={18},
%c number={9},
%c pages={9324--9340},
%c year={2010},
%c publisher={Optical Society of America}
%c}
%c
%c
%c
%c%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%c G L O B A L V A R I A B L E S %
%c%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%c
%c%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%c L I S T O F V A R I A B L E S %
%c%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%c
%c DelayInterf
%c
%c Input:
%c t : Time vector of the whole simulation [s]
%c TimDel : Time delay to be implemented by the DI
%c PhaDel : Phase delay to be implemented by the DI
%c E1 : Principal input signal to be implemented
%c E0 : Secundary input signal (usualy it is zero)
%c CoupConst : Couples Constant of the DI
%c ExpCoef : Exponential component from Ramaswami equation
%c MutCoef : Coeficient to control polarity
%c
%c Output:
%c Eout1 : Output1 from the DI interfometric response
%c Eout2 : Output2 from the DI interfometric response
%c
%c
%c%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%c S T R U C T S %
%c%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%c
%%
% At the very first part of this iscript, it is necessary to be sure that
% all variable that will be used are needed to be correctly initialized.
%% Delay Interferometers
% it was fundamental to use a teoretical model for the couple. Because just
% adding signals together or subtracting them those will not result as an
% optical coupler. The model used at this script was taken from Optical
% Networks by Ramaswami.

%Verifing the variables used on the optical coupler were correctly
%initialized.
if nargin<5
% DelayInterfInputData;
CoupConst = 3*pi/4; %Couples Constant of the DI
ExpCoef = exp(-1j*1);%Exponential component from Ramaswami equation
MutCoef = 1; %Coeficient to control polarity
E0 = 0;
elseif nargin<6
CoupConst = 3*pi/4; %Couples Constant of the DI
ExpCoef = exp(-1j*1);%Exponential component from Ramaswami equation
MutCoef = 1; %Coeficient to control polarity
else
error(['Input Arguments are not enougth. Please check this function'...
' Call!']);
end

%% * Stage: 1 spliting the principal input signal
% Fristly it is needed to divide the signal in two given that by the length
% difference of the optical pahts and the phase delay btween them the
% signals will interfere with one another.
% split
% An 3dB coupler with 2 inputs and 2 outputs is used to slplit the input
% signal.
%The couples will output two signals that are a combination of E1 and E0.
%As E0 = 0 the out put will be just the E1 signal slpit in two. The name
%notation E11 means the E1 signal at the arm 1 (uper arm) hence the
%notation name E12 means the E1 signal at the arm 2 (Lower arm).
E11 = ExpCoef.*(cos(CoupConst).*E1 + MutCoef*1j*sin(CoupConst).*E0);
E12 = ExpCoef.*(cos(CoupConst).*E0 + MutCoef*1j*sin(CoupConst).*E1);

%% * Stage: 2 Changing the signal at the lower arm
%Dellay and change phase
%Firstly it is taken in acont what means for the input signal a time
%delay by measuring the input time vector
% aux1 = E12(t<=TimDel);
% aux1 = E12(1:TimDel);
% f=time2freq(t);
%Secondly the signal will be delayed by rotation its possition. That
%means a circular rith-shift will be performed. The number of possition
%to be deslocated will be given by the number of point that represent the
%delay based on the input time vector given as input. The time delay
%time accuracy depends on the time vector accuracy.
% E12d = [E12(end-(length(aux1)-1):end) E12(1:end-(length(aux1)))];
E12d = ifft(fft(E12).*exp(-1j*2*pi*TimDel.*f));

%In practice the phase delay will be perfomed by an phase controler. In
%the simulation it will be done by multiplying the input signal by a
%complex neperian exponential where the argument was received as an input
%parameters.
%The nema notation means that the E12 was Delayed thus E12d
E12d = E12d.*exp(-1j*PhaDel);

%% * Stage: 3 Recombining both signals
%Combining singnals
%Similarly to te input step. An 3dB coupler with 2 inputs and 2 outputs is
%used to combine the input signals from the arm1 and arm2. The couples
%will output two signals that are a combination of E12 and E12d.
%Thus the Eout1 is the combination of E11 and E12d wich will be out put
%at the port 1 of the couples. Hence, Eout2 is the combination of E11 and
%E12d wich will be out put at the port 2.
Eout1 = ExpCoef.*(cos(CoupConst).*E11 + MutCoef*1j*sin(CoupConst).*E12d);
Eout2 = ExpCoef.*(cos(CoupConst).*E12d + MutCoef*1j*sin(CoupConst).*E11);

end

107 changes: 107 additions & 0 deletions Ring_Resonator/Import_Data_MZM.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
function [L,U0,U_pi1,U_pi2,eta1,eta2,nopt,nel,alfa_ins,phi_0,C,alfa0] = ...
Import_Data_MZM (FileIndex,Local)
%% Import data from text file.
%cfunction [L,U0,U_pi1,U_pi2,eta1,eta2,nopt,nel,alfa_ins,phi_0,C,alfa0]=...
%c Import_Data_MZM (FileIndex,Local)
%c Script for importing data from the following text file:
%c
%c [pwd '\input_files\AA_MZ_Input_Data_t' num2str(FileIndex) '.m'];
%c
%c To extend the code to different selected data or a different text file,
%c generate a function instead of a script.
%c
%c Auto-generated by MATLAB on 2017/10/04 11:05:03
%c
%c
%c
%c Updated by P.Marciano LG
%c 18/10/2017
%c pablorafael.mcx@gmail.com
%c%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%c G L O B A L V A R I A B L E S %
%c%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%c
%c%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%c L I S T O F V A R I A B L E S %
%c%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%c
%c Import_Data_MZM
%c
%c Input:
%c FileIndex : Indentifier of the file to be load into the workspace [-]
%c Local : Current path for the location of the files [-]
%c
%c Output:
%c L : Comprimento do dispositivo [cm]
%c U0 : Tensao de polarizacao [V]
%c U_pi1 : Tensao de chaveamento para 1 eletrodo [V]
%c U_pi2 : Tensao de chaveamento para 2 eletrodos [V]
%c eta1 : Sensibilidade no caminho 1 [1/V.m]
%c eta2 : Sensibilidade no caminho 2 [1/V.m]
%c nopt : Indice de refracao optico [-]
%c nel : Indice de refracao eletrico [-]
%c alfa_ins : Perda por insercao [dB]
%c phi_0 : Constante de fase entre os dois caminhos [-]
%c C : Parametro de chirp [?]
%c alfa0 : Perda condutiva [dB/cm.GHz^0.5]
%c
%c
%c%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%c S T R U C T S %
%c%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%c
%%
%% Initialize variables.
if nargin<2 %Check if there is a specific laction to look for the files
filename = [pwd '\input_files\AA_MZ_Input_Data_t' num2str(FileIndex)...%If not assume that there is a input_files folder
'.m'];
else
filename = [Local 'AA_MZ_Input_Data_t' num2str(FileIndex) '.m']; %If yes, open the files on the given path
end
delimiter = ' ';

%% Format string for each line of text:
% column1: double (%f)
% For more information, see the TEXTSCAN documentation.
formatSpec = '%f%[^\n\r]';

%% Open the text file.
fileID = fopen(filename,'r');

%% Read columns of data according to format string.
% This call is based on the structure of the file used to generate this
% code. If an error occurs for a different file, try regenerating the code
% from the Import Tool.
dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, ...
'MultipleDelimsAsOne', true, 'ReturnOnError', false);

%% Close the text file.
fclose(fileID);

%% Post processing for unimportable data.
% No unimportable data rules were applied during the import, so no post
% processing code is included. To generate code which works for
% unimportable data, select unimportable cells in a file and regenerate the
% script.

%% Allocate imported array to column variable names
VarName1 = dataArray{:, 1};

L = VarName1(1);
U0 = VarName1(2);
U_pi1 = VarName1(3);
U_pi2 = VarName1(4);
eta1 = VarName1(5);
eta2 = VarName1(6);
nopt = VarName1(7);
nel = VarName1(8);
alfa_ins = VarName1(9);
phi_0 = VarName1(10);
alfa0 = VarName1(11);

C = (eta1+eta2)/(eta1-eta2); % Parametro de chirp
alfa0 = 10^(alfa0/20); % [1/cm.GHz^0.5]


%% Clear temporary variables
clearvars filename delimiter formatSpec fileID dataArray ans;
72 changes: 72 additions & 0 deletions Ring_Resonator/MZ_Input_Data.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
%c
%c ..'�`'..'�`..'�`..
%c
%c Arquivo de entrada usado pela funcao Mach_Zehnder_Modulator. Contem
%c informacoes sobre as caracteristicas fisicas do modulador Mach-Zehnder.
%c
%c%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%c G L O B A L V A R I A B L E S %
%c%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%c
%c
%c%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%c L I S T O F V A R I A B L E S %
%c%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%c
%c L : Comprimento do dispositivo [cm]
%c U0 : Tensao de polarizacao [V]
%c eletrodes : Numero de eletrodos (1,2). Definido pelo
%c numero de variaveis de entrada na funcao
%c Mach_Zehnder_Modulator
%c U_pi1 : Tensao de chaveamento para 1 eletrodo [V]
%c U_pi2 : Tensao de chaveamento para 2 eletrodos [V]
%c eta1 : Sensibilidade no caminho 1 [1/V.m]
%c eta2 : Sensibilidade no caminho 2 [1/V.m]
%c nopt : Indice de refracao optico
%c nel : Indice de refracao eletrico
%c alfa_ins : Perda por insercao [dB]
%c phi_0 : Constante de fase entre os dois caminhos
%c alfa0 : Perda condutiva [dB/cm.GHz^0.5]
%c
%c by M.Segatto, S. Cani, B. Jesus e A. Togneri
%c 04/09/2002
%c
%c%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%c S T R U C T S %
%c%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%c
%

L = 10;
U0 = 6;
U_pi1 = 6;
U_pi2 = 6;
eta1 = 89;% 89;
eta2 =-12.7;%-12.7;
%
nopt = 2.17;
nel = 2.60;
alfa_ins = 5.1;
phi_0 = 0.0;
alfa0 = 0.55;

C = (eta1+eta2)/(eta1-eta2); % Parametro de chirp
alfa0 = 10^(alfa0/20); % [1/cm.GHz^0.5]


%
% L = 10;
% U0 = 0;
% U_pi1 = 0;
% U_pi2 = 0;
% eta1 = 89;
% eta2 = -12.7;
% %
% nopt = 1;
% nel = 2;
% alfa_ins = 5.1;
% phi_0 = 0.0;
% alfa0 = 0.55;
% %
% C = (eta1+eta2)/(eta1-eta2); % Parametro de chirp
% alfa0 = 10^(alfa0/20); % [1/cm.GHz^0.5]
Loading