Hi @Atefeh,
After going through your comments and reviewing the mathworks simulink blocks documentations provided at the links below.
<https://www.mathworks.com/help/simulink/slref/sum.html?searchHighlight=Sum%2520block&s_tid=srchtitle_support_results_1_Sum%252520block Sum block >
<https://www.mathworks.com/help/simulink/slref/sinewavefunction.html Sine wave function >
Note: please bear in mind that I don’t have simulink installed. I only have access to Matlab Simulink.
Here is a comprehensive guide on how to achieve this synchronization and addition of the sine waves in Simulink:
Add Sine Wave Blocks
1. From the Library Browser, navigate to Simulink > Sources. 2. Drag and drop two *Sine Wave* blocks into your model workspace.
Configure the First Sine Wave Block (230V RMS)
1. Double-click on the first Sine Wave block to open its parameters. 2. Set the following parameters: Amplitude: To convert RMS to peak value, use Peak = sqrt{2} times RMS. For 230V RMS, this is approximately 230\sqrt{2} approx 325.27 V.
Frequency (rad/sec): Set according to your requirements (e.g., 2\pi f where f is frequency in Hz). Bias: Leave as 0 unless you need an offset. 3. Click OK to save changes.
Configure the Second Sine Wave Block (5V RMS)
1. Double-click on the second Sine Wave block. 2. Set the following parameters: Amplitude: For 5V RMS, use \( 5\sqrt{2} \approx 7.07 \) V. Frequency (rad/sec): Match this with the first sine wave for synchronization. Bias: Leave as 0 unless needed. 3. Click OK.
Synchronize Phase Shift (if necessary)
1. If you want both sine waves to start at the same phase, ensure that both have a phase shift of 0 radians. 2. You can adjust this in each Sine Wave block under *Phase* parameter if needed.
Add a Sum Block
1. Navigate to Simulink > Math Operations and drag a Sum block into your model. 2. Connect the output of both Sine Wave blocks to the inputs of the Sum block.
Configure Sum Block
1. Double-click on the Sum block. 2. Set the List of signs parameter to `++` if you want to add both signals together without subtraction. 3. Click OK.
Add a Scope Block
1. Navigate to Simulink > Sinks and drag a Scope block into your model. 2. Connect the output of the Sum block to the input of the Scope block.
Set Simulation Parameters
1. Click on Simulation > Model Configuration Parameters from the menu. 2. Set your simulation time appropriately (e.g., 0 to 5 seconds). 3. Ensure solver settings are appropriate for your model; typically, using a fixed-step solver can work well for sinusoidal signals.
Run Simulation
1. Click on the Run button (the green triangle) in the Simulink toolbar. 2. Open the Scope by double-clicking it to view the combined sine wave output.
Here are some additional insights that I would like to share.
Zero-Crossing Detection: Ensure that your model settings account for zero-crossing detection if you're simulating scenarios where abrupt changes occur, as this can improve simulation accuracy without increasing solver time steps significantly.
Validation: After running your simulation, check if the peak voltage output on your scope corresponds to approximately sqrt{(325.27^2 + 7.07^2)} approx 326 V, which aligns with adding two sine waves' amplitudes geometrically rather than simply summing their RMS values directly.
By following these steps, you should be able to successfully synchronize and add two sine waves in Simulink, achieving your desired output effectively!