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