## Modelling a RF amplifier in Python

Started by 2 years ago●2 replies●latest reply 2 years ago●916 viewsHello, I'm trying to modelate a transceptor in Python using numpy and scipy.

If I have two digital signals sampled in different rates, how could I multiply them? (In order to mix them).

I know that there are methods to resample digital signals but I don't think It's a great idea.

Also, if I introduce a new Signal sampled at the rate of the carrier It consumes a lots of memory... In my application the carrier it's about 950MHz and the input Signal around 500kHz. So If I sample the input Signal at 2*950MHz It would be near 3GBs of memory...

Also I thought about copying the behavior of the multiplication in frequency domain by deltas. It would shift the input Signal to the carrier frequency. I think this could be a good approach but also it's a little bit cheating...

Anyone could give me a solution to this? Are there any other people that have tried this before? I have been searching on the internet but I haven't found much.

I recommend modeling the baseband equivalent signal which is the complex magnitude and phase versus time (the analytic signal moved to DC). There is no reason to model the actual carrier and that would be highly inefficient. However once converted to a baseband equivalent signal then you can easily resample the two signals so that they are at the same sample rate and same position in time.

With that you can model the effects of AM/AM and AM/PM on the complex signal directly. This will not include temporal effects which can exist due to heating and finite bandwidth of the PA and for that you can introduce temporal (FIR) models with different parameters at different delays. In many cases you can get most of the way there with just a static AM/AM and AM/PM translation function.

Good luck

Hi rober_lr,

It's a non-trivial problem in general as you've noted and I don't have anything resembling an out-of-the-box solution, particularly nothing Python-based. Because it's non-trivial, yet a critical and frequent need in the commercial space, there are commercial tools that specialize in simulating such RF systems. They use their own simulation paradigms and they go by the names like harmonic balance and circuit envelope, amongst others. The biggest commercial players are folks like ADS and Cadence. These simulation approaches (solvers) rely on a combination of time-domain and frequency-domain simulation strategies. Otherwise, the simulation would just be too slow.

This is a devil-in-the details sort of a problem. By that I mean, the modeling and simulation paradigm you choose will by definition be a compromise of simulation speed vs fidelity. That requires knowing what is good enough. How close do you need to get to a simulation of SPICE-level accuracy accounting for 2nd and 3rd order intermodulation products, LO leakage, amplifier noise(s) and non-linearities, etc. How many intermod products do you need to include in your simulation to achieve good-enough fidelity? What bandwidth around each intermod/carrier do you need to include for good-enough fidelity?

My recommendation is to start simple, even if that means brute-force. It looks like you are attempting this work without access to an RF simulator. So, you're essentially asking, how do I roll-my-own poor man's RF simulator. To do that, I would go with what is called an "equivalent baseband modeling approach". If you do a search on that term, you'll find a ton of relevant hits, both papers and youtube videos. The upside of complex baseband is that it's fast. The biggest downside is you lose the ability to model out of band interactions.

https://www.gaussianwaves.com/2017/10/complex-baseband-equivalent-models/#:~:text=Introduction,represented%20by%20samples%20of%20waveforms.

I'm also assuming you meant to type "transceiver"and not tranceptor. I'm not familiar with transceptors, sounds biological in nature.

Finally, you're subject/question line is related but still different enough from what you described in your write-up. Your write-up focused more on the mixer. Your question was on modeling an RF amplifier. Modeling each one (efficiently) is an art in its own right. Modeling a non-linear RF amplifier is a special subject and hot-topic. For that, I recommend you look up terms like Generalized Polynomials Modeling and Volterra Series. Also folks are throwing AI at this problem since it's very complex. Again, how you approach the problem all depends on what you need to get out of the model, how much accuracy, what impairments do you need to include and how accurate against a SPICE-model do they need to be.