how to change phase angle of 3 phase source during simulation

Hi every one,
i have a problem with my simulation.
i am going to simulate a 3-phase grid and i want to change the Phase of Three phase source during simulation but i cant chnage the phase during simulation.
is there any way to add an input to block to chnage the phase during simulation???
Or any other ways???

 Accepted Answer

You can use the MATLAB function block. See the attached file (saved in R2020a) for an example. Note that dynamically changing the parameter will drastically slow down the simulation. Try to set the sample-time of the MATLAB function blocks, as large as possible, to avoid the slow speed.

11 Comments

hello Mr.Hamza
thank you very much .
unfortunately the version of my matlab is 2019b so i couldnt open your model .
could you please save it in previous version?
Sure. Try the attached file saved for R2019b.
hi Mr.Hamza
i apologize for my delay. i had a problem with my PC.
thanks for your help. it is very usefull. i have never seen a code like this .
just one more thing
do you mind if i have your email address to ask you question if it is necessary?
i promise i dont bother you very much
thank you very much and i wish you the best.
You can just post the question on this website and paste the link in the comment to this answer I will get a notification. I will try to respond If I know the solution.
sure .
thanks alot.
Have a nice day
hello Mr.Hamza
i am sorry to bother you again.
I have a question about the Previous model that you sent to me.
Let's Suppose I want To Read The Voltage of Source and then multiple it in 0.5
then Put it as Gain Value .
i wrote this code :
and this is my model:
But when i run my simulation i receive this Eror:
i will be grateful if you help me to solve This Problem.
Where is the block names "gain" in your model?
Also, if you want to use a variable gain, then I suggest you use a multiply block. It will give the same functionality.
Oh , i'm sorry i didnt took screenshot completly .
this is just an example to do something bigger .
i have to read one parameter from a block and then product it in a constant and then set this as a parameter of another block.
could you please show me a way to do this???
Add the following line in your function block
coder.extrinsic('str2num');
and then change the line to this
a2 = str2num(a)*0.5
thank you very much .
it works.

Sign in to comment.

More Answers (1)

Hi... In continuation to this, I would like to know how I can get and change the parameter value at a certain time, say if the simulation runs for 5 seconds, I want to change the parameter for some milliseconds and bring it back to initial value.

Categories

Find more on Simulink in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!