forecasting.port_forecaster module¶
Port PV production and boat availability forecasting for a single day.
- class forecasting.port_forecaster.EnergyForecast(timestamp: datetime, power_active_production_kw_by_source: Dict[str, float], power_active_production_kw: float, boat_required_energy_kwh: Dict[str, float], boat_available: Dict[str, int])[source]¶
Bases:
objectForecast for one timestep.
- timestamp¶
Forecast time.
- Type:
datetime.datetime
- power_active_production_kw_by_source¶
PV power (kW) per source name; port total is separate.
- Type:
Dict[str, float]
- power_active_production_kw¶
Total port PV power (kW).
- Type:
float
- boat_required_energy_kwh¶
Energy needed (kWh) until next departure, per boat.
- Type:
Dict[str, float]
- boat_available¶
Per-boat charging availability: 1 = available, 0 = not available.
- Type:
Dict[str, int]
- boat_available: Dict[str, int]¶
- boat_required_energy_kwh: Dict[str, float]¶
- power_active_production_kw: float¶
- power_active_production_kw_by_source: Dict[str, float]¶
- timestamp: datetime¶
- class forecasting.port_forecaster.PortForecaster(port: Port, db_manager: DatabaseManager, timestep_seconds: int = 900, trip_schedule: tuple = ((9, 0), (14, 1)))[source]¶
Bases:
objectGenerates daily PV and boat-availability forecasts for a port.
- generate_daily_forecast(forecast_date: datetime, trip_assignments: Dict[str, List[Trip]]) List[EnergyForecast][source]¶
Build one EnergyForecast per timestep for the given date.
Uses weather from DB (forecast table), PV models, and trip_assignments to produce power_active_production (per source and port total), boat_required_energy, and boat_available.
- print_forecast_summary(forecasts: List[EnergyForecast]) None[source]¶
Print a one-line summary: total PV production (kWh) and peak power (kW) with time.
- save_forecasts_to_db(forecasts: List[EnergyForecast]) None[source]¶
Write forecasts to the forecast table: power_active_production (per PV source and port), boat_required_energy, boat_available.