qns.simulator package
Submodules
qns.simulator.event module
- class qns.simulator.event.Event(t: Time | None = None, name: str | None = None, by: Any | None = None)[source]
Bases:
object
Basic event class in simulator
- property is_canceled: bool
Returns: whether this event has been canceled
- qns.simulator.event.func_to_event(t: Time, fn, name: str | None = None, by: Any | None = None, *args, **kwargs)[source]
Convert a function to an event, the function fn will be called at t. It is a simple method to wrap a function to an event.
- Parameters:
t (Time) – the function will be called at t
fn (Callable) – the function
by – the entity or application that will causes this event
*args – the function’s parameters
**kwargs – the function’s parameters
qns.simulator.pool module
qns.simulator.pool module
qns.simulator.simulator module
- class qns.simulator.simulator.Simulator(start_second: float = 0.0, end_second: float = 60.0, accuracy: int = 1000000)[source]
Bases:
object
The discrete-event driven simulator core
- add_event(event: Event) None [source]
Add an
event
into simulator event pool. :param event: the inserting event
qns.simulator.ts module
qns.simulator.ts module
Module contents
- class qns.simulator.Event(t: Time | None = None, name: str | None = None, by: Any | None = None)[source]
Bases:
object
Basic event class in simulator
- property is_canceled: bool
Returns: whether this event has been canceled
- class qns.simulator.Simulator(start_second: float = 0.0, end_second: float = 60.0, accuracy: int = 1000000)[source]
Bases:
object
The discrete-event driven simulator core
- add_event(event: Event) None [source]
Add an
event
into simulator event pool. :param event: the inserting event
- class qns.simulator.Time(time_slot: int = 0, sec: float = 0.0, accuracy: int = 1000000)[source]
Bases:
object
- property sec: float
Returns: the timestamp in second
- qns.simulator.func_to_event(t: Time, fn, name: str | None = None, by: Any | None = None, *args, **kwargs)[source]
Convert a function to an event, the function fn will be called at t. It is a simple method to wrap a function to an event.
- Parameters:
t (Time) – the function will be called at t
fn (Callable) – the function
by – the entity or application that will causes this event
*args – the function’s parameters
**kwargs – the function’s parameters