Synthetic Signal Generation for Engineers, Using Python | by Piero Paialunga | Jul, 2022


Hands-on signal generation in few lines of codes, using Python

Photo by Clint Bustrillos on Unsplash

Imagine that you have pain in your knee. You go to a doctor and you want to understand if your leg is broken or not.

Now imagine that the doctor gives you the following response:

“To understand if your leg is broken or not, let me first break the other leg and see if they look similar or not”

I’m sure you would change doctor straight away. 🙂

Nonetheless, this is what we mostly do with the components in engineering!
If you want to test when your pen is going to break, what you would do is the following procedure:

  1. You stress the pen in a cyclic way (the so-called fatigue) and see after how many cycles your pen breaks.
  2. You repeat 1. for N that tends to infinity (a reasonably large N) pens and you record your breaking point.
  3. You give a look at the distribution and try to get an insightful value out of it (the first, second, third quartile, the mean, the standard deviation, the distribution fit …).

Now… would you do the same if you don’t have a pen but an airplane wing? Well, if you look at point 2. you would have to have N that tends to infinity airplane wings. Of course, it is not feasible.

The branch of engineering that makes tests which don’t damage the status of the components at the time of the testing is called non-destructive testing (NDT).

The formal definition (Wikipedia) that can be given to NDT is the following:

“Nondestructive testing (NDT) is any of a wide group of analysis techniques used in science and technology industry to evaluate the properties of a material, component or system without causing damage”

And it is pretty much what we described before.

Imagine that you know have a sample (component) and it ideally has a crack in the middle. Like this:

Image by author

What you want to do is to use an ultrasonic measurement (using that transmitter and receiver that you see in figure), to estimate when, where and how big is the crack that you have. In order to do so, you use a transmitter of a wave (possibly ultrasonics) and a receiver that, as the name suggests, receive the wave emitted by the transmitter.

What happens is kind of the following:

Image by author (Figure 1)

The signal bounces on the top tip of the crack and moves from the transmitter to the receiver (black line).

This is an excellent way to test the health of a material (sample): if you have a crack in that sample, you expect the physics of the signal to “inform” you of that crack. Of course, the utility of this is that if you don’t know if a material has a crack or not (that is the reality by the way) you can check if the signal is the one of a cracked component or not.

At this time, you should be excited to know what the signal looks like. Let’s see it together.

The signal is made by a tone and a burst. The analytical expression of the signal is broadly now, but it does depends on a certain numbers of parameters:

  • length of the signal: how long is the transmitted/received signal
  • number of cycles: it is the number of periodical oscillation of the signal (will be clearer, I promise)
  • frequency of the excitation
  • sample frequency

Now, given all this information, as I said, we have our tone:

Image by author

Where, of course, t(x) is our tone, N_cycles is the number of cycles and:

Image by author

While the expression for the burst is the following:

Image by author

And we know that:

Image by author

Where L is the length of the signal. Our final toneburst is the following:

Image by author

What does it look like you may ask? Something like this:

Image by author

Let’s build it together in Python:

This is the code we need to make it work:

  1. Import the libraries:

2. Numerical implementation (with some random default values):

3. Plot 🙂

As you can see in the analytical expression, the number of cycles plays the role of a frequency and, as the name suggests, gives you the number of ups and downs in the toneburst.

Let me show you:

As you can see in the left column, the number of cycles correspond to the ups and downs of the signal, while on the right column you see the Fourier spectrum (amplitude), and it’s peak is right in the number of cycles.

Now, what I showed you is just the top tip reflection of the crack (Figure 1). The bottom tip has its reflection too and if the crack is not straight a lot of complex scans can be generated. You can easily create a more complex signal (made of a sequence of tonebursts) using the following code:

Let me show you some examples:

Let’s summarize some of the points we touched.

  1. The ultrasounds experiments on components with cracks output a well known functional dependency on the A scan, known as toneburst
  2. The toneburst can have different parameters that play a crucial role in the way it appears on the A scan
  3. Sometimes, multiple reflections can create a very complex A scan.

If you liked the article and you want to know more about Machine Learning, or you just want to ask me something you can:

A. Follow me on Linkedin, where I publish all my stories
B. Subscribe to my newsletter. It will keep you updated about new stories and give you the chance to text me to receive all the corrections or doubts you may have.
C. Become a referred member, so you won’t have any “maximum number of stories for the month” and you can read whatever I (and thousands of other Machine Learning and Data Science top writers) write about the newest technology available.


Hands-on signal generation in few lines of codes, using Python

Photo by Clint Bustrillos on Unsplash

Imagine that you have pain in your knee. You go to a doctor and you want to understand if your leg is broken or not.

