-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tim Smit
committed
Feb 8, 2024
1 parent
4177086
commit 28ed261
Showing
12 changed files
with
167 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,35 @@ | ||
from loguru import logger | ||
from .receiver_model import ReceiverModel | ||
from ..utils.gain_calc import calc_optical_gain_from_wavelength_diameter | ||
|
||
|
||
class OpticalReceiverModel(ReceiverModel): | ||
"""This class defines an optical receiver model.""" | ||
|
||
def __init__( | ||
self, | ||
line_losses: int, | ||
antenna_diameter: int = 0, | ||
antenna_gain: int = 0 | ||
self, | ||
line_losses: float, | ||
antenna_diameter: float = 0, | ||
antenna_gain: float = 0 | ||
) -> None: | ||
"""Initializes the model. | ||
Args: | ||
line_losses (int): The line losses of the receiver, in dB. | ||
antenna_diameter (int): The diameter of the antenna, in m. Either this or the gain needs to be given. | ||
antenna_gain (int): The gain of the antenna, either this or the diameter needs to be given so that gain can be determined. | ||
line_losses (float): The line losses of the receiver, in dB. | ||
antenna_diameter (float): The diameter of the antenna, in m. Either this or the gain needs to be given. | ||
antenna_gain (float): The gain of the antenna, either this or the diameter needs to be given so that | ||
gain can be determined. | ||
""" | ||
|
||
super().__init__(line_losses, antenna_diameter, antenna_gain) | ||
logger.debug("Initializing optical receiver model.") | ||
|
||
def set_gain(self, wavelength): | ||
def set_gain(self, wavelength: float = 0) -> None: | ||
"""Sets gain for a receiver, based on the given gain, or antenna diameter and wavelength. | ||
Args: | ||
wavelength (int): The wavelength of the link, in meters | ||
""" | ||
if self.antenna_gain == 0: | ||
self.antenna_gain = calc_optical_gain_from_wavelength_diameter(wavelength, self.antenna_diameter, 1) | ||
self.antenna_gain = calc_optical_gain_from_wavelength_diameter(wavelength, self.antenna_diameter, 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.