Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

dc to ac converter Simulation

Status
Not open for further replies.

usernam

Full Member level 5
Joined
Mar 9, 2004
Messages
268
Helped
18
Reputation
36
Reaction score
2
Trophy points
1,298
Activity points
2,081
pwm simulation

Hi
I am trying to simulate PWM for a boost converter in Matlab. My plan is to compare the error with a sawtooth waveform of frequency arnd 1KHz.
I am using the signal generator in Simulink-->Sources-->Signal Generator to generate a sawtooth waveform. Unfortunately the sawtooth waveform is not working for a frequency beyond 1 Hz (atleast I'm unable to see it on the scope) and even then it is not a perfect sawtooth. The fall time from peak value to zero is significantly high.
I tried using the repeating sequence block in Simulink-->Sources-->Repeating Sequence but I was unable to get a sawtooth of high enuf frequency.
Does anybody know what the problem is and how to proceed.

Thnx
 

simulink pwm generator

usernam said:
Hi
I am trying to simulate PWM for a boost converter in Matlab. My plan is to compare the error with a sawtooth waveform of frequency arnd 1KHz.
I am using the signal generator in Simulink-->Sources-->Signal Generator to generate a sawtooth waveform. Unfortunately the sawtooth waveform is not working for a frequency beyond 1 Hz (atleast I'm unable to see it on the scope) and even then it is not a perfect sawtooth. The fall time from peak value to zero is significantly high.
I tried using the repeating sequence block in Simulink-->Sources-->Repeating Sequence but I was unable to get a sawtooth of high enuf frequency.
Does anybody know what the problem is and how to proceed.
I used Matlab/Simulink before. Probably we can discuss.
First, do you wish to generate a 1Hz or 1kHz sawtooth waveform?
2nd, what is your Matlab/Simulink version?

I have built a simple one, but not sure it's the one you wish to have or not. By the way, the setting of scope should be correct, e.g. you should disable the '5000' data limit option.
 

    usernam

    Points: 2
    Helpful Answer Positive Rating
pwm generator simulink

Nicleo thnx for the prompt reply.
I need a 1 KHz sawtooth.
Matlab version 6.5 Release 13.
I'm attaching the waveforms I obtained at 2 Hz and 10 Hz. At 1 Hz and arnd 4Hz I'm getting something similar to what you posted.
My scope settings are
Limit data points to last - unchecked
Save data to workspace - unchecked
Signal Generator settings
Waveform - sawtooth
Amplitude - 5
Frequency - 2 Hz
Interpret vector parameters as 1-D - checked.
Relational Operator settings
Require all inputs to have same data type - unchecked
Output data mode - uint(8 )
Enable zero crossing detection - unchecked
Also the sawtooth waveform is going into the negative region. I want a sawtooth that goes from 0 to peak then back to 0 immidiately and then repeat continously.
 

simulink pwm block

Need to modify the Simulation settings (see figure below). Hope it helps.
 

sawtooth simulink

Thnx its working gr8.
I found this in the simulink manual after searching for it.

Maximum step size. The Max step size parameter controls the largest time step the solver can take. The default is determined from the start and stop times.
Hmax = (Tstop-Tstart)/50
Generally, the default maximum step size is sufficient. If you are concerned about the solver’s missing significant behavior, change the parameter to prevent the solver from taking too large a step. If the time span of the simulation is very long, the default step size might be too large for the solver to find the solution. Also, if your model contains periodic or nearly periodic behavior and you know the period, set the maximum step size to some fraction (such as 1/4) of that period.

Right now I'm getting a sawtooth from -4 to 5 even though the amplitude I specified was 5.
Is there anyway I can get a sawtooth waveform from 0 to 5 (other than summing the sawtooth output with a constant).
 

pwm generator in simulink

usernam said:
Right now I'm getting a sawtooth from -4 to 5 even though the amplitude I specified was 5. Is there anyway I can get a sawtooth waveform from 0 to 5 (other than summing the sawtooth output with a constant).
Option A
We can add an OFFSET after the "Signal Generator" block. Pls see attachment.


Option B
In this case, probably we need to use "Simulink-->Sources-->Repeating Sequence", and set the "Max step size" to smaller if it's distorted at high frequency. Pls update.
 

sawtooth in simulink

Yes it works with repeating sequence.
Frequency 1 KHz.
Max step size = 1e-4
Amplitude of sawtooth is about 4.5 but its good enuf.
 

perfect sawtooth in simulink

I now need to generate a sawtooth of variable amplitude .i.e I need to calculate the amplitude of my sawtooth from the given input voltage and reference voltage. Then I need to construct the sawtooth.
How can I go about this?
 
matlab pwm simulation

Pls refer to my post above, which explained how to obtain 0-5V sawtooth signal. We can use Option A to achieve the variable amplitude. Pls see the modified version in the attachment at below.

Explanation (sorry, I could not access Matlab/Simulink now):
1) Output from Gain block (A) is 0 ~ 5V (as you requested)
2) Amplitude Calculation module/block. The output of this module (B) should be normalized to within 0 ~ 1.
3) The signals from A and B are routed to a Product block.
4) Output of Product block (C) is connected as shown in the figure.

Say now, based on the input voltage and reference, the calculated amplitude (the range should be within 0 ~ 5 V) is 2.5V. So, after normalization (2.5/5), B = 0.5. When A is multiplied by B, the amplitude of A will be 'scaled' by HALF (0.5). So, you can get a variable amplitude sawtooth at C. Pls update whether it can work or not. Thanks.

Another way of doing:
1) The amplitude at Signal Generator is set to '1'.
2) The value of Constant block (as offset) is set to '1'.
3) The value of Gain block is set to '0.5'. So, the output from the Gain block (A) is a 0 ~ 1 sawtooth.
4) No need normalization after the amplitude calculation module.
 

repeating sequence simulink frequency problem

Yes this does work. Actually this occured to me too just after I posted the message.

Thnx. :)
 

pwm matlab simulink

usernam said:
Yes this does work. Actually this occured to me too just after I posted the message.

Thnx. :)
Great!!! Glad to know that it works. I used Matlab/Simulink long time ago. So, I was worried that my suggestion in previous post might not work correctly. By the way, do you mind to share the final objective your your simulation model? I'm interested too and probably we can discuss together.
 

pwm generator simulation

Hi nicleo
Well the final objective is to connect a fuel cell and a PV array through two parallel boost converters to a load. The power must be shared between these two boosts. I have to maintain the PV in MPPT(Maximum Power Point Tracking) mode.
I am responsible for the PV section. The fuel cell is being modelled by my partner. The purpose of the present simulation is to model a boost converter and maintain it's output voltage at a constant (which is given by the reference voltage). Right now I'm just using a sine-wave with a DC-offset for the input source since my PV source program is not yet done.
I'm attaching the model for the boost converter in case you're interested.
 

Re: simulink pwm block

Hey Can u help me to generate a 600 Hz carrier signal using Repeating Sequence in MATLAB.

Amplitude must be: Starts from 0 then to 2 and then to 0 and -2(one cycle)
Time:[0 .0016]
Output Amplitude:[2 -2]

Help me out with this repeating sequence
 

Hi usernam
I m intersting in the topic. I sumulated your boost model but I have the following error, can yu please say how i can resolve it "Only 'double' signals are accepted by type Integrator. The signals at the ports of 'full_loop_final_sinewave/Boost Converter/Integrator1' are of data type 'uint8'."
thx
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top