05-22-2010 03:23 AM
First I will describe what my program does.I read a analog input, a sine, and detect passings trought zero from the negative to the pozitive side and for each passing I write on the output an impulse.
I have to measure the frequency of the signal after the DAQmx Read Block and with that value of the frequency I must calculate a delay time(I know the formula) to delay the moment when I write the impulses on the analog output.
The problems I encountered not using the program "de depanat"(attacheted bellow) is that I get errors and I either measure the frequency or write the impulses but not both at the same time.
I must measure the frequncy in some other way.Can someone help me?
I am using labview 8.0 and Elvis
Thank you
05-22-2010 11:31 AM
05-24-2010 10:38 AM
Hi Americanu22,
Since Windows time is not deterministic you will have problems making sure this stays synchronized. What is your end goal here you may want to approach it differntly. Let me know and I will try to offer you some assistance. Best of luck!
Regards,
05-24-2010 11:54 AM
I have a diploma project that is called "E-learning module in labview for controlled rectifiers".
As I said above I am detecting the passings trougth zero of a sine and for each passing I write an impulse on the analog output.I will use this impulses to comand the thyristor.The problem I encounter is that I cannot delay the moment I write the impulses with a time that I am calculating based on the frequency.
How can I delay the moment I write the impulses or delay the sine signal without delaying the while loop?
I didn't find any block in labview that can delay a signal with a specified time.I specify again that I cannot use a loop to delay the signal because it will delay my other while loop.
05-25-2010 07:50 AM
Americanu22,
As Dusting pointed out above you will not be able to reliably drive the rectifier on zero crossings from any desktop operating system. With an FPGA or a Real-time operating system it should be easy at power mains frequencies. At the tens or hundreds of kilohertz where modern power converters operate, this will likely be a challenge with any hardware and software.
You are only reading and writing one sample at a time. Your comparisons are to zero, but you do not have any "memory" of the status of the previous samples. So you are generating your impulses based on the signal being positive, not at a zero crossing. Learn about shift registers or the Point-by-Point VIs.
Do you have specifications on how much delay and error are acceptable in your system? Without that information you cannot design a process which might work.
Lynn
05-25-2010 08:18 AM
The problem with the software timing in a not RT OS is already mentioned. (Best way would be a hardware solution -> FPGA ...)
And you didn't mentioned the hardware you are using nor the timing specifications....
I assume you use the same sampling rate for reading and writing and that the variance in the frequency isn't that fast (one period delay is possible) and your hardware is capable to handle hardware timed buffered in- and output....
Your input is a sine that can be reduced to a pipe of 0 and 1 (comparator, diff, abs) that is feeded to the input buffer of your output(s) . The length of your buffer will define your delay. By adding more 0 or cutting some 0 you can control the delay.
If you only need a delay but without one (or more) period(s) shift and you have a clean sine (maybe filtered -> delay!!) I would go with a hardware comparator and a timer (4538) and control the delay with the the comparator ref. set by LabVIEW (->analog output).
05-28-2010 04:14 AM
Can someone help me with an example of program that I can use to replace the program I am triyng to use?
I am using LabVIEW 8.0 and ELVIS.I need to have a program that can write some impulses on a analog output of the ELVIS.The impulses must be syncronized with the passings trougth zer.The frequency is 50 Hz,the frequency of the network.
05-28-2010 05:51 AM - edited 05-28-2010 05:58 AM
The best option as I can see. Is to run a timed loop. If this option is included in 8.0 that is. The max speed of a timed loop is 1Khz, in non RT systems. It will have some jitter but I think it will do in school project. It is also important that you as soon as possible discuss your problems with your teacher. He is actually there to help you.
You can control the delay by counting iterations from zero crossing detection. Since you use a thyristor, you have to use a rectified AC, and the frequency will then be 100Hz, not 50Hz
Good Luck
05-28-2010 07:02 AM
Several years ago I had a project which required something similar: Read an analog input. Make a decision. Write an analog output within a specified time window relative to the input. No matter what I tried (~3 months, full time) I could not make it work reliably enough. It worked most of the time; but when it did not work, the consequences were unacceptable. This was with a time window of about 20 ms. We determined that the only reliable solution was to do the time critical part in hardware with software supervision.
Consider this: Is a one or two cycle delay acceptable? Assumption 1: The frequency does not vary significantly from cycle to cycle. Assumption 2: Nothing happens in one cycle (like fault current) which the thyristor cannot tolerate. Suppose you measure the time of the zero crossing and the magnitude of the voltage or current you are trying to regulate in cycle "k." Write the amount of trigger delay to a register or the preset of a (hardware) counter. Use the counter to set the delay and trigger the thyristor on cycle "k+1." Of course you can simultaneously measure cycle "k+1" for the delay for cycle "k+2." This approach allows software control of the trigger time while not requiring a real time OS because the critical timing is in hardware. If the OS delays the software so that the update for cycle "k+1" is missed, the register will still have the value from cycle "k." If things change relatively slowly from cycle to cycle the value from the previous cycle should be a good estimate of the value needed for the current cycle.
If you absolutely need immediate cycle by cycle control, you will need to go to an all hardware approach or to a real time operating system. Even at 1 kHz in the timed loop you will have 18 degree steps in the phase of your triggering of the thyristor (at 50 Hz). This may be adequate for a student project but is marginal for a real circuit.
What I am saying here is very similar to what Henrik Volkers posted a few days ago.
Lynn
05-28-2010 08:08 AM - edited 05-28-2010 08:16 AM
I we assume the thyristor is fed by full wave rectifier the frequency will be 100Hz, and hence only 36 degree steps in the phase of your triggering. Perhaps you can use a analog zero crossing detector. Then use the zero crossing detector to trigger a counter to determine the phase delay. And perhaps a second counter for the trigger pulse(triggered by the first counter). The counter timing is controlled by Labview. But only then changes to the timing is done.