Getting Started: Developer Guide


The Wavelet Studio was built on the Microsoft. Net Framework 4 and you can use its library using any CLR compliant language. Just reference the file “waveletstudio.dll” in your project.

The library functions are available through blocks. Each block is an independent class and you can link blocks to create complex models for DSP systems.

Creating blocks:

To create a block just instantiate the class passing the parameters of the block.
For example, to create a block that generates a sine wave:

var signalBlock = new GenerateSignalBlock
{
    TemplateName = "Sine",
    Amplitude = 2.1,
    Frequency = 120,
    Phase = 0.5,
    Offset = 0.2,
    Start = 0,
    Finish = 5,
    SamplingRate = 1000,
    IgnoreLastSample = true
};
signalBlock.Execute();

var output = signalBlock.OutputNodes[0].Object.ToString(1);            
Console.WriteLine(output);

//Outputs the sine wave generated by the block
//0.2 -1.2 -1.9 -1.4 -0.1 1.4 2.3 2.0 0.7 -0.8 -1.8 -1.7 ...

The Block List section of the documentation shows the available blocks, its parameters and an example of implementation.

Block Collection:

You can use a block list to help control and execution of the blocks using the Blocklist class:

var block1 = new GenerateSignalBlock();
var block2 = new GenerateSignalBlock();

var blockList = new BlockList();
blockList.Add(block1);
blockList.Add(block2);

blockList.ExecuteAll();	        //Executes all blocks in the list

Connecting Blocks:

In the following example we create two blocks of signal generators and one block of convolution. Then we connect the first 2 blocks to the convolution block and execute it:

var block1 = new GenerateSignalBlock { TemplateName = "Cosine", Frequency = 10 };
var block2 = new GenerateSignalBlock { TemplateName = "Triangle", Frequency = 10 };
var convolutionBlock = new ConvolutionBlock();
var blockList = new BlockList
{
    block1, 
    block2, 
    convolutionBlock
};

block1.ConnectTo(convolutionBlock);
block2.ConnectTo(convolutionBlock);

blockList.ExecuteAll();

var output = convolutionBlock.OutputNodes[0].Object[0].ToString(1);
Console.WriteLine(output);

//Outputs the convolution of the signals generated by block1 and block2
//0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.2 0.2 0.2 ....

Graphically, this will build the following model:



You can always create your model using the Designer application and then export the C# code of the model (File Menu > Generate Code).

Last edited Jan 23, 2014 at 9:07 PM by walteram, version 3

Comments

No comments yet.