OpticalWavelength.h revision 10447:a465576671d4
1#ifndef __DSENT_MODEL_OPTICALGRAPH_OPTICALWAVELENGTH_H__
2#define __DSENT_MODEL_OPTICALGRAPH_OPTICALWAVELENGTH_H__
3
4#include "model/OpticalModel.h"
5#include "util/CommonType.h"
6
7namespace DSENT
8{
9    // Optical datapath structure storing a detector table consisting of a
10    // detector, the loss to that detector, and the modulator driving
11    // the wavelength for that detector
12    struct OpticalDataPath
13    {
14        OpticalLaser* laser;
15        OpticalModulator* modulator;
16        vector<OpticalDetector*> detectors;
17        vector<double> losses;
18
19        OpticalDataPath(OpticalLaser* laser_, OpticalModulator* modulator_, OpticalDetector* detector_, double loss_)
20            : laser(laser_), modulator(modulator_), detectors(1, detector_), losses(1, loss_) {}
21    };
22
23    class OpticalWavelength
24    {
25        // A data structure of a wavelength (or a group of wavelengths). This
26        // keeps track of all lasers sources, modulators, and detectors that
27        // the wavelength hits.
28        public:
29            OpticalWavelength(const String& instance_name_, const WavelengthGroup& wavelengths_);
30            ~OpticalWavelength();
31
32        public:
33            // Get tree name
34            const String& getInstanceName() const;
35            // Get wavelength groups
36            WavelengthGroup getWavelengths() const;
37            // Add a datapath for this wavelength
38            void addDataPath(OpticalLaser* laser_, OpticalModulator* modulator_, OpticalDetector* detector_, double loss_);
39            const vector<OpticalDataPath>* getDataPaths() const;
40            // Calculate required wavelength power to reach some number of detectors
41            // If number_detectors < the number of total detectors this wavelength hits then
42            // it simply returns the laser power required to reach the worst-case detectors
43            double getLaserPower(unsigned int number_detectors_) const;
44
45        private:
46            // Name of the wavelength
47            const String m_instance_name_;
48            // Keeps track of the wavelengths
49            const WavelengthGroup m_wavelengths_;
50            // Keeps track of a table of laser, detector, modulator mappings
51            vector<OpticalDataPath>* m_data_paths_;
52    };
53
54} // namespace DSENT
55
56#endif // __DSENT_MODEL_OPTICALGRAPH_OPTICALWAVEGUIDE_H__
57
58