HI,
Im am using a simple buck converter circuit to check my cpp block. I want to simulate my digital control loop to make kind of digital twin of my mcu. But it takes ages for simulating a bode plot.
I am switching at 250kHz. Does anyone have a suggestion, idea how to speed this up?
This is the code in my cpp
mcu_buck.cpp (7.5 KB)
this is the schematic
buck_bidi_sim_clean.qsch (33.3 KB)
How slow is being slow?
What’s your freq sweep range?
Do you mind to also show the schematic screenshoot?so I don’t need to open my laptop
note: I saw you C code, it’s great to see somebody else implement the PWM gating in C.
Well it takes more the n10min to get past 10%… Very slwo for a simple buck.
One drawback of the built in FRA is that it run the analysis as a postprocess. Which may means you to store large .qraw file then later work on that.
I have my own FRA block, you can try to use it.
Choose Analyzer-FRA2CH_V7
Thanks for the idea. I might try it. But it just takes ages to gen percentage increase using normal bode. I really wonder why something this simple takes so long. I’m doing something wrong ^^
The fastest way t get results is using FRA instead of the original .bode. I do see something i did not expect in my average current mode control. The LC oscillation
It is time-consuming to troubleshoot a project with a C-block that has many lines.
It seems that when .bode is run in your project, the transient results get mess up (add debug in .bode for its time-domain data). This does not happen with a standard .tran simulation in your schematic. However, due to the complex C-block, it is hard to identify where to look.
Here is one of my examples of using .bode with a C-block. Just to demonstrate how a standard simulation look like if C-block is included.
example.PID_PWM_Controller - Buck Converter (.bode).qsch (11.9 KB)
pid_pwm_controller.cpp (6.8 KB)