1 #ifndef __DSENT_MODEL_OPTICALMODEL_H__
2 #define __DSENT_MODEL_OPTICALMODEL_H__
4 #include "util/CommonType.h"
5 #include "model/ElectricalModel.h"
11 class OpticalWaveguide
;
14 class OpticalModulator
;
15 class OpticalDetector
;
16 class OpticalReceiver
;
17 class OpticalTransmitter
;
19 // A Wavelength group consisting of start and end wavelength indices
20 // Assuming it is the same as a net index so I can use the PortInfo class
21 typedef NetIndex WavelengthGroup
;
23 // Helper function for making waveguide groups
24 inline WavelengthGroup
makeWavelengthGroup(int start_index_
, int end_index_
)
26 ASSERT(end_index_
>= start_index_
, (String
) "[Error] Invalid wavelength group range " +
27 "[" + (String
) start_index_
+ ":" + (String
) end_index_
+ "]");
29 return WavelengthGroup(start_index_
, end_index_
);
32 // Helper function for making wavelength groups
33 inline WavelengthGroup
makeWavelengthGroup(int index_
)
35 return makeWavelengthGroup(index_
, index_
);
38 // OpticalModel specifies optical connectivity to other optical models as well
39 class OpticalModel
: public ElectricalModel
43 OpticalModel(const String
& instance_name_
, const TechModel
* tech_model_
);
44 virtual ~OpticalModel();
47 //-----------------------------------------------------------------
48 // Connectivity specification
49 //-----------------------------------------------------------------
53 // Waveguide multiplier
54 void setWaveguideMultiplier(unsigned int waveguide_multiplier_);
55 unsigned int getWaveguideMultiplier();
59 void createOpticalInputPort(const String
& name_
, const WavelengthGroup
& wavelengths_
);
60 const Map
<PortInfo
*>* getOpticalInputs() const;
61 PortInfo
* getOpticalInputPort(const String
& name_
);
62 const PortInfo
* getOpticalInputPort(const String
& name_
) const;
65 void createOpticalOutputPort(const String
& name_
, const WavelengthGroup
& wavelengths_
);
66 const Map
<PortInfo
*>* getOpticalOutputs() const;
67 PortInfo
* getOpticalOutputPort(const String
& name_
);
68 const PortInfo
* getOpticalOutputPort(const String
& name_
) const;
71 void createWaveguide(const String
& name_
, const WavelengthGroup
& wavelengths_
);
72 const Map
<OpticalWaveguide
*>* getWaveguides() const;
73 OpticalWaveguide
* getWaveguide(const String
& name_
);
75 // Assign a waveguide to be downstream from another waveguide
76 void opticalAssign(const String
& downstream_waveguide_name_
, const String
& upstream_waveguide_name_
);
78 // Connect a port (input or output) to some waveguide
79 void opticalPortConnect(OpticalModel
* connect_model_
, const String
& connect_port_name_
, const String
& connect_waveguide_name_
);
80 //-----------------------------------------------------------------
82 //-----------------------------------------------------------------
83 // Optical Graph Model Components
84 //-----------------------------------------------------------------
85 // Optical Laser Sources
87 void createLaser(const String
& name_
, const WavelengthGroup
& wavelengths_
);
88 const Map
<OpticalLaser
*>* getLasers() const;
89 OpticalLaser
* getLaser(const String
& name_
);
90 // Optical Laser Sources
91 void createFilter(const String
& name_
, const WavelengthGroup
& wavelengths_
, bool drop_all_
, const WavelengthGroup
& drop_wavelengths_
);
92 const Map
<OpticalFilter
*>* getFilters() const;
93 OpticalFilter
* getFilter(const String
& name_
);
95 void createModulator(const String
& name_
, const WavelengthGroup
& wavelengths_
, bool opt_loss_
, OpticalTransmitter
* transmitter_
);
96 const Map
<OpticalModulator
*>* getModulators() const;
97 OpticalModulator
* getModulator(const String
& name_
);
99 void createDetector(const String
& name_
, const WavelengthGroup
& wavelengths_
, OpticalReceiver
* receiver_
);
100 const Map
<OpticalDetector
*>* getDetectors() const;
101 OpticalDetector
* getDetector(const String
& name_
);
103 //-----------------------------------------------------------------
106 // In an OpticalModel, the complete optical port-to-port connectivity
107 // of all sub-instances must be specified. Addition/Removal optical
108 // ports or port-related nets cannot happen after this step
109 //virtual void constructModel() = 0;
110 // In an OpticalModel, updateModel MUST finish all necessary
111 // calculations such that loss and wavelength power can be calculated
112 //virtual void updateModel() = 0;
113 // In an OpticalModel, evaluateModel should calculate all wavelength
114 // power, updating power and energy events as necessary
115 //virtual void evaluateModel() = 0;
118 // Private copy constructor. Use clone to perform copy operation.
119 OpticalModel(const OpticalModel
& model_
);
122 // Map of all input ports
123 Map
<PortInfo
*>* m_optical_input_ports_
;
124 // Map of all output ports
125 Map
<PortInfo
*>* m_optical_output_ports_
;
127 // Optical graph model elements
128 // Map of all waveguides
129 Map
<OpticalWaveguide
*>* m_waveguides_
;
130 // Map of all laser source elements
131 Map
<OpticalLaser
*>* m_lasers_
;
132 // Map of all filter elements
133 Map
<OpticalFilter
*>* m_filters_
;
134 // Map of all modulator elements
135 Map
<OpticalModulator
*>* m_modulators_
;
136 // Map of all photodetector elements
137 Map
<OpticalDetector
*>* m_detectors_
;
139 }; // class OpticalModel
142 #endif // __DSENT_MODEL_OPTICALMODEL_H__