Transaction_Sequence

Parent Previous Next

Full Library / Source / Interactive / Traffic
Block Name: Traffic

Code File Location: VisualSim/actor/lib/Traffic

Block Overview

o       Generate transactions or Data Structures in a specific sequence.

o       Vary the sequence order using probability and vary the time interval.  

o       It is used to generate tests for corner cases.

Description

This block is used to generate a sequence of data structures. Each line of the file or Window is a data structure. The sequence can be modulated by using the trigger port, Time and/or the Probability fields. The sequence is listed in the parameter window or defined in a separate .csv file or an text file. If using files, the file name will be listed in place of the sequence in the parameter window. The fields of the Data Structures are the column headings. This block generates one data structure for each sequence line. The order of the sequence output will depend on the mode selected. When the last line of the sequence is generated, the final Data Structure is simultaneously sent on both the output and done output ports.  

This block accepts a file name as a parameter. There are a number of file path options available for this block.  To see the list, view the section on File Paths in the Basic technology document here. The file name is a concatenation of any number of individual strings and parameters, separated by "+".  To view the file path in a demo model, click here.

The items in the Database can be of any data type.  Also, the items can be a calulation containing Parameters and scalar values.  Any computed values must be within parathesis ().  

  1. The initial content of the database block can be provided in 4 formats- Text Window, CSV file, TXT File and XML file.  Click on the links to see the file formats.

Sample Lookup table Syntax for csv and txt files:
  a) for TXT format,
             ID  MyStr  MyInt  MyDbl  ;    
             0    "Str_1"    1        1.0   ;
             1    "Str_2"    2        2.0   ;
             2    "Str_3"    3        3.0   ;
             0    "Str_4"    1        4.0   ;
             1    "Str_5"    2        5.0   ;

b) for CSV format,
            ID,MyStr,MyInt,MyDbl
             int,string,int,double   
             0,Str_1,1,1.0 

                       1,Str_2,2,2.0  
                       2,Str_3,3,3.0  
                       0,Str_4,1,4.0  
                       1,Str_5,2,5.0 

 

  1. The Data_Structure_Text can refer to the xml, txt or csv file in the following different formats.  Click on examples provided for the xml file, txt file and csv file file entry format.  These examples are for the Database block but the format is identical with the Transaction_Sequence block.
  1. The first row will contain the names of the columns.
  2. Maximum number of rows for simulation performance is about 4000.  

Following are the five modes of operation for this block:

 

Modes

Explanation

Trigger

An input 'trigger' is required to send the data structure out. One data structure is sent out for each line defined in the sequence, in the order listed. When the list is complete, the generation repeats. For this mode, the Time_Field and the Probability_Field values must be left to the default or say 'None". Any value can be used to trigger the block.

Time_Field

The time to delay the current data structure before sending it on the output is specified in the Time_Value field. The Time_Value field can either be a fixed double value (no quotes) or a column name of the sequence list. If the column name is specified, then the value in the column for the generated line will be used. This does not require trigger to start the initial sequence. The last line in the sequence will generate a data structure on the output and done ports. This done port can be connected back to the input port to repeat the sequence. A delay is required between the done and input ports, else a runtime error will be generated. This can emulate a burst traffic.

trigger port + Probability_Field

This similar to the Mode 1 but the order of the generated sequence is based on a cumulative probability mass function. The 'Probability_Field' designates a column for the probability. The total values of all values in the column must not exceed 1.0, else a exception will be reported. When the input is triggered, a random number is generated between 0.0 and 1.0. For example, if the generated value is 0.6, then the first line with the cumulative of itself and all the values prior to it in the Probability column greater than 0.6 is selected. Note: A word of caution. For the distribution to reach steady state, sufficient number of triggers must be generated else the output sequence may look a little skewed towards one probability value.

Time_Field + Probability_Field

This combines the functionality of mode 2 and 3. The probability is first applied to select the line and then the delay. A trigger is not required for this mode.

trigger port + Time_Field + Probability_Field

This requires a trigger to start the first sequence. This combines the functionality of modes 1, 2 and/or 3. The trigger is denoted as a prefix for the "Time_Field". Format: "trigger_fieldname". The time and probability can be combined or the time alone can be used here. The trigger is required.

 

To understand the modes of operation, review the Traffic Example in the BDE.

 

Parameter

Explanation

Type

Example

Data_Structure_Text 

This window can contain the table or can have the name for the file.  The table will contain the rows of data structures with each column of the row denoting one field. The relative path to the csv or XML Files, including *. xml or *.csv file extension can be specified. In both the file and text window, the first row should contain the field names. The generated Data Structure will add the standard Data Structure header fields (BLOCK, DS_NAME, DELTA, TIME, INDEX, ID).

Text

A sequence like this:

ID  MyStr  MyTime  MyProb     
0  Str_1    1.0     0.2    /*DS 1 */
1  Str_2    1.0     0.2    /* DS 2 */
2  Str_3    1.0     0.2    /* DS 3 */
3  Str_4    1.0     0.2    /* DS 4 */
4  Str_5    1.0     0.2    /* DS 5 */

will translate into a data structure like this for the first line:

{BLOCK    = "Transaction_Sequence",
DELTA      = 0.0,
DS_NAME   = "DS_Transaction_Sequence",
ID         = 0,
INDEX     = 0,
MyProb    = 0.2,
MyStr      = "Str_1",
MyTime    = 1.0,
TIME       = 1.0}

Notice that the Header fields have been added automatically to the Data Structure.

Time_Field

It is used to designate a value for delays between data structures. This can be a field_name or double value without quotes.  Field Name of "None" means trigger input is required.

General

“TIME” for field name, “Delay_Counter” for column name or 1.0 for double value.

Probability_Field

Probability Field Name, used to designate a field for probability of selecting a data structure. Field Name of "None" means trigger input or time input is required.

String

Example can be “DELTA” for field name or “Random_Num” for column name.

Output_Expression

This block can output either the selected data structure, a field of the selected data structure or the result of a regular Expression. For this purpose it uses the combination of the matched Data Structure fields and any function of the expression language.

o       If a full data structure is to be sent out, then the default value in the Expression field is"output = traffic".

o       If a field of the selected Data Structure is to be sent out, then the format will be "output = traffic.field_a

If the result of an Expression, then the format will be "output = traffic.field_a * traffic.field_b + (Regular Expression operation). The Expresion language can use all the fields of the selected sequence line and from the incoming data structure. The input data structure is denoted with the input. prefix before the field name.  The block will solve the entire RHS as an expression and then place the result value on the output port.

A "" is required around the complete expression. Output Expression Example

String

output = traffic”

 

Port 

Explanation        

Type

trigger 

The trigger port is required to generate tokens for 1, 3, 5 and is used to restart the generation in all modes. The input token can be of any data type.   

General

output 

The output port will either output a Data Structure or a field of the Data Structure.

General

done   

Every time the last line is generated, the same data structure is sent to both the output and done ports. 

Typical use is to restart the traffic by rerouting to the trigger port. Alternatively, one can let it drop, and stop the flow of data structures. 

General

 

Created with the Personal Edition of HelpNDoc: Easy EBook and documentation generator