FERS 1.0.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
radar_obj.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-only
2//
3// Copyright (c) 2006-2008 Marc Brooker and Michael Inggs
4// Copyright (c) 2008-present FERS Contributors (see AUTHORS.md).
5//
6// See the GNU GPLv2 LICENSE file in the FERS project root for more information.
7
8/**
9 * radar_obj.cpp
10 * @file
11 * @brief Implementation of classes defined in radar_obj.h
12 */
13
14#include "radar_obj.h"
15
16#include <stack>
17
19#include "core/logging.h"
20#include "receiver.h"
21
22using logging::Level;
23
24namespace radar
25{
26 RealType Radar::getGain(const math::SVec3& angle, const math::SVec3& refangle, const RealType wavelength) const
27 {
28 return _antenna->getGain(angle, refangle, wavelength);
29 }
30
31 RealType Radar::getNoiseTemperature(const math::SVec3& angle) const noexcept
32 {
33 return _antenna->getNoiseTemperature(angle);
34 }
35
36 void Radar::setTiming(const std::shared_ptr<timing::Timing>& tim)
37 {
38 if (!tim)
39 {
40 LOG(Level::FATAL, "Radar timing source must not be null");
41 throw std::runtime_error("Radar timing source must not be null");
42 }
43 _timing = tim;
44 }
45
47 {
48 if (!ant)
49 {
50 LOG(Level::FATAL, "Transmitter's antenna set to null");
51 throw std::logic_error("Transmitter's antenna set to null");
52 }
53 _antenna = ant;
54 }
55
56 void Radar::setAttached(const Radar* obj)
57 {
58 if (_attached)
59 {
60 LOG(Level::FATAL, "Attempted to attach second object to transmitter");
61 throw std::runtime_error("Attempted to attach second object to transmitter");
62 }
63 _attached = obj;
64 }
65
66 std::shared_ptr<timing::Timing> Radar::getTiming() const
67 {
68 if (!_timing)
69 {
70 LOG(Level::FATAL, "Radar::GetTiming called before timing set");
71 throw std::runtime_error("Radar::GetTiming called before timing set");
72 }
73 return _timing;
74 }
75}
Header file defining various types of antennas and their gain patterns.
Abstract base class representing an antenna.
virtual RealType getGain(const math::SVec3 &angle, const math::SVec3 &refangle, RealType wavelength) const =0
Computes the gain of the antenna based on the input angle and reference angle.
A class representing a vector in spherical coordinates.
Represents a radar system on a platform.
Definition radar_obj.h:46
std::shared_ptr< timing::Timing > _timing
Timing source for the radar.
Definition radar_obj.h:129
void setAntenna(const antenna::Antenna *ant)
Sets the antenna for the radar.
Definition radar_obj.cpp:46
std::shared_ptr< timing::Timing > getTiming() const
Retrieves the timing source for the radar.
Definition radar_obj.cpp:66
void setAttached(const Radar *obj)
Attaches another radar object to this radar.
Definition radar_obj.cpp:56
RealType getGain(const math::SVec3 &angle, const math::SVec3 &refangle, RealType wavelength) const
Calculates the radar gain based on input angles and wavelength.
Definition radar_obj.cpp:26
virtual RealType getNoiseTemperature(const math::SVec3 &angle) const noexcept
Gets the noise temperature of the radar.
Definition radar_obj.cpp:31
void setTiming(const std::shared_ptr< timing::Timing > &tim)
Sets the timing source for the radar.
Definition radar_obj.cpp:36
double RealType
Type for real numbers.
Definition config.h:27
Header file for the logging system.
#define LOG(level,...)
Definition logging.h:19
Defines the Radar class and associated functionality.
Radar Receiver class for managing signal reception and response handling.