R034 Array Combine Production


Outline

The Array Combine production combines multiple signals into one array.

Platforms:
32/64bit 32/64bit 32/64bit
Requirements:
  • None
Known limitations:
  • None
Status:
  • Stable
Input signals:
  • 1..N primitve Signals (Integer, Float, Text or Event).
Output signal:
  • Integer-, Float-, Text- or Event-Array: Array signal containing all values of the input signals. The value of first input signal will start at index 0, all following signals will be added after.
Parameters:
  • Process type: Process type of the resulting signal.
  • Signal type: Signal type of the resulting signal.
  • Signal descriptor: Signal descriptor of the resulting signal.
  • Domain base: Domain base of the resulting signal.
  • Domain range: Domain range of the resulting signal.
  • Keep tags: The output samples shall keep the tag information of each input sample.
  • Ignore 'None' samples: Ignore 'None' samples of the input signals.
  • Hide identical: Check to hide sequence of identical samples (will only write to output signal in case of changed sample value/tag, may not have any effect in case of 'Continuous' process type).
Operation:
                


Input Signal Configuration

The production accepts 1..N primitve Signals (Integer, Float, Text or Event).

Primary Source
The primary source is the first source signal of the production. For productions with multiple inputs it can be left empty, thus the first input is taken from the "Additional" sources.
Additional (Sources)
If more than 1 source signal is required, add them into this table. Instead of using the table you may drag and drop (with a closed dialog) signals onto the plot item.



Output Signal Configuration

Productions are executed on the fly, as soon as the signal data is required for further processing, and re-executed when settings or input signal have been changed. Before executing a script, the system needs to know the source signals, the type and the domain of the signal. All these informations need to be entered into the plot configuration dialog. If you leave the configuration fields empty, impulse tries to extract the information from the sources. The fields will display this information in light gray <e.g. Derived(Time)>. 

Process type
You may select between discrete and continuous process type.
Signal type
Select the output signal type of your script (FloatArray, TextArray, EventArray or IntegerArray).
Signal descriptor
The signal descriptor describes the signal type in more details (e.g the bit width of a logic vector (default<bits=16>)). See below for more details. But in most case, you will use the standard settings (default<>) - Press CTRL-Space to view content proposals.
Domain Class/Base
The domain base is just required if your output signal has a different domain than the source signals. If not, just don't touch these settings.
Domain Range
Use this field to set the domain range, so the minimum and maximum value of the domain (e.g. 0 .. 1000 Hz)


Production Configuration

The output signal is an Array signal containing all values of the input signals. The value of first input signal will start at index 0, all following signals will be added after.



Signal Handling

  • Keep tags: The output samples shall keep the tag information of each input sample.
  • Ignore 'None': Ignore 'None' samples of the input signals.
  • Hide identical: Check to hide sequence of identical samples (will only write to output signal in case of changed sample value/tag, may not have any effect in case of 'Continuous' process type).

The signal handling flags give the user more control over the output signal generation. If the "Keep tags" is checked, the output samples will get the tag information of each input samples. The "Ignore None" flag let the production ignore 'None' input samples. The "Hide identical" hides the production from generating sequences of identical samples.



Operation

Below you find the operation code for the production.

	

	// iterate
	while (iter.hasNext() && !isCanceled()) {
	
	    // step
	    Long current = iter.next(targetWriter);
	
	    // iterate over inputs
	    int idx = 0;
	    boolean changed = false;
	    for (int n = 0; n < input.length; n++) {
	
	        // input
	        ISamplePointer pointer = input[n];
	        if (pointer != null) {
	
	            // pointer stepped ?
	            if (pointer.getIndex() > sourceIndex[n]) {
	                sourceIndex[n] = pointer.getIndex();
	
	                // none sample
	                boolean isNone = pointer.isNone();
	                if (ignoreNone && isNone)
	                    continue;
	
	                // write changed value into array
	                if (value instanceof long[]) {
	                    long v = pointer.longValue();
	                    changed |= (hideIdentical && (v != ((long[]) value)[idx]));
	                    ((long[]) value)[idx] = pointer.longValue();
	                } else if (value instanceof Enumeration[]) {
	                    Enumeration v = pointer.enumValue();
	                    changed |= (hideIdentical && !Utils.equals(v, ((Enumeration[]) value)[idx]));
	                    ((Enumeration[]) value)[idx] = pointer.enumValue();
	                } else if (value instanceof double[]) {
	                    double v = pointer.doubleValue();
	                    changed |= (hideIdentical && (v != ((double[]) value)[idx]));
	                    ((double[]) value)[idx] = pointer.doubleValue();
	                } else if (value instanceof String[]) {
	                    String v = pointer.stringValue();
	                    changed |= (hideIdentical && !Utils.equals(v, ((String[]) value)[idx]));
	                    ((String[]) value)[idx] = pointer.stringValue();
	                }
	
	                // tag
	                boolean tag = keepTags && pointer.isTagged();
	                if (keepTags) {
	                    boolean total = tagged > 0;
	                    if (tag != tags[idx]) {
	                        tags[idx] = tag;
	                        tagged = tag ? tagged + 1 : tagged - 1;
	                    }
	                    changed |= (hideIdentical && (total != (tagged > 0)));
	                }
	            }
	            idx++;
	        }
	    }
	
	    // write
	    if (!hideIdentical || changed|| !initial) {
	        if (targetWriter instanceof IIntegerSamplesWriter && value instanceof long[])
	            ((IIntegerSamplesWriter) targetWriter).write(current, tagged > 0, (long[]) value);
	        else if (targetWriter instanceof IFloatSamplesWriter && value instanceof double[])
	            ((IFloatSamplesWriter) targetWriter).write(current, tagged > 0, (double[]) value);
	        else if (targetWriter instanceof IEventSamplesWriter && value instanceof Enumeration[])
	            ((IEventSamplesWriter) targetWriter).write(current, tagged > 0, (Enumeration[]) value);
	        else if (targetWriter instanceof ITextSamplesWriter && value instanceof String[])
	            ((ITextSamplesWriter) targetWriter).write(current, tagged > 0, (String[]) value);
	        initial = false;
	    }
			
                

toem

technical software and tooling

Company

Contact Us

This email address is being protected from spambots. You need JavaScript enabled to view it.