61 lines
2.7 KiB
Python
61 lines
2.7 KiB
Python
"""
|
||
Configuration system for LoRa route simulation.
|
||
|
||
All parameters must be defined here - no hardcoded values allowed.
|
||
"""
|
||
|
||
# =============================================================================
|
||
# Network Topology
|
||
# =============================================================================
|
||
NODE_COUNT = 12 # Number of nodes in the network
|
||
AREA_SIZE = 800 # Deployment area size (meters)
|
||
SINK_NODE_ID = 0 # Sink node ID (root of the routing tree)
|
||
|
||
# =============================================================================
|
||
# Timing Parameters
|
||
# =============================================================================
|
||
HELLO_PERIOD = 8.0 # HELLO packet broadcast period (seconds)
|
||
DATA_PERIOD = 30.0 # Data packet generation period (seconds)
|
||
SIM_TIME = 1000.0 # Total simulation time (seconds)
|
||
|
||
# =============================================================================
|
||
# Radio Parameters
|
||
# =============================================================================
|
||
TX_POWER = 14 # Transmit power (dBm)
|
||
RSSI_THRESHOLD = -105 # Reception sensitivity threshold (dBm)
|
||
NOISE_SIGMA = 3 # Gaussian noise standard deviation (dB)
|
||
PATH_LOSS_EXPONENT = 2.7 # Path loss exponent (n)
|
||
|
||
# =============================================================================
|
||
# MAC Layer Parameters
|
||
# =============================================================================
|
||
ACK_TIMEOUT_FACTOR = 2.5 # ACK timeout = airtime × this factor
|
||
MAX_RETRY = 3 # Maximum transmission retries
|
||
BACKOFF_MIN = 0.0 # Minimum backoff time (seconds)
|
||
BACKOFF_MAX = 2.0 # Maximum backoff time (seconds)
|
||
|
||
# =============================================================================
|
||
# LoRa Physical Parameters
|
||
# =============================================================================
|
||
SF = 9 # Spreading Factor (7-12)
|
||
BW = 125000 # Bandwidth (Hz)
|
||
CR = 5 # Coding Rate (5-8, represents 4/5 to 4/8)
|
||
PREAMBLE = 8 # Preamble length (symbols)
|
||
|
||
# =============================================================================
|
||
# Routing Parameters
|
||
# =============================================================================
|
||
LINK_PENALTY_SCALE = 8.0 # Scale factor for link penalty calculation
|
||
ROUTE_UPDATE_THRESHOLD = 1.0 # Cost threshold for route update
|
||
|
||
# =============================================================================
|
||
# Logging
|
||
# =============================================================================
|
||
LOG_LEVEL = "INFO" # DEBUG, INFO, WARNING, ERROR
|
||
LOG_FORMAT = "[{time:.1f}][NODE{nid:>3}][{event}] {message}"
|
||
|
||
# =============================================================================
|
||
# Experiment Settings
|
||
# =============================================================================
|
||
RANDOM_SEED = 42 # Default random seed for reproducibility
|