Videos > PyAEDT: Building a Rectifier in Twin Builder
Apr 30, 2024

PyAEDT: Building a Rectifier in Twin Builder

Hello everyone, welcome back to the series on PyAEDT. This video focuses on PyTwinBuilder, similar to our exploration into 2D Maxwell. We'll start by setting up the environment.

Setup

  1. Import all necessary libraries, including matplotlib for plotting.
  2. Configure the software version using an auto-setup. In this case, set new_graphical to false.
  3. Run the cell block to open TwinBuilder. Depending on your environment, it may display as EM or TB.

Building the Bridge Rectifier

We'll begin building our bridge rectifier by setting a conversion factor to simplify input. To understand the next steps, refer to the API under the modeler and components circuit in TwinBuilder.

Steps

  • Use TwinBuilder components to create a diode. Start by specifying its location and angle.
  • Be cautious when running blocks; running them twice will duplicate components.
  • Add the following components:
    • Diodes
    • Capacitor filter
    • Load resistor
    • Ground
  • Connect components using wire points and pins.
  • Add a source using create_voltage_source with arguments for type and name.

Simulation

Parameterize a transient setup for 100 milliseconds. Run a transient analysis to simulate the circuit.

Plotting Results

Using matplotlib, retrieve node voltages with commands like get_solution_data. For example:

  • Voltage across the AC source: VAC_source.V
  • Voltage across the capacitor: C1.V
  • Voltage across the resistor: R1.V

The plot shows expected behavior: the RC circuit voltage pulses as the capacitor charges and discharges.

Conclusion

To conclude, always release the S-Op to be considerate to your kernel. This completes our bridge rectifier simulation practice.

If you have any questions or suggestions for simulations, please let me know in the comments below.

Thank you for watching. This has been Ian from Ozen Engineering, Inc.

[This was auto-generated. There may be mispellings.]

Hello everyone, welcome back to the series on PyAEDT. This video is going to focus in on PyTwinBuilder. This will be just like our exploration into 2D Maxwell. We're going to start with just setting up. The basic script will look familiar if you watch the other video.

We're going to start by importing all of the different libraries that we're going to be using. This time I also added matplotlib because I'll be plotting with it at the end. Then we go through the same cell block as before where we set everything up.

We'll set the version of the software we're going to be using. We'll use auto setup and in this case, I'm going to use new graphical equals false, even though I've been keeping this true for the most part lately. We don't need to write the last two lines twice.

With all that setup, we can go ahead and run the cell block that will open up TwinBuilder. We'll now be ready to get started building our bridge rectifier. We'll start with this conversion factor. This will help us type everything in easier as we go along.

To figure out how to do this next part, you can always pull up the API. Under the modeler and components circuit, if you open up the modeler of TwinBuilder, you can see these different methods and attributes. The attribute we want to look at is schematic.

From here, I can see that this will be using TwinBuilder components. Let's check those out. We have a lot to work with. This is what I was looking for. TwinBuilder components create diode. A good place to start for a bridge rectifier. The hierarchy will end up looking like this.

If we want to start filling this in, we can just put in the location and angle as some of its arguments. And if you're curious what a single one will look like, let's go ahead and just see. There it is. Let's go ahead and put in all of our diodes. Now, you have to be careful.

You can see what I did here. I ran this block twice, and it did not overwrite. It added another one on top of it. So, control Z. Control Z. Control Z. And you can see we're all the way back to just having a single diode. And, let's even go before then. We'll just go ahead and put all of these in.

Next, we'll add in our capacitor filter. Our load resistor. We accidentally ran this. It's mad at the syntax because we omitted this parenthesis. So, let's fix that. Now we have the diodes, the capacitor, and the load resistor. Last thing we need, of course, is the ground.

Last thing we need to do, of course, is connect all of these. These will just be done with a couple different wire points and pins. And, of course, don't forget the resistor and capacitor. And this looks pretty good. Unfortunately, the angle did not work.

I need to look into why I can't have these tilted right now. But still, this bridge rectifier works just fine. Let's move on. Really all we have to do is parameterize a transient setup. And that's very easily done. We'll do 100 milliseconds. And really, that's all that we have to do.

With that setup done, we can just run a transient on this. This is finished. I'm going to show you just using matplotlib. From here, we can get our node voltages very easily. There's just a simple command.

For example, if we want to see the voltage, our AC voltage, it is simply the get solution data, E value. The E value is the voltage of the VAC source. I want to see the voltage across this source. It's that dot V. If I want to see the voltage across this capacitor, I could say C1 dot V.

Or, of course, resistor R1 dot V. We can do either of those right now. I'll go down a line and do the exact same. Alright, well. That's already plotted. We can do the exact same thing over lane on top of it. There you go. I'm sorry. I put these all in the same plot this time.

This is exactly what we expect to see. The voltage across the RC circuit is pulsing. As you would expect. It charges the capacitor. Discharges on this cycle. Charges and discharges. The input voltage can clearly be seen. And with that, our bridge rectifier simulation practice is complete.

The very last thing you always need to do, because we're nice to our kernel, is release the S-Op. Goodbye S-Op. That's it for this tutorial. If you have any questions or if there's anything that you want to see us simulate, let me know in the comments below.

Otherwise, this has been Ian from Ozen Engineering. Thanks for watching.