Now imagine that the doctor gives you the following response:

“To understand if your leg is broken or not, let me first break the other leg and see if they look similar or not”

I’m sure you would change doctor straight away. 🙂

Nonetheless, this is what we mostly do with the components in engineering!
If you want to test when your pen is going to break, what you would do is the following procedure:

  1. You stress the pen in a cyclic way (the so-called fatigue) and see after how many cycles your pen breaks.
  2. You repeat 1. for N that tends to infinity (a reasonably large N) pens and you record your breaking point.
  3. You give a look at the distribution and try to get an insightful value out of it (the first, second, third quartile, the mean, the standard deviation, the distribution fit …).

Now… would you do the same if you don’t have a pen but an airplane wing? Well, if you look at point 2. you would have to have N that tends to infinity airplane wings. Of course, it is not feasible.

The branch of engineering that makes tests which don’t damage the status of the components at the time of the testing is called non-destructive testing (NDT).

The formal definition (Wikipedia) that can be given to NDT is the following:

“Nondestructive testing (NDT) is any of a wide group of analysis techniques used in science and technology industry to evaluate the properties of a material, component or system without causing damage”

And it is pretty much what we described before.

Imagine that you know have a sample (component) and it ideally has a crack in the middle. Like this:

Image by author

What you want to do is to use an ultrasonic measurement (using that transmitter and receiver that you see in figure), to estimate when, where and how big is the crack that you have. In order to do so, you use a transmitter of a wave (possibly ultrasonics) and a receiver that, as the name suggests, receive the wave emitted by the transmitter.

What happens is kind of the following:

Image by author (Figure 1)

The signal bounces on the top tip of the crack and moves from the transmitter to the receiver (black line).

This is an excellent way to test the health of a material (sample): if you have a crack in that sample, you expect the physics of the signal to “inform” you of that crack. Of course, the utility of this is that if you don’t know if a material has a crack or not (that is the reality by the way) you can check if the signal is the one of a cracked component or not.

At this time, you should be excited to know what the signal looks like. Let’s see it together.

The signal is made by a tone and a burst. The analytical expression of the signal is broadly now, but it does depends on a certain numbers of parameters:

  • length of the signal: how long is the transmitted/received signal
  • number of cycles: it is the number of periodical oscillation of the signal (will be clearer, I promise)
  • frequency of the excitation
  • sample frequency

Now, given all this information, as I said, we have our tone:

Image by author

Where, of course, t(x) is our tone, N_cycles is the number of cycles and:

Image by author

While the expression for the burst is the following:

Image by author

And we know that:

Image by author

Where L is the length of the signal. Our final toneburst is the following:

Image by author

What does it look like you may ask? Something like this:

Image by author

Let’s build it together in Python:

This is the code we need to make it work:

  1. Import the libraries:

2. Numerical implementation (with some random default values):

3. Plot 🙂

As you can see in the analytical expression, the number of cycles plays the role of a frequency and, as the name suggests, gives you the number of ups and downs in the toneburst.

Let me show you:

As you can see in the left column, the number of cycles correspond to the ups and downs of the signal, while on the right column you see the Fourier spectrum (amplitude), and it’s peak is right in the number of cycles.

Now, what I showed you is just the top tip reflection of the crack (Figure 1). The bottom tip has its reflection too and if the crack is not straight a lot of complex scans can be generated. You can easily create a more complex signal (made of a sequence of tonebursts) using the following code:

Let me show you some examples:

Let’s summarize some of the points we touched.

  1. The ultrasounds experiments on components with cracks output a well known functional dependency on the A scan, known as toneburst
  2. The toneburst can have different parameters that play a crucial role in the way it appears on the A scan
  3. Sometimes, multiple reflections can create a very complex A scan.

If you liked the article and you want to know more about Machine Learning, or you just want to ask me something you can:

A. Follow me on Linkedin, where I publish all my stories
B. Subscribe to my newsletter. It will keep you updated about new stories and give you the chance to text me to receive all the corrections or doubts you may have.
C. Become a referred member, so you won’t have any “maximum number of stories for the month” and you can read whatever I (and thousands of other Machine Learning and Data Science top writers) write about the newest technology available.

FOLLOW US ON GOOGLE NEWS

Read original article here

Denial of responsibility! Techno Blender is an automatic aggregator of the all world’s media. In each content, the hyperlink to the primary source is specified. All trademarks belong to their rightful owners, all materials to their authors. If you are the owner of the content and do not want us to publish your materials, please contact us by email – admin@technoblender.com. The content will be deleted within 24 hours.
Ai Newsartificial intelligenceEngineersGenerationJullatest newsPaialungaPieropythonSignalsynthetic
Comments (0)
Add Comment