reactor-c
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
fedsd Namespace Reference

Functions

 svg_string_draw_line (x1, y1, x2, y2, type='')
 Routines to get svg descriptions.
 
 svg_string_draw_arrow_head (x1, y1, x2, y2, type='')
 
 svg_string_draw_label (x1, y1, x2, y2, label)
 
 svg_string_draw_arrow (x1, y1, x2, y2, label, type='')
 
 svg_string_draw_side_label (x, y, label, anchor="start")
 
 svg_string_comment (comment)
 
 svg_string_draw_dot (x, y, label)
 
 svg_string_draw_dot_with_time (x, y, time, label)
 
 svg_string_draw_adv (x, y, label)
 
 load_and_process_csv_file (csv_file)
 Routines to process lft and csv files.
 
 command_is_in_path (command)
 
 convert_lft_file_to_csv (lft_file, start_time, end_time)
 
 get_and_convert_lft_files (rti_lft_file, federates_lft_files, start_time, end_time)
 

Variables

str css_style
 
dict prune_event_name
 
 parser = argparse.ArgumentParser(description='Set of the lft trace files to render.')
 
 type
 
 help
 
 nargs
 
 str
 
dict non_tagged_messages = {'FED_ID', 'ACK', 'RESIGN', 'FAILED', 'REJECT', 'ADR_QR', 'ADR_AD', 'MSG', 'P2P_MSG'}
 
 args = parser.parse_args()
 
 rti_csv_file
 
 federates_csv_files
 
dict x_coor = {}
 
list actors = []
 
dict actors_names = {}
 
int padding = 50
 
int spacing = 200
 
 trace_df = pd.DataFrame()
 
 fed_df = load_and_process_csv_file(fed_trace)
 Federates trace processing.
 
 fed_id = fed_df.iloc[-1]['self_id']
 
 rti_df = load_and_process_csv_file(rti_csv_file)
 RTI trace processing, if any.
 
 columns
 
int ppt = 0
 Compute the 'y1' coordinates.
 
int cpt = 0
 
int py = 0
 
int min = 15
 
int scale = 1
 
bool first_pass = True
 
 self_id = trace_df.at[index,'self_id']
 
 partner_id = trace_df.at[index,'partner_id']
 
 event = trace_df.at[index,'event']
 
 logical_time = trace_df.at[index, 'logical_time']
 
 microstep = trace_df.at[index, 'microstep']
 
 inout = trace_df.at[index, 'inout']
 
 matching_df
 
 matching_index = matching_df.index[0]
 
 matching_row = matching_df.loc[matching_index]
 
int svg_width = padding * 2 + (len(actors) - 1) * spacing + padding * 2 + 200
 Write to svg file.
 
int svg_height = padding + trace_df.iloc[-1]['y1']
 
 encoding
 
dict title = actors_names[key]
 
int center = 15
 
str anchor = 'start'
 
str physical_time = f'{int(row["physical_time"]/1000):,}'
 
 label = row['event']
 
 index
 

Detailed Description

In the dataframe, each row will be marked with one op these values:
    - 'arrow': draw a solid arrow
    - 'dot': draw a dot only
    - 'marked': marked, not to be drawn
    - 'pending': pending
    - 'adv': for reporting logical time advancing, draw a simple dash

Function Documentation

◆ command_is_in_path()

fedsd.command_is_in_path ( command)
Checks if a command is in the PATH.

Args:
 * command: The command to check.
Returns:
 * True if the command is in the PATH, False otherwise.

◆ convert_lft_file_to_csv()

fedsd.convert_lft_file_to_csv ( lft_file,
start_time,
end_time )
Call trace_to_csv command to convert the given binary lft trace file to csv format.

Args:
 * lft_file: the lft trace file
Return:
 * File: the converted csv file, if the conversion succeeds, and empty string otherwise.
 * String: the error message, in case the conversion did not succeed, and empty string otherwise.

◆ get_and_convert_lft_files()

fedsd.get_and_convert_lft_files ( rti_lft_file,
federates_lft_files,
start_time,
end_time )
Check if the passed arguments are valid, in the sense that the files do exist.
If not arguments were passed, then look up the local lft files.
Then, convert to csv.

Args:
 * File: the argument passed at the command line as the rti lft trace file.
 * Array: the argument passed at the command line as array of federates lft trace files.
