Data AcQuisition And Real-Time AnalysisScope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
Contact us about
Creating Pulse-Train Arbs
Note: The Engine Crank and Cam Sensor Simulator Mini-App is included with Daqarta to automate the following process for engine simulations. It not only allows easy control and visualization of teeth numbers and waveforms, it includes separate crank and cam designs that are saved together in stereo Arb files that stay in sync during testing.
The following demonstrates the basic design methods that you may find useful for creating other special-purpose pulse-train Arbs.
Suppose you want to simulate the signal from an engine crankshaft or camshaft position sensor, for testing an Electronic Control Unit (ECU) or Module (ECM) without an engine present. (Note that for certain sensors with rectangular pulse outputs, such as Hall types, you may also need a DC Pulse Output Circuit, or the super-simple 2 Channel USB Plug-Type Sound Card option discussed under Simple Sound Card Unipolar DC Modification.)
The typical modern engine uses a sensor that detects teeth on a gear, with one or two missing teeth to provide a reference mark. For one revolution, the sensor output is thus a series of pulses, with a gap.
As in the half-wave rectified sine, this wave is easy to create with Burst, but only at fixed frequencies. However, if you turn one complete multi-pulse revolution into an Arb wave, you can easily ramp it up and down in speed or put it through a complete simulated road test.
You can also create variations on this basic scheme, including waveforms other than pulses, or a narrow extra pulse instead of a missing pulse.
The steps involve first creating a Generator setup for the pulse-series waveform (or a variation), saving one complete revolution as a file, and then using it as an Arb wave in a separate Generator setup.
The Daqarta Pulse Wave options allow you to create pulse trains with adjustable positive and negative phase durations and amplitudes ("biphasic" pulses). However, to simplify this discussion we'll assume the ECU accepts a simple rectangular pulse from the sensor... which is typically the case.
Go to the Pulse Wave dialog and set Pulse A Width to 50%, and Pulse B Width to 0. (Later, you can create biphasic pulses if you wish, by adjusting these widths.) Set Reset Phase on Burst in the main Tone Freq dialog.
Alternatively, instead of a Pulse Wave you can use another waveshape. Some sensor outputs may be better approximated by a Sine or Triangle. You can even use a Ramp with adjustable Rise time. A Square wave will give essentially the same results as the above 50% Pulse, but will swing equally above and below zero. Since the sound card output is AC coupled anyway, this doubles the output voltage.
Suppose the engine you are simulating uses a 25-1 gear (it would have had 25 teeth, but one is missing). One cycle of the Pulse wave emulates one tooth passing the sensor, so the Arb needs to include 25 cycles overall, with one of those having zero amplitude.
The overall Arb should be at least 8192 samples long for best resolution. At a 48000 Hz Sample Rate, that gives 48000 * 25 / 8192 = 146.4844 Hz for the main Tone Freq.
Now we'll use the Burst Dialog controls to make a burst that is only 24 cycles long, leaving a gap for the missing tooth. Toggle the units button from sec to Smpls if needed. Rise and Fall should both be set to 0. The Burst Cycle should be 8192, and the High period should be 24/25 of that, or 7864.32 samples... we'll round that down to 7864.
The difference between the Cycle and High values (328) is the time the output is off for the missing tooth. As it stands, that gap would come at the end of the 24 pulses, so the first pulse after the gap would be the start of the cycle. (You can make the gap itself be the start of the cycle by setting Lag to 328, but the following discussion assumes you do not.)
Although you could save this as-is and get a good simulation of a crank position sensor, you should consider adding a modification so you can Trigger the waveform display on the start of each crank revolution. The way it stands now, all 24 pulses look alike to the Trigger, so you can't use Normal trigger mode... every tooth is a valid trigger point.
You could use Gen Sync Trigger mode, but that assumes a constant Tone Freq (RPM)... that's OK if you only change it manually to different constant values, but not if you vary it using a modulator (discussed below under Creating and Using the Arb File). Likewise for Trigger Holdoff.
The solution is to make the first of the 24 pulses a bit taller than the others, then set Trigger Level to be above the rest so you only trigger on that first pulse.
To do this, we'll add another Stream to the existing pulse train on Stream 0. Go to Stream 1 and set an identical 50% Pulse waveform (or whatever waveform you used on Stream 0) and the same 146.4844 Hz Tone Freq. Set its Burst parameters the same, with the exception of High: Instead of making it 24 pulses long (7864 samples), make it only one pulse long (328 samples).
With both Streams On, their outputs are automatically summed together. But their total can't exceed 100% at any time (the limit of the D/A converter), so set the individual Stream Levels so they sum to 100%. For example, set Stream 0 Level to 90% and Stream 1 Level to 10%, so that the first pulse will be 100% and all the rest will be 90%.
Now go to the Trigger Dialog and set the mode to Normal and Trigger Level to 95%. That will ignore all the pulses that are 90% high and trigger only on the 100% pulse. The start of the trace will be at the start of the pulse after the gap. To see the gap, set a negative Trigger Delay.
Note that since we have designed this pulse series to be 8192 samples long, and the screen only shows 1024 waveform samples at a time (with eXpand off), you won't see the full series that corresponds to one revolution. If you want to do that, you can set Decimate on with a Factor of 8 or more. Just make sure to toggle Decimate back off before you use this to create an Arb file (below).
The CrankRaw25-1.GEN file included with Daqarta is an example of the above setup. Note, however, that .GEN setups don't include Trigger settings, so you will still need to do that manually. They will be retained for future Daqarta sessions.
You can use this as a starting point for creating other sensor simulators. For example, to change the waveform to Sine or Triangle, just change the Stream 0 and Stream 1 Wave types.
For a different number of teeth, you have to compute a new Tone Frequency for both streams and new Burst durations for each. For N total teeth (the number of teeth on an imaginary gear before removing any for the reference gap), with a gap of G missing teeth and a sample rate of 48000 Hz:
Tone Frequency = 48000 * N / 8192
Stream 0 Burst High = 8192 * (N - G) / N
Stream 1 Burst High = 8192 / N
Instead of a missing tooth as a reference mark, some sensor systems use a gear with a narrow added tooth between two normal teeth. To create this we will start by leaving Burst off on Stream 0, but otherwise using the same Tone Frequency and Level (90%).
Stream 0 Tone Frequency = 48000 * N / 8192
Stream 0 Burst OFF
The narrow reference tooth will be added by Stream 1 with a Tone Frequency that is 3 times higher, and Burst set so that the reference pulse will be 1/3 of the normal width. You also need to use Burst Lag to position the pulse in the gap between the first two normal pulses:
Stream 1 Tone Frequency = 48000 * 3 * N / 8192
Stream 1 Burst High = 8192 / (3 * N)
Stream 1 Burst Lag = 2 * Burst High
To enable Daqarta to trigger on this added pulse, set Stream 1 Level to 100%. (Not 10% as before, since this pulse is in a gap where it isn't adding to an existing pulse.)
The CrankRaw24p1.GEN file included with Daqarta is an example with 24 normal teeth plus one narrow tooth as the reference.
To simulate an extra-tooth system like the above, but with Sine waves, you again use Stream 0 Tone Frequency as above, only with Burst active and Burst High set to remove one half cycle, and Lag set to center the extra tooth about the desired reference. Level is still 90%.
Stream 0 Tone Frequency = 48000 * N / 8192
Stream 0 Burst Lag = 8192 / (2 * N)
Stream 0 Burst High = 8192 * ((2 * N) - 1) / (2 * N)
The added sine on Stream 1 will be 1.5 cycles of 3 times the frequency, with no Lag. If it starts on the negative phase, this will center a positive half-cycle in the middle of the Stream 0 gap to become the reference point, with flanking negative half-cycles to fill in the gap.
To get the negative starting phase the Stream 0 Phase control is set to 180 degrees (inverted). Level is 100% for triggering. (Alternatively, you could leave Phase at 0 and set Level to -100%, which also inverts.)
Stream 1 Tone Frequency = 48000 * 3 * N / 8192
Stream 1 Burst High = 8192 / (2 * N)
The resulting waveform has slight kinks where the 3X sine meets the normal sine. The CrankRaw24s3.GEN file included with Daqarta is an example with 24 normal teeth plus one narrow tooth as the reference. You can easily modify it for Triangle, Ramp, or Square waves just by changing the Wave selection for both streams.
In the more general case of E extra teeth, the Stream 1 tone frequency is (2*E+1) times the Stream 0 frequency:
Stream 1 Tone Frequency = 48000 * (2*E+1) * N / 8192
However, when there are 2 or more added peaks it becomes more difficult to trigger. The best aproach would be to set Level to 90% (the same as Stream 0), but add a third stream (Stream 2) with Level at 10% and with High and Lag set to boost only one of the Stream 1 half-cycles.
Now, as discussed in Creating Rectified-Wave Arbs, use DDisk with the Triggered Start option and Write Size Preset at 8192 to record this to a .DQA file file. The file Crank25-1.DQA was created this way, and is included in the Daqarta package.
Load Default.GEN to get a fresh Generator setup, and load Crank25-1.DQA (or whatever you named your file) as an Arb to Stream 0. Set Tone Freq to 55 Hz for now.
Open the Trigger Control dialog and set Normal Trigger Mode. Make sure Trigger Source is set to Left Out and Slope is set to Pos. Now set Trigger Level to 95%, which is midway between the 100% level of the first pulse, and the 90% level of the rest. You should see a stable display.
Engine RPM is 60 times the Tone Freq in Hz, so 10 Hz = 600 RPM and 100 Hz = 6000 RPM. You can vary the engine speed smoothly between these limits using FM. With Tone Freq at 55 Hz (3300 RPM), set Deviation to 45 Hz so the frequency will swing between 55 - 45 = 10 and 55 + 45 = 100. Set the FM Modulation Frequency to the reciprocal of the total time you want this speed cycle to take, such as 0.1 Hz to get a 10 second cycle.
The CrankFM.GEN setup included with Daqarta is an example of the above. It automatically loads Crank25-1.DQA and uses it to simulate a 10-second 600-6000 RPM cycle. However, you will still need to set the Trigger dialog as discussed, because those settings aren't part of Generator setups.
The instantaneous RPM can be monitored using RPM mode in the Frequency Counter. Be sure to read the Cylinders topic... it explains how to measure RPM from the sensor signal, or from an individual spark or fuel injection line.
Note that the Crank25-1.DQA simulation is on Stream 3, not the default Stream 0 that opens when you first click the Left Wave Controls button. That's to allow custom tests, since modulator streams must precede those being modulated. (You can unload Crank25-1 by hitting the X button next to it in the Arb dialog, if you want to use a different simulation. Or you can load up to 8 different Arb files to allow quick changes.)
You can create a second Arb file to control the RPM according to some predefined test schedule. The CrankRamp.GEN setup included with Daqarta uses Streams 0 and 1 to create linear ramps and holds, which are summed together by setting the Stream 3 FM Source to use both L.0 Stream and L.1 Stream.
A text file of values can be loaded directly as an Arb file, converted to an .DAT file, created using the Arb_From_List macro mini-app to interpolate from a list of times and amplitudes, or you can create it using the Generator... see Creating Complex Arb Waves for details.
Questions? Comments? Contact us!We respond to ALL inquiries, typically within 24 hrs.
Over 30 Years of Innovative Instrumentation
© Copyright 2007 - 2017 by Interstellar Research
All rights reserved