"""Author: Changbeom Choi (@cbchoi)Copyright (c) 2014-2020 Handong Global UniversityCopyright (c) 2021-2024 Hanbat National UniversityLicense: MIT. The full license text is available at:https://github.com/eventsim/pyjevsim/blob/main/LICENSEA simple GBP example using Behavior Model and Structural Model. PEG(process event generator) model generates events periodically.Buffer model stores and forwards Events generated by the PEG.MsgRecv handles the event messages generated by the PEG.Usage:From a terminal in the parent directory, run the following command. pytest -s ./tests/test_hierachical.py """frompyjevsim.definitionimport*frompyjevsim.system_executorimportSysExecutorfrom.model_msg_recvimportMsgRecvfrom.model_pegimportPEGfrom.model_stmimportSTM
[docs]defexecute_simulation():# System Simulator Initializationse=SysExecutor(1,ex_mode=ExecutionType.V_TIME,snapshot_manager=None)se.insert_input_port("start")#set Structural Modelgen=STM("Gen")se.register_entity(gen,inst_t=3)#set Behavior Modelpeg=PEG("GEN")se.register_entity(peg)#set Model Relationse.coupling_relation(se,"start",gen,"start")se.coupling_relation(se,"start",peg,"start")se.insert_external_event("start",None)for_inrange(5):se.simulate(1)