Return:
 * File: the converted RTI trace csv file, or empty, if no RTI trace lft file is found
 * Array: Array of files of converted federates trace csv files

◆ load_and_process_csv_file()

fedsd.load_and_process_csv_file ( csv_file)

Routines to process lft and csv files.

Loads and processes the csv entries, based on the type of the actor (if RTI
or federate).

Args:
 * csv_file: String file name
Returns:
 * The processed dataframe.

◆ svg_string_comment()

fedsd.svg_string_comment ( comment)
Constructs the svg html string to write a comment into an svg file.

Args:
 * comment: String Comment to add
Returns:
 * String: the svg string of the comment

◆ svg_string_draw_adv()

fedsd.svg_string_draw_adv ( x,
y,
label )
Constructs the svg html string to draw at a dash, meaning that logical time is advancing there.

Args:
 * x: Int X coordinate of the dash
 * y: Int Y coordinate of the dash
 * label: String to draw 
Returns:
 * String: the svg string of the triangle

◆ svg_string_draw_arrow()

fedsd.svg_string_draw_arrow ( x1,
y1,
x2,
y2,
label,
type = '' )
Constructs the svg html string to draw the arrow from (x1, y1) to (x2, y2). 
The arrow end is constructed, together with the label

Args:
 * x1: Int X coordinate of the source point
 * y1: Int Y coordinate of the source point
 * x2: Int X coordinate of the sink point
 * y2: Int Y coordinate of the sink point
 * label: String Label to draw on top of the arrow
 * type: The type of the message
Returns:
 * String: the svg string of the arrow

◆ svg_string_draw_arrow_head()

fedsd.svg_string_draw_arrow_head ( x1,
y1,
x2,
y2,
type = '' )
Constructs the svg html string to draw the arrow end

Args:
 * x1: Int X coordinate of the source point
 * y1: Int Y coordinate of the source point
 * x2: Int X coordinate of the sink point
 * y2: Int Y coordinate of the sink point
 * type: The type (for styling)
Returns:
 * String: the svg string of the triangle

◆ svg_string_draw_dot()

fedsd.svg_string_draw_dot ( x,
y,
label )
Constructs the svg html string to draw at a dot.

Args:
 * x: Int X coordinate of the dot
 * y: Int Y coordinate of the dot
 * label: String to draw 
Returns:
 * String: the svg string of the triangle

◆ svg_string_draw_dot_with_time()

fedsd.svg_string_draw_dot_with_time ( x,
y,
time,
label )
Constructs the svg html string to draw at a dot with a prefixed physical time.

Args:
 * x: Int X coordinate of the dot
 * y: Int Y coordinate of the dot
 * time: The time
 * label: String to draw 
Returns:
 * String: the svg string of the triangle

◆ svg_string_draw_label()

fedsd.svg_string_draw_label ( x1,
y1,
x2,
y2,
label )
Computes the rotation angle of the text and then constructs the svg string. 

Args:
 * x1: Int X coordinate of the source point
 * y1: Int Y coordinate of the source point
 * x2: Int X coordinate of the sink point
 * y2: Int Y coordinate of the sink point
 * label: The label to draw
Returns:
 * String: the svg string of the text

◆ svg_string_draw_line()

fedsd.svg_string_draw_line ( x1,
y1,
x2,
y2,
type = '' )

Routines to get svg descriptions.

Constructs the svg html string to draw a line from (x1, y1) to (x2, y2).

Args:
 * x1: Int X coordinate of the source point
 * y1: Int Y coordinate of the source point
 * x2: Int X coordinate of the sink point
 * y2: Int Y coordinate of the sink point
 * type: The type of the message (for styling)
Returns:
 * String: the svg string of the lineĀ©

◆ svg_string_draw_side_label()

fedsd.svg_string_draw_side_label ( x,
y,
label,
anchor = "start" )
Put a label to the right of the x, y point,
unless x is small, in which case put it to the left.

Args:
 * x: Int X coordinate of the source point
 * y: Int Y coordinate of the source point
 * label: Label to put by the point.
 * anchor: One of "start", "middle", or "end" to specify the text-anchor.
Returns:
 * String: the svg string of the text

Variable Documentation

◆ actors

list fedsd.actors = []

◆ actors_names

dict fedsd.actors_names = {}

