Behavior Executor

Author: Changbeom Choi (@cbchoi) Copyright (c) 2014-2020 Handong Global University Copyright (c) 2021-2024 Hanbat National University License: MIT. The full license text is available at: https://github.com/eventsim/pyjevsim/blob/main/LICENSE

This module contains a BehaviorExecutor, an object for executing a BehaviorModel.

class pyjevsim.behavior_executor.BehaviorExecutor(itime=inf, dtime=inf, ename='default', behavior_model=None, parent=None)[source]

Bases: Executor

A decorated form of the BehaviorModel, ready to be executed by the SysExecutor. Manages the simulation time of the BehaviorModel and the information in the SysExecutor.

Parameters:
  • itime (int or Infinite) – Time of instance creation

  • dtime (int or Infinite) – Time of instance destruction

  • ename (str) – SysExecutor name

  • behavior_model (ModelType.BEHAVIORAL) – Behavior Model

ext_trans(port, msg)[source]

Handles external transition based on port and message

get_core_model()[source]

Returns the core behavior model

get_create_time()[source]

Returns the instance creation time

get_cur_state()[source]

Returns the current state of the executor

get_destruct_time()[source]

Returns the destruction time

get_engine_name()[source]

Returns the name of the engine

get_name()[source]

Returns the name of the behavior model

get_obj_id()[source]

Returns the object ID of the behavior model

get_req_time()[source]

Returns the request time and resets the cancel flag if necessary

init_state(state)[source]

Initializes the state of the executor

int_trans()[source]

Handles internal transition

output(msg_deliver)[source]

Executes the output function of the behavior model

set_engine_name(engine_name)[source]

Sets the name of the engine

set_global_time(gtime)[source]

Sets the global time for the executor and behavior model

set_req_time(global_time)[source]

Sets the request time based on the global time and time advance

time_advance()[source]

Returns the time advance value for the current state

Structural Executor

Author: Changbeom Choi (@cbchoi) Copyright (c) 2014-2020 Handong Global University Copyright (c) 2021-2024 Hanbat National University License: MIT. The full license text is available at: https://github.com/eventsim/pyjevsim/blob/main/LICENSE

This module contains a StructuralExecutor, an object for executing a StructuralModel.

class pyjevsim.structural_executor.StructuralExecutor(global_time, itime, dtime, ename, model, parent, factory)[source]

Bases: Executor

ext_trans(port, msg)[source]
get_core_model()[source]
get_create_time()[source]
get_destruct_time()[source]
get_name()[source]
get_obj_id()[source]
get_req_time()[source]
int_trans()[source]
output(msg_deliver)[source]
route_message(cr, msg)[source]
set_req_time(global_time)[source]
time_advance()[source]

Snapshot Executor

Author: Changbeom Choi (@cbchoi) Copyright (c) 2014-2020 Handong Global University Copyright (c) 2021-2024 Hanbat National University License: MIT. The full license text is available at: https://github.com/eventsim/pyjevsim/blob/main/LICENSE

This module contains an object SnapshotExecutor that decorates a BehaviorExecutor to snapshot a BehaviorModel.

class pyjevsim.snapshot_executor.SnapshotExecutor(behavior_executor, condition, parent)[source]

Bases: Executor

Set the model you want to snapshot to a SnapshotExecutor in a form that can be executed by a SystemExecutor.

ext_trans(port, msg)[source]

Handles the external transition.

Parameters:
  • port (str) – The port name

  • msg (Message) – The message

get_behavior_executor()[source]

Return BehaviorExecutor.

Returns:

The behavior executor / 동작 실행기

Return type:

BehaviorExecutor

get_core_model()[source]

Returns BehaviorModel of SnapshotExecutor.

Returns:

BehaviorModel

Return type:

CoreModel

get_create_time()[source]

Returns the creation time of SnapshotExecutor.

Returns:

Creation time

Return type:

float

get_cur_state()[source]

Returns the current state of SnapshotExecutor.

Returns:

Current state

Return type:

str

get_destruct_time()[source]

Returns the destruction time of SnapshotExecutor.

Returns:

Destruction time

Return type:

float

get_engine_name()[source]

Returns SysExecutor name of SnapshotExecutor.

Returns:

SysExecutor name

Return type:

str

get_name()[source]

Returns the name of SnapshotExecutor.

Returns:

Name

Return type:

str

get_obj_id()[source]

Return object ID of SnapshotExecutor.

Returns:

Object ID

Return type:

int

get_req_time()[source]

Returns the request time.

Returns:

Request time

Return type:

float

init_state(state)[source]

Initializes the state of SnapshotExecutor.

Parameters:

state (str) – The state to set / 설정할 상태

int_trans()[source]

Handles the internal transition.

model_dump()[source]

Dumps BehaviorModel

Returns:

The dumped BehaviorModel

Return type:

bytes

output(msg_deliver)[source]

Handles the output function.

Returns:

The output message

Return type:

Message

set_engine_name(engine_name)[source]

Sets SysExecutor name of SnapshotExecutor.

Parameters:

engine_name (str) – SysExecutor name

set_req_time(global_time)[source]

Sets the request time.

Parameters:

global_time (float) – Simulation time

snapshot(_prefix, _path='./snapshot')[source]

An abstract method that creates a method to take a snapshot. You can use the snapshot method in a conditional method. Use the model_dump method to get the model data in bytes. Save that data to the DB or save it to a file.

Parameters:

name (str) – The name of the snapshot

time_advance()[source]

Returns the time advance value.

Returns:

Time advance value

Return type:

float