Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def output_report(components, core_summary):
print(f"Core {core_id}: {core_stat}")


def write_solution_csv(tasks, components, filename='solution.csv'): # noqa: E302(tasks, components, filename='solution.csv'):(tasks, components, filename='solution.csv'):
def write_solution_csv(tasks, components, filename='analysis_solution.csv'):
# CSV with task- and component-level results
rows = []
for cid, comp in components.items():
Expand Down
3 changes: 2 additions & 1 deletion src/common/csvreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ def _get_csv_path(csv:str) -> str:

def read_csv() -> tuple[list[Core], list[Component], list[Task]]:
if len(sys.argv) != 4:
print("Usage: python analysis.py <architecture.csv> <budget.csv> <tasks.csv>")
script_name = os.path.basename(sys.argv[0])
print(f"Usage: python {script_name} <architecture.csv> <budget.csv> <tasks.csv>")
sys.exit(1)

architecture_file = sys.argv[1]
Expand Down
30 changes: 3 additions & 27 deletions src/simulator.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import random as rand
import numpy as np

from common.csvreader import read_cores
from common.csvreader import read_budgets
from common.csvreader import read_tasks
from common.csvreader import read_csv
from common.component import Component
from common.scheduler import Scheduler
from common.core import Core
Expand Down Expand Up @@ -368,34 +366,12 @@ def _get_hyperperiod(self):
return system_hyperperiod

def main():
# Base path for test case files
base_path = 'data/testcases/10-unschedulable-test-case'

# Read architectures
architecture_path = f'{base_path}/architecture.csv'
cores = read_cores(architecture_path)
print("Architectures:")
for core in cores:
print(core)

# Read tasks
tasks_path = f'{base_path}/tasks.csv'
tasks = read_tasks(tasks_path)
print("\nTasks:")
for task in tasks:
print(task)

# Read components
budgets_path = f'{base_path}/budgets.csv'
components = read_budgets(budgets_path)
print("\nBudgets:")
for component in components:
print(component)
cores, components, tasks = read_csv()

simulator = Simulator(cores, components, tasks)
simulator.run()

simulator.generate_output_file("output.csv")
simulator.generate_output_file("simulation_solution.csv")

if __name__ == "__main__":
main()
Loading