◆ anchor

str fedsd.anchor = 'start'

◆ args

fedsd.args = parser.parse_args()

◆ center

int fedsd.center = 15

◆ columns

fedsd.columns

◆ cpt

fedsd.cpt = 0

◆ css_style

str fedsd.css_style
Initial value:
1= ' <style> \
2 line { \
3 stroke: black; \
4 stroke-width: 2; \
5 } \
6 .ABS {stroke: #d9dd1f; fill: #d9dd1f; } \
7 .LTC { stroke: #073b4c; fill: #073b4c;} \
8 .T_MSG { stroke: #ef476f; fill: #ef476f} \
9 .NET { stroke: #118ab2; fill: #118ab2} \
10 .PTAG { stroke: #06d6a0; fill: #06d6a0} \
11 .TAG { stroke: #08a578; fill: #08a578} \
12 .TIMESTAMP { stroke: grey; fill: grey } \
13 .FED_ID {stroke: #80DD99; fill: #80DD99 } \
14 .ADV {stroke-linecap="round" ; stroke: "red" ; fill: "red"} \
15 text { \
16 font-size: smaller; \
17 font-family: sans-serif; \
18 } \
19 text.time {fill: #074936; } \
20</style> \
21'

◆ encoding

fedsd.encoding

◆ event

fedsd.event = trace_df.at[index,'event']

◆ fed_df

fedsd.fed_df = load_and_process_csv_file(fed_trace)

Federates trace processing.

Loop over the given list of federates trace files

◆ fed_id

fedsd.fed_id = fed_df.iloc[-1]['self_id']

◆ federates_csv_files

fedsd.federates_csv_files

◆ first_pass

bool fedsd.first_pass = True

◆ help

fedsd.help

◆ index

fedsd.index

◆ inout

fedsd.inout = trace_df.at[index, 'inout']

◆ label

str fedsd.label = row['event']

◆ logical_time

fedsd.logical_time = trace_df.at[index, 'logical_time']

◆ matching_df

fedsd.matching_df
Initial value:
1= trace_df[\
2 (trace_df['inout'] != inout) & \
3 (trace_df['self_id'] == partner_id) & \
4 (trace_df['partner_id'] == self_id) & \
5 (trace_df['arrow'] == 'pending') & \
6 (trace_df['event'] == event) & \
7 (trace_df['logical_time'] == logical_time) & \
8 (trace_df['microstep'] == microstep) \
9 ]

◆ matching_index

fedsd.matching_index = matching_df.index[0]

◆ matching_row

fedsd.matching_row = matching_df.loc[matching_index]

◆ microstep

fedsd.microstep = trace_df.at[index, 'microstep']

◆ min

int fedsd.min = 15

◆ nargs

fedsd.nargs

◆ non_tagged_messages

dict fedsd.non_tagged_messages = {'FED_ID', 'ACK', 'RESIGN', 'FAILED', 'REJECT', 'ADR_QR', 'ADR_AD', 'MSG', 'P2P_MSG'}

◆ padding

int fedsd.padding = 50

◆ parser

fedsd.parser = argparse.ArgumentParser(description='Set of the lft trace files to render.')

◆ partner_id

fedsd.partner_id = trace_df.at[index,'partner_id']

◆ physical_time

str fedsd.physical_time = f'{int(row["physical_time"]/1000):,}'

◆ ppt

fedsd.ppt = 0

Compute the 'y1' coordinates.

◆ prune_event_name

dict fedsd.prune_event_name

◆ py

fedsd.py = 0

◆ rti_csv_file

fedsd.rti_csv_file

◆ rti_df

RTI trace processing, if any.

◆ scale

int fedsd.scale = 1

◆ self_id

fedsd.self_id = trace_df.at[index,'self_id']

◆ spacing

int fedsd.spacing = 200

◆ str

fedsd.str

◆ svg_height

int fedsd.svg_height = padding + trace_df.iloc[-1]['y1']

◆ svg_width

int fedsd.svg_width = padding * 2 + (len(actors) - 1) * spacing + padding * 2 + 200

Write to svg file.

◆ title

dict fedsd.title = actors_names[key]

◆ trace_df

fedsd.trace_df = pd.DataFrame()

◆ type

fedsd.type

◆ x_coor

dict fedsd.x_coor = {}