OpticalWavelength.h revision 10448
110448Snilay@cs.wisc.edu/* Copyright (c) 2012 Massachusetts Institute of Technology
210448Snilay@cs.wisc.edu *
310448Snilay@cs.wisc.edu * Permission is hereby granted, free of charge, to any person obtaining a copy
410448Snilay@cs.wisc.edu * of this software and associated documentation files (the "Software"), to deal
510448Snilay@cs.wisc.edu * in the Software without restriction, including without limitation the rights
610448Snilay@cs.wisc.edu * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
710448Snilay@cs.wisc.edu * copies of the Software, and to permit persons to whom the Software is
810448Snilay@cs.wisc.edu * furnished to do so, subject to the following conditions:
910448Snilay@cs.wisc.edu *
1010448Snilay@cs.wisc.edu * The above copyright notice and this permission notice shall be included in
1110448Snilay@cs.wisc.edu * all copies or substantial portions of the Software.
1210448Snilay@cs.wisc.edu *
1310448Snilay@cs.wisc.edu * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1410448Snilay@cs.wisc.edu * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1510448Snilay@cs.wisc.edu * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1610448Snilay@cs.wisc.edu * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1710448Snilay@cs.wisc.edu * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1810448Snilay@cs.wisc.edu * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1910448Snilay@cs.wisc.edu * THE SOFTWARE.
2010448Snilay@cs.wisc.edu */
2110448Snilay@cs.wisc.edu
2210447Snilay@cs.wisc.edu#ifndef __DSENT_MODEL_OPTICALGRAPH_OPTICALWAVELENGTH_H__
2310447Snilay@cs.wisc.edu#define __DSENT_MODEL_OPTICALGRAPH_OPTICALWAVELENGTH_H__
2410447Snilay@cs.wisc.edu
2510447Snilay@cs.wisc.edu#include "model/OpticalModel.h"
2610447Snilay@cs.wisc.edu#include "util/CommonType.h"
2710447Snilay@cs.wisc.edu
2810447Snilay@cs.wisc.edunamespace DSENT
2910447Snilay@cs.wisc.edu{
3010447Snilay@cs.wisc.edu    // Optical datapath structure storing a detector table consisting of a
3110447Snilay@cs.wisc.edu    // detector, the loss to that detector, and the modulator driving
3210447Snilay@cs.wisc.edu    // the wavelength for that detector
3310447Snilay@cs.wisc.edu    struct OpticalDataPath
3410447Snilay@cs.wisc.edu    {
3510447Snilay@cs.wisc.edu        OpticalLaser* laser;
3610447Snilay@cs.wisc.edu        OpticalModulator* modulator;
3710447Snilay@cs.wisc.edu        vector<OpticalDetector*> detectors;
3810447Snilay@cs.wisc.edu        vector<double> losses;
3910447Snilay@cs.wisc.edu
4010447Snilay@cs.wisc.edu        OpticalDataPath(OpticalLaser* laser_, OpticalModulator* modulator_, OpticalDetector* detector_, double loss_)
4110447Snilay@cs.wisc.edu            : laser(laser_), modulator(modulator_), detectors(1, detector_), losses(1, loss_) {}
4210447Snilay@cs.wisc.edu    };
4310447Snilay@cs.wisc.edu
4410447Snilay@cs.wisc.edu    class OpticalWavelength
4510447Snilay@cs.wisc.edu    {
4610447Snilay@cs.wisc.edu        // A data structure of a wavelength (or a group of wavelengths). This
4710447Snilay@cs.wisc.edu        // keeps track of all lasers sources, modulators, and detectors that
4810447Snilay@cs.wisc.edu        // the wavelength hits.
4910447Snilay@cs.wisc.edu        public:
5010447Snilay@cs.wisc.edu            OpticalWavelength(const String& instance_name_, const WavelengthGroup& wavelengths_);
5110447Snilay@cs.wisc.edu            ~OpticalWavelength();
5210447Snilay@cs.wisc.edu
5310447Snilay@cs.wisc.edu        public:
5410447Snilay@cs.wisc.edu            // Get tree name
5510447Snilay@cs.wisc.edu            const String& getInstanceName() const;
5610447Snilay@cs.wisc.edu            // Get wavelength groups
5710447Snilay@cs.wisc.edu            WavelengthGroup getWavelengths() const;
5810447Snilay@cs.wisc.edu            // Add a datapath for this wavelength
5910447Snilay@cs.wisc.edu            void addDataPath(OpticalLaser* laser_, OpticalModulator* modulator_, OpticalDetector* detector_, double loss_);
6010447Snilay@cs.wisc.edu            const vector<OpticalDataPath>* getDataPaths() const;
6110447Snilay@cs.wisc.edu            // Calculate required wavelength power to reach some number of detectors
6210447Snilay@cs.wisc.edu            // If number_detectors < the number of total detectors this wavelength hits then
6310447Snilay@cs.wisc.edu            // it simply returns the laser power required to reach the worst-case detectors
6410447Snilay@cs.wisc.edu            double getLaserPower(unsigned int number_detectors_) const;
6510447Snilay@cs.wisc.edu
6610447Snilay@cs.wisc.edu        private:
6710447Snilay@cs.wisc.edu            // Name of the wavelength
6810447Snilay@cs.wisc.edu            const String m_instance_name_;
6910447Snilay@cs.wisc.edu            // Keeps track of the wavelengths
7010447Snilay@cs.wisc.edu            const WavelengthGroup m_wavelengths_;
7110447Snilay@cs.wisc.edu            // Keeps track of a table of laser, detector, modulator mappings
7210447Snilay@cs.wisc.edu            vector<OpticalDataPath>* m_data_paths_;
7310447Snilay@cs.wisc.edu    };
7410447Snilay@cs.wisc.edu
7510447Snilay@cs.wisc.edu} // namespace DSENT
7610447Snilay@cs.wisc.edu
7710447Snilay@cs.wisc.edu#endif // __DSENT_MODEL_OPTICALGRAPH_OPTICALWAVEGUIDE_H__
7810447Snilay@cs.wisc.edu
79