2024-11-08 10:50:18 +03:00
|
|
|
import pyqtgraph as pg
|
|
|
|
|
|
|
|
|
|
from src.utils import read_json, DiagramParser
|
|
|
|
|
from src.uml import Request, UMLCreator
|
|
|
|
|
from src.OptAlgorithm import OptAlgorithm
|
|
|
|
|
from src.gui import PlotWindow
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_ideal_timings(opt: OptAlgorithm) -> list[float]:
|
|
|
|
|
data = opt.Ts
|
|
|
|
|
ideal_time = [data['tclose'], data['tgrow'], opt.getMarkOpen()]
|
|
|
|
|
return ideal_time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
|
operator_params = read_json("params/operator_params.json")
|
|
|
|
|
system_params = read_json("params/system_params.json")
|
|
|
|
|
opt_algorithm = OptAlgorithm(operator_config=operator_params, system_config=system_params)
|
|
|
|
|
ideal_times = get_ideal_timings(opt_algorithm)
|
|
|
|
|
|
|
|
|
|
parser = DiagramParser()
|
|
|
|
|
parser.setData("trace_samples/2024_11_01-09_39_17B00.csv")
|
|
|
|
|
bool_dict = parser.getBoolDict()
|
|
|
|
|
float_dict = parser.getFloatDict()
|
|
|
|
|
|
|
|
|
|
request_generator = Request(server_url='http://www.plantuml.com/plantuml/svg/')
|
|
|
|
|
uml_creator = UMLCreator(system_config=system_params,
|
|
|
|
|
request_generator=request_generator,
|
|
|
|
|
ideal_time=ideal_times,
|
|
|
|
|
bool_dict=bool_dict,
|
|
|
|
|
float_dict=float_dict)
|
|
|
|
|
uml_creator.update_uml()
|
|
|
|
|
|
|
|
|
|
app = PlotWindow(operator_config=operator_params,
|
|
|
|
|
system_config=system_params,
|
|
|
|
|
opt=opt_algorithm,
|
|
|
|
|
bool_dict=bool_dict,
|
|
|
|
|
float_dict=float_dict)
|
|
|
|
|
|
|
|
|
|
app.updatePlots()
|
|
|
|
|
pg.exec()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
main()
|