Delay code for orthogonal signal
Answers
-
the c math libraries are available so you can use the sin and cos functions in the c block.
Using a "static" variable will allow you to track theta for the calculations.
0 -
Albert_Dunford:
static
Thanks for your helping. I try but I cannot. Do you have any code?
0 -
static double theta = 0;double freq = 60;theta = theta + freq*2*3.1415926/1000;y1 = cos(theta);y2 = sin(theta);
This code should exectue at 1kHz to achieve a 60 Hz output, for faster interrupts change the "/1000" to the new frequency.
0 -
Thanks for your reply. For example, I have an sine input, how can give a delay for this signal (as two orthogonal signal)?
0 -
Hi Yasaf,
Continuing on the Albert's code.
Let say your input y1 = sin(theta);
y2 (delay one)= -sin(theta-pi/2);…If you delays your input by pi/2 and make it negative, then y2 is actually cos (theta). Then y1 and y2 are orthogonal now.What kind of ckt. u are working on? What's your PSIM schematic look like?
0 -
-
Hi Yasaf,
Try this with Simplified-C-Block. You can watch this video to get know more about this.
https://www.youtube.com/watch?v=HreH4Cx-a94Regards,
Amit0 -
Yes I found the information useful it helps me from your code albert since i am also finding answer for this
even I tried this PrepaidGiftBalance and get worth result.0