A09 Scripted Reader

Content outdated

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

If you want to read signal and trace data from a TCP, files, serial, or any other port input and with a format that is unknown to impulse , a scripted reader can help you to get on track.

Screen Cast: A09 Scripted Reader

Scripted reader can be used with ports only (they are not integrated into the eclipse content management). To use a Scripted Reader, you need to add a port (e.g. resource, file, tcp,...) with the option "Scripted Reader" as Serializer and a serializer configuration that contains the actual script.

How to create a reader ?

To create a Scripted Reader open the preferences and go to "impulse->Serializer-> Scripted Reader", open the configuration dialog and add a new Scripted Reader configuration.

The impulse JDK

No matter if you develop a reader, a recJs script, a search expression or a Signal Script production, impulse provides you always with the same interfaces to read, compare, analyze or generate signal data.

[widgetkit id=60]

Open JavaDoc Reference Show recJs Script examples

More about scripting impulse

How to create signal and scopes ?

Below you find the interface to impulse:

Record generator object of type ISingleDomainRecordGenerator. Its interface allow you to create scopes and signals.
java.io.InputStream object that provides the input data.
Progress indication object of type TimeoutProgress. This object allows you to indicate the current progress and to control the timeout.
Console output of type MessageConsoleStream.
To create a record , the following steps are required:
  • Initialize the record
  • Add the record content (scopes, signals and proxies)
    • Open the writer
    • Write samples
    • Close the writer

Here you find a short example for a scripted reader.

// generator: of ISingleDomainRecordGenerator  (http://toem.de/index.php/projects/impulse/scripts/reference)
// inputStream: input stream of type java.io.InputStream
// console: console output of type MessageConsoleStream


// Init the record
generator.initRecord("Example Record", TimeBase.ns);
var a = generator.addSignal(null, "a", "", ProcessType.Discrete, SignalType.Integer, SignalDescriptor.DEFAULT);
var b = generator.addSignal(null, "b", "", ProcessType.Discrete, SignalType.Integer, SignalDescriptor.DEFAULT);
var c = generator.addSignal(null, "c", "", ProcessType.Discrete, SignalType.Integer, SignalDescriptor.DEFAULT);
var d = generator.addSignal(null, "d", "", ProcessType.Discrete, SignalType.Integer, SignalDescriptor.DEFAULT);
var wa <:IIntegerSamplesWriter:> = generator.getWriter(a);
var wb <:IIntegerSamplesWriter:> = generator.getWriter(b);
var wc <:IIntegerSamplesWriter:> = generator.getWriter(c);
var wd <:IIntegerSamplesWriter:> = generator.getWriter(d);

var current = 0;

try {
    var reader <:BufferedReader:> = new BufferedReader(new InputStreamReader(inputStream));
    var line <:String:> = reader.readLine(); // skip empty header
    while ((line = reader.readLine()) != null) {
        var splitted = line.split(";");
        var current = TimeBase.ns.parseUnits(splitted[0]+"ms");
        console.println(current+" "+line+" "+line.length());
        wa.writeInt(current, false, splitted[1]);
        wb.writeInt(current, false, splitted[2]);
        wc.writeInt(current, false, splitted[3]);
        wd.writeInt(current, false, splitted[4]);
} catch (e) {
    console.println(e); // pass exception object to error handler

generator.close(current + 1);


technical software and tooling


Contact Us

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