mwpl.bridge.core.ChannelTest
- Last UpdatedApr 28, 2023
- 1 minute read
The mwpl.bridge.core.ChannelTest channel is a simple test channel for testing purposes.
Code example
This is a code example for mwpl.bridge.core.ChannelTest.
<channel name="test" class="mwpl.bridge.core.ChannelTest"/>
Parameters
These are parameters for the channel connection.
|
Attribute |
Description |
Use |
|---|---|---|
|
name |
The name of the channel. |
Mandatory |
|
class |
Must be mwpl.bridge.core.ChannelTest. |
Mandatory |
Simulation
Inside the <simulation> node, the test supports only one kind of variable.
<test refreshTime="100">
<var name="V_sstring" value="pippo" valuegen="rndstr:pippo,cane,oronzo"/>
<var name="V_sbool" value="true" valuegen="rndstr:true,false"/>
<var name="V_sint" value="1" valuegen="rndint:0,5000"/>
<var name="V_sfloat" value="0.1" valuegen="rndfloat:0,1"/>
<var name="V_sfloat2" value="0" valuegen="sin:1,0.5,1"/>
</test>
Test attribute
|
Attribute |
Description |
Use |
|---|---|---|
|
refreshTime |
An interval in milliseconds for automatic value generation. |
Mandatory |
Variable attributes
All variables are string type, so they can be used to host every kind of value (numbers, texts, dates).
|
Attribute |
Description |
Use |
|---|---|---|
|
name |
The name of the variable. |
Mandatory |
|
value |
The starting value of the variable. Used only when valuegen is not set. |
Optional |
|
valuegen |
This attribute can be set to different values to emulate value generation. |
Optional |
Value generators
When the valuegen attribute is set, the variable value is automatically modified by the channel at refreshTime interval.
The list of available value generators.
|
Valuegen |
Description |
Type |
|---|---|---|
|
rndstr:OPT1,OPT2… |
Randomly selects among the options. Can be used for texts, booleans, integers and so on. |
STRING |
|
rndint:MIN,MAX |
Randomly returns a value between min and max. |
INT |
|
rndfloat:MIN,MAX |
Randomly returns a value between min and max. |
FLOAT |
|
sin:PERIOD,AMPLITUDE,ADD |
Returns a sinusoidal value according to the formula, AMPLITUDE*sin(timeElapsed/PERIOD)+ADD. |
FLOAT |