Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pacific power meters #302

Merged
merged 5 commits into from
Feb 25, 2024
Merged

Add pacific power meters #302

merged 5 commits into from
Feb 25, 2024

Conversation

s-egge
Copy link
Member

@s-egge s-egge commented Feb 5, 2024

No description provided.

@s-egge s-egge marked this pull request as draft February 5, 2024 21:23
@s-egge
Copy link
Member Author

s-egge commented Feb 5, 2024

Upload

The data upload for Pacific Power mimics the way that the Solar Meters are uploaded, and is differentiated by the meter_type sent in the upload request.

Download

The pacific_power_meter_id is first requested from the meters table by using the meter_id sent from the front-end, and then it queries the pacific_power_data table with the pacific_power_meter_id.

We currently have a meter_id in the pacific_power_data table, but with the data being grabbed this way we can remove it in order to prevent the need for retroactively adding meter_ids to the pacific_power_data table in the future as we add more meters to the front-end, since the table currently stores all data for meters from the Pacific Power website that have daily data, so there are rows with null meter_ids.

Download Issue

image

There is still an issue with the data on the front-end. It is being sent correctly from the back-end, but is incorrect after chart.module.js

await chartModifier.postGetData(chartData, reqPayload, this, store)

calls postGetData:

async postGetData (chartData, payload, store, module) {

Testing

To test, change this line to hidden: 0 in order to see all of the newly added buildings:

@s-egge
Copy link
Member Author

s-egge commented Feb 17, 2024

Download

The bug above was because the accumulated_real chart modifier expected accumulated energy data every 15 minutes, but Pacific Power meters provide daily non-accumulated energy data. They behave similarly to the Solar Array meters, which use the energy_change chart modifier. In order to avoid duplicating the logic, I added a check in the chart.module.js file that will check if the first meter in the meterGroup is a Pacific Power meter, and if so it will send the data through the energy_change chart modifier without actually changing the point type in the chart data, which would cause issues elsewhere were accumulated_real is expected.

The way that it's checked to be a Pacific Power meter may need work, as I wasn't able to check the meter itself but only the first meter in the meterGroup, but this is working as intended for the moment.

image
image

The first image is with actual data from the database, there are days missing due to the webscraper not being automated to run daily right now, so the second picture has 30 days of daily dummy data to demonstrate the chart modifier is working as intended.

Upload

To grab Pacific Power meter data, the download logic will first query the meter table in order to retrieve the Pacific Power meter ID, and then use that to pull the data from the pacific_power_data table. The meter_id is now no longer needed in the PP data table, so I removed the check in both the webscraper and in the upload, as well as removing it from the table. This will prevent us from needing to manually update the table with meter_ids as we add more buildings to the front-end.

@solderq35
Copy link
Contributor

Added offset to make time of day consistent with other daily meters

image

Rest of PR looks fine to me. I'm not sure why accumulated_real shows non-existent data as "zero" on the frontend (check Memorial Union), while energy_change just skips over the missing data point. But for now I don't think it's a big deal.

@solderq35
Copy link
Contributor

The way that it's checked to be a Pacific Power meter may need work, as I wasn't able to check the meter itself but only the first meter in the meterGroup, but this is working as intended for the moment.

Should be fine, I think it's safe to assume that all Pacific Power meters will not mix with other types of meters in a meter group.

@solderq35 solderq35 marked this pull request as ready for review February 21, 2024 19:38
@solderq35
Copy link
Contributor

See OSU-Sustainability-Office/automated-jobs#21 (comment)

I think the PR as it is now is good to go, but it might be a good idea to look into a better way of handling missing data (pacific power site doesn't show yesterday's data yet) in the future.

@s-egge s-egge merged commit ddfe96d into master Feb 25, 2024
3 checks passed
@s-egge s-egge deleted the add-pacific-power-meters branch July 1, 2024 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants