Skip to content

Commit

Permalink
change: use meter measurements from dset instead of gisce in datamart…
Browse files Browse the repository at this point in the history
…s (et/somenergia-jardiner!84)

Closes #102

Merge branch '102-canviar-font-de-dades-per-comptadors-de-gisce-a-dset' into 'main'
  • Loading branch information
polmonso committed Jan 29, 2024
2 parents d28697e + 9ce136e commit 041d86b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ select
dset.irradiation as dset_irradiation_wh,
dset.inverter_exported_energy as dset_inverter_energy_kwh,
dset.meter_exported_energy as dset_meter_instant_exported_energy_kwh,
NULL::integer as dset_meter_exported_energy_kwh,
NULL::integer as dset_meter_imported_energy_kwh,
dset.meter_exported_energy as dset_meter_exported_energy_kwh,
NULl::integer as dset_meter_imported_energy_kwh,
forecast.forecastdate as forecast_date,
forecast.energy_kwh as forecast_energy_kwh,
sr.tilted_irradiation_wh_m2 as satellite_irradiation_wh_m2,
Expand All @@ -37,7 +37,7 @@ left join {{ ref('int_dset_metrics_wide_hourly') }} dset using(start_hour, plant
left join {{ ref('int_energy_forecasts__best_from_plantmonitordb') }} forecast using(start_hour, plant_uuid)
left join {{ ref('int_satellite_readings__hourly') }} sr using(start_hour, plant_uuid)
left join {{ ref('raw_plantlake_omie_historical_price__with_row_number_per_date') }} omie using(start_hour)
{#- temporarely use plantmonitors' meterregistry until dset provides it #}
{#- temporarely use plantmonitors' meterregistry until dset is reliable #}
left join {{ref('int_erp_meter_registry__hourly')}} as meter_registry using(start_hour, plant_uuid)
left join {{ ref('int_plantmonitordb_solarevent__generous') }} as solar_events
on solar_events.plant_uuid = plant_metadata.plant_uuid and solar_events.day = spine.start_hour::date
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ select
dset_inverter_energy_kwh as energia_instantania_inversor_kwh,
dset_meter_instant_exported_energy_kwh as energia_exportada_instantania_comptador_kwh,
1 - {{dbt_utils.safe_divide('dset_inverter_energy_kwh','dset_meter_instant_exported_energy_kwh')}} as energia_perduda_inversor_a_comptador,
--dset_meter_exported_energy_kwh as energia_exportada_comptador_kwh, -- plantmonitor la té, però dset ens la donarà
erp_meter_exported_energy_kwh as energia_exportada_comptador_kwh,
--dset_meter_imported_energy_kwh as energia_importada_comptador_kwh, -- idem
erp_meter_imported_energy_kwh as energia_importada_comptador_kwh,
dset_meter_exported_energy_kwh as energia_exportada_comptador_kwh,
erp_meter_exported_energy_kwh as erp_energia_exportada_comptador_kwh,
dset_meter_imported_energy_kwh as energia_importada_comptador_kwh,
erp_meter_imported_energy_kwh as erp_energia_importada_comptador_kwh,
date_trunc('day',forecast_date,'Europe/Madrid')::date as data_prediccio,
forecast_energy_kwh as energia_predita_meteologica_kwh,
satellite_energy_output_kwh as energia_esperada_solargis_kwh,
(satellite_energy_output_kwh - erp_meter_exported_energy_kwh) as energia_perduda_kwh,
(satellite_energy_output_kwh - dset_meter_exported_energy_kwh) as energia_perduda_kwh,
omie_price_eur_mwh as preu_omie_eur_mwh,
dset_irradiation_wh as irradiation_wh_m2,
satellite_irradiation_wh_m2 as irradiacio_satellit_wh_m2,
Expand All @@ -29,8 +29,8 @@ select
(satellite_irradiation_wh_m2 > 5)::integer as hora_total,
{# hd/ht only makes sense in daily and up#}
{#(pr_hourly > 0.7)/NULLIF(satellite_irradiation_wh_m2 > 5,0) as disponibilitat,#}
(erp_meter_exported_energy_kwh - forecast_energy_kwh) as energia_desviada_omie_kwh,
1 - forecast_energy_kwh/NULLIF(erp_meter_exported_energy_kwh,0) as energia_desviada_percent,
(dset_meter_exported_energy_kwh - forecast_energy_kwh) as energia_desviada_omie_kwh,
1 - forecast_energy_kwh/NULLIF(dset_meter_exported_energy_kwh,0) as energia_desviada_percent,
is_daylight_generous as is_daylight
{# HMCIL #}
{# billed_energy as energia_liquidada,
Expand Down

0 comments on commit 041d86b

Please sign in to comment.