Home

J001 Creating records

Content outdated

We are in the process of migrating all content to impulse version 2.0.

If you develop a reader, a recJs script or are simple Signal Script production, impulse provides you always the same interfaces to simply create records, scopes and signals.


Screen Cast: J01 Creating records


Independent from its source and type, impulse organizes all signal data by using these elements:

See 02 Signal Basics for more about signals.


Record generator

The record generator help you to prepare a record with all its contents. If you create a reader, your class will be derived from IRecordGenerator, if you are working with recJs scripts or a scripted reader, a IRecordGenerator variable (generator) will be provided. The "Signal Script" production does not require to use a record generator, as the signal and reader setup is done internally.

To create a record , the following steps are required:

The ISingleDomainRecordGenerator interface provides a more comfortable interface when using records with only 1 domain base. Open JavaDoc Reference

Experimenting with records

If you want to experiment with records and signals, just create a file/resource with file ending "recJs" (e.g. my_wave.recJs) and put the following text into the header of the file ("//-recjs" is important to get the file identified) :

//-recjs (keep this line)
// Vars:
// * generator of ISingleDomainRecordGenerator
//
void initRecord(String name);
....

Add your code below and open with impulse.


Record initialization

The initialization provides the record with a name and in case of ISingleDomainRecordGenerator also with a domain base:


Interface

void initRecord(String name);
    
// ISingleDomainRecordGenerator only
void initRecord(String name, IDomainBase domainBase); 

Examples

// Java (reader derived from IRecordGenerator, ISingleDomainRecordGenerator)
initRecord("Example Record");
initRecord("Example Record",TimeBase.ns);
// JavaScript (recJs, scripted reader,..)
generator.initRecord("Example Record");
generator.initRecord("Example Record",TimeBase.ns);

Adding scopes

Scopes let you organize your signals within a hierarchy. To add a scope you need a container (or null for the root), a name and optionally a description.


Interface

Scope addScope(ICell container, String name);
Scope addScope(ICell container, String name, String description);

Examples

// Java (reader derived from IRecordGenerator, ISingleDomainRecordGenerator)
addScope(null, "External Signals");
addScope(null, "External Signals","Just for this");
// JavaScript (recJs, scripted reader,..)
generator.addScope(null, "External Signals");
generator.addScope(null, "External Signals","Just for this");

Defining signals

After defining a signal, you can create a writer to add samples. To define a signal you need a signal and process type. The signal type defines the data type of a signal (text, integer, float, ...). The process type defines how the samples are organized on the domain (Discrete: at any position; Continuous: at fixed positions with equal distance).
impulse supports the following signal types:

The signal descriptor contains additional information about the signal.
The domain of a signal may be Time,Frequency,Index,... . The domain base represents the the minimum distance between two samples (e.g. ns or ps).
If "createWriter" is set to true (the default value), a writer is generated in background.


Interface

Signal addSignal(ICell container, String name, String description, 
    	ProcessType processType, SignalType signalType, 
    	SignalDescriptor signalDescriptor, IDomainBase domainBase);
Signal addSignal(ICell container, String name, String description, 
    	ProcessType processType, SignalType signalType, SignalDescriptor signalDescriptor, 
        IDomainBase domainBase, boolean createWriter));
    
// ISingleDomainRecordGenerator only
Signal addSignal(ICell container, String name, String description, 
    	ProcessType processType, SignalType signalType, 
        SignalDescriptor signalDescriptor);    

Examples

// Java (reader derived from IRecordGenerator, ISingleDomainRecordGenerator)
Scope signals = addScope(null, "External Signals");
Signal clk = addSignal(signals, "Clk", "", ProcessType.Discrete, 
    	SignalType.Logic, SignalDescriptor.DEFAULT);
// JavaScript (recJs, scripted reader,..)
var signals = generator.addScope(null, "External Signals");
var clk = generator.addSignal(signals, "Clk", "", 
    	ProcessType.Discrete, SignalType.Logic, SignalDescriptor.DEFAULT);

The signal descriptor

In above examples i used the default signal descriptor (SignalDescriptor.DEFAULT). You may use a dedicated signal descriptor:
public SignalDescriptor(String content, int scale0, int accuracy, int format);
Signal signal2 = addSignal(signals, "Integer3", "XY", 
	ProcessType.Discrete, SignalType.IntegerArray, 
    new SignalDescriptor(SignalDescriptor.CONTENT_DEFAULT,2,
    ISample.INTEGER_ACCURACY_DEFAULT,ISample.FORMAT_DEFAULT));

Adding proxies

Proxies are signals that contains the identical content of a another signal. To create a proxy, you just need a container (or null for the root), a name, a descritpion (or null) and the referenced signal (must not be null).


Interface

	SignalProxy addSignalProxy(ICell container, String name, String description, Signal signal);

Examples

// Java (reader derived from IRecordGenerator, ISingleDomainRecordGenerator)
Signal clk = addSignal(signals, "Clk", "", 
    	ProcessType.Discrete, SignalType.Logic, SignalDescriptor.DEFAULT);
addSignalProxy(other, "External Signals","Just for this",clk);
// JavaScript (recJs, scripted reader,..)
var clk = generator.addSignal(signals, "Clk", "", 
    	ProcessType.Discrete, SignalType.Logic, SignalDescriptor.DEFAULT);
generator.addSignalProxy(other, "External Signals","Just for this",clk);
The next chapter ( J02 Using sample writers ) handles the writer creation and the steps of writing samples.