1 /* Copyright (c) 2012 Massachusetts Institute of Technology
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 #include "model/optical/RingFilter.h"
24 #include "model/optical_graph/OpticalWaveguide.h"
25 #include "model/optical_graph/OpticalFilter.h"
29 RingFilter::RingFilter(const String
& instance_name_
, const TechModel
* tech_model_
)
30 : OpticalModel(instance_name_
, tech_model_
)
36 RingFilter::~RingFilter()
39 void RingFilter::initParameters()
41 addParameterName("InStart");
42 addParameterName("InEnd");
43 addParameterName("DropStart");
44 addParameterName("DropEnd");
45 addParameterName("DropAll", "TRUE");
49 void RingFilter::initProperties()
54 void RingFilter::constructModel()
56 //TODO: Add tuning energy/ndd-power costs?
59 Result
* area_result
= new AtomicResult("Photonic");
60 addAreaResult(area_result
);
63 WavelengthGroup in_wavelengths
= makeWavelengthGroup(getParameter("InStart"), getParameter("InEnd"));
64 WavelengthGroup drop_wavelengths
= makeWavelengthGroup(getParameter("DropStart"), getParameter("DropEnd"));
65 bool drop_all
= getParameter("DropAll");
67 // Create optical ports
68 createOpticalInputPort( "In", in_wavelengths
);
69 createOpticalOutputPort( "Drop", drop_wavelengths
);
70 createOpticalOutputPort( "Out", in_wavelengths
);
72 createFilter( "RingFilter", in_wavelengths
, drop_all
, drop_wavelengths
);
73 OpticalFilter
* ring_filter
= getFilter("RingFilter");
75 getWaveguide("In")->addDownstreamNode(ring_filter
);
76 ring_filter
->addDownstreamNode(getWaveguide("Out"));
77 ring_filter
->setDropPort(getWaveguide("Drop"));
80 void RingFilter::updateModel()
82 //TODO: Get numbers from tech model;
83 double ring_area
= 200e-12;
84 double thru_loss
= 1e-4;
85 double drop_loss
= 1.0;
87 WavelengthGroup drop_wavelengths
= makeWavelengthGroup(getParameter("DropStart"), getParameter("DropEnd"));
88 int number_wavelengths
= drop_wavelengths
.second
- drop_wavelengths
.first
+ 1;
90 OpticalFilter
* ring_filter
= getFilter("RingFilter");
91 ring_filter
->setLoss(thru_loss
* number_wavelengths
);
92 ring_filter
->setDropLoss(drop_loss
+ thru_loss
* number_wavelengths
);
94 getAreaResult("Photonic")->setValue(ring_area
* (number_wavelengths
));