26 lines
810 B
Python
26 lines
810 B
Python
from app.models.coverage import LinkRx, LinkTx
|
|
from app.models.link import LinkBudgetRequest
|
|
from app.services import link as link_service
|
|
|
|
|
|
def test_link_budget_includes_vegetation_loss(monkeypatch) -> None:
|
|
monkeypatch.setattr(link_service, "vegetation_loss_along", lambda *args, **kwargs: 5.0)
|
|
request = LinkBudgetRequest(
|
|
tx=LinkTx(lat=60.17, lon=24.94, height_agl=30, power_dbm=37, gain_dbi=8),
|
|
rx=LinkRx(
|
|
lat=60.25,
|
|
lon=25.10,
|
|
height_agl=2,
|
|
gain_dbi=2,
|
|
sensitivity_dbm=-110,
|
|
),
|
|
frequency_mhz=433,
|
|
model="manual",
|
|
include_vegetation=True,
|
|
)
|
|
|
|
result = link_service.link_budget(request)
|
|
|
|
assert result.vegetation_db == 5.0
|
|
assert result.total_loss_db == result.fspl_db + 5.0
|