Skip to content

Commit a51b14f

Browse files
committed
Refactor transmitter channel addition API
Updated the Transmitter's AddChannel method to accept detailed antenna and modulation parameters instead of a TxChannel object. Refactored Cython code to match the new API, improving flexibility and clarity in transmitter channel configuration.
1 parent 57dcad8 commit a51b14f

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

src/radarsimcpp

src/radarsimpy/includes/radarsimc.pxd

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,18 @@ cdef extern from "transmitter.hpp":
213213
const vector[H] & pulse_start_time,
214214
const vector[cpp_complex[H]] & phase_noise) except + # Phase noise samples
215215

216-
void AddChannel(const TxChannel[L] & channel) # Add transmitter channel
216+
void AddChannel(const Vec3[L] & location, # Antenna location
217+
const Vec3[cpp_complex[L]] & polar, # Polarization vector
218+
const vector[L] & phi, # Azimuth angle array
219+
const vector[L] & phi_ptn, # Azimuth pattern
220+
const vector[L] & theta, # Elevation angle array
221+
const vector[L] & theta_ptn, # Elevation pattern
222+
const L & antenna_gain, # Antenna gain (dB)
223+
const vector[L] & mod_t, # Modulation time array
224+
const vector[cpp_complex[L]] & mod_var, # Modulation variables
225+
const vector[cpp_complex[L]] & pulse_mod, # Pulse modulation
226+
const L & delay, # Channel delay (s)
227+
const L & grid) except + # Time grid resolution
217228

218229
#------------------------------------------------------------------------------
219230
# Receiver Components

src/radarsimpy/lib/cp_radarsimc.pyx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,9 @@ cdef shared_ptr[Transmitter[double, float_t]] cp_Transmitter(radar):
353353
@cython.cdivision(True)
354354
@cython.boundscheck(False)
355355
@cython.wraparound(False)
356-
cdef TxChannel[float_t] cp_TxChannel(tx,
357-
tx_idx):
356+
cdef void cp_AddTxChannel(tx, tx_idx, Transmitter[double, float_t] * tx_c):
358357
"""
359-
cp_TxChannel(tx, tx_idx)
358+
cp_AddTxChannel(tx, tx_idx)
360359
361360
Create TxChannel object in Cython with complete antenna pattern processing
362361
@@ -439,7 +438,7 @@ cdef TxChannel[float_t] cp_TxChannel(tx,
439438
polar = tx.txchannel_prop["polarization"][tx_idx]
440439
cdef Vec3[cpp_complex[float_t]] polarization_vt = Vec3[cpp_complex[float_t]](cpp_complex[float_t](np.real(polar[0]), np.imag(polar[0])), cpp_complex[float_t](np.real(polar[1]), np.imag(polar[1])), cpp_complex[float_t](np.real(polar[2]), np.imag(polar[2])))
441440

442-
return TxChannel[float_t](
441+
tx_c[0].AddChannel(
443442
Vec3[float_t](&location_mv[0]),
444443
polarization_vt,
445444
az_ang_vt,
@@ -622,9 +621,7 @@ cdef shared_ptr[Radar[double, float_t]] cp_Radar(radar, frame_start_time):
622621
"""
623622
tx_c = cp_Transmitter(radar)
624623
for idx_c in range(0, txsize_c):
625-
tx_c.get()[0].AddChannel(
626-
cp_TxChannel(radar.radar_prop["transmitter"], idx_c)
627-
)
624+
cp_AddTxChannel(radar.radar_prop["transmitter"], idx_c, tx_c.get())
628625

629626
"""
630627
Receiver

0 commit comments

Comments
 (0)