Pergi ke konten utama

MyEMS Desain basis data

Daftar isi​

Arsitektur basis data​

MyEMS memakai 13 basis data MySQL. Skrip pemasangan ada di database/install. Setiap skrip membuat satu basis data dengan utf8mb4 / utf8mb4_unicode_ci. Tabel memakai kunci primer BIGINT, kolom DATETIME dalam UTC, dan DECIMAL(21, 6) untuk nilai ukur dan agregat.

Basis dataTabelKegunaan
myems_system_db166Data induk: ruang, meter, titik, peralatan, pembangkit, tarif, dan kaitan
myems_historical_db12Nilai mentah titik serta berkas unggahan biaya, meter luring, perbaikan, dan rencana
myems_energy_db39Agregasi energi per jam
myems_billing_db39Agregasi biaya per jam, kumpulan tabel sama dengan energi
myems_carbon_db39Agregasi karbon per jam, kumpulan tabel sama dengan energi
myems_energy_baseline_db39Garis dasar per jam, kumpulan tabel sama dengan energi
myems_energy_model_db39Tahun khas 8760 jam, kumpulan objek sama dengan energi
myems_energy_plan_db39Rencana per jam, kumpulan tabel sama dengan energi
myems_energy_prediction_db39Prakiraan per jam, kumpulan tabel sama dengan energi
myems_fdd_db9Aturan gangguan serta pesan surel, SMS, web, dan WeChat
myems_user_db10Pengguna, hak, sesi, kunci API, dan jurnal audit
myems_reporting_db4Definisi laporan, templat, berkas hasil, dan surel laporan
myems_production_db8Produk, tim, sif, dan jumlah per jam

Gagasan desain​

Basis dataTanggung jawabPenulis
myems_system_dbKonfigurasi dan topologiAntarmuka web lewat myems-api
myems_historical_dbDeret waktu titik dan buku kerja yang diunggahAkuisisi data dan impor berkas
myems_energy_dbEnergi per jamNormalisasi dan agregasi
myems_billing_dbBiaya per jamPenagihan, dari nilai energi dan tarif
myems_carbon_dbEmisi per jamPerhitungan karbon, dari nilai energi dan faktor emisi
myems_energy_baseline_dbGaris dasar per jamLayanan garis dasar
myems_energy_model_dbSatu nilai untuk setiap jam tahun nonkabisatLayanan pemodelan
myems_energy_plan_dbRencana per jamLayanan perencanaan
myems_energy_prediction_dbPrakiraan per jamLayanan prakiraan
myems_fdd_dbAturan dan pemberitahuan keluarLayanan FDD
myems_user_dbIdentitas dan hakAPI
myems_reporting_dbLaporan terjadwalLayanan laporan
myems_production_dbJumlah keluaran untuk intensitas energiImpor dan agregasi produksi

Objek konfigurasi saling merujuk lewat id. Tabel lintas basis data menyimpan id yang sama dan tidak menyatakan kunci asing ke basis data lain.

Konvensi penamaan​

ObjekAturanContoh
Basis dataawalan myems_, akhiran _dbmyems_system_db
Tabelawalan tbl_tbl_meters
Tabel kaitantbl_{owner}_{child}tbl_spaces_meters
Tabel fakta per jam{object}_{measure}_hourlytbl_meter_hourly
Tabel fakta modelkumpulan objek yang sama, akhiran _8760tbl_meter_8760
Kunci primeridid BIGINT NOT NULL AUTO_INCREMENT
Kunci bisnisuuid CHAR(36) pada objek konfigurasimeter, ruang, peralatan
Waktu*_datetime_utc atau utc_date_timestart_datetime_utc
Indeks{table}_index_{n}tbl_meters_index_1

Uraian terperinci​

1. Basis data sistem (myems_system_db)​

myems_system_db menyimpan data induk. Ada 166 tabel. Objek konfigurasi biasanya memuat id, name, uuid, dan description. Tabel kaitan hanya menyimpan dua kunci asing dan id. Tabel komponen pembangkit menyimpan satu baris per perangkat fisik dan tabel *_points pendamping.

Klasifikasi energi​

TabelKolom utamaUraian
tbl_energy_categoriesname, uuid, unit_of_measure, kgce, kgco2eKategori energi dan faktor konversi bawaan
tbl_energy_itemsname, uuid, energy_category_idButir di bawah kategori

kgce dan kgco2e adalah faktor bawaan pada kategori. Harga dan faktor emisi yang berbatas waktu ada di tabel tarif dan faktor emisi.

Meter dan titik​

TabelKolom utamaUraian
tbl_metersenergy_category_id, energy_item_id, cost_center_id, master_meter_id, is_counted, is_enabled, hourly_low_limit, hourly_high_limitMeter daring
tbl_offline_metersbatas dan kolom kategori yang sama, tanpa master_meter_idMeter yang diisi manual
tbl_virtual_metersequation (LONGTEXT), energy_category_id, energy_item_id, is_counted, is_enabledMeter yang dihitung dari persamaan
tbl_variablesname, virtual_meter_id, meter_type, meter_idPengikatan variabel dalam persamaan meter virtual
tbl_pointsdata_source_id, object_type, units, high_limit, low_limit, higher_limit, lower_limit, ratio, offset_constant, is_trend, is_virtual, address, faults, definitionsTitik data. address, faults, dan definitions adalah teks JSON. Tidak ada uuid
tbl_points_set_valuespoint_id, utc_date_time, set_value, is_setNilai setel titik
tbl_meters_pointsmeter_id, point_idIkatan meter ke titik
tbl_meters_commandsmeter_id, command_idIkatan meter ke perintah

higher_limit, lower_limit, dan is_in_alarm pada tbl_points dipakai layanan FDD. ratio dan offset_constant menskalakan nilai mentah.

Akuisisi​

TabelKolom utamaUraian
tbl_gatewaysname, uuid, token, last_seen_datetime_utcGerbang akuisisi
tbl_data_sourcesgateway_id, protocol, connection (LONGTEXT), process_id, last_seen_datetime_utcSambungan di bawah gerbang. connection adalah JSON
tbl_protocolsname, codeKatalog protokol
tbl_sensorsname, uuidSensor
tbl_sensors_pointssensor_id, point_idIkatan sensor ke titik
tbl_iot_sim_cardsiccid, imsi, operator, status, used_traffic, total_trafficInventaris kartu SIM. Tabel ini tidak punya uuid

Ruang dan pusat biaya​

TabelKolom utamaUraian
tbl_spacesparent_space_id, area, number_of_occupants, timezone_id, contact_id, cost_center_id, latitude, longitude, is_input_counted, is_output_countedPohon ruang
tbl_cost_centersname, uuid, external_idPusat biaya
tbl_contactsname, uuid, email, phoneKontak
tbl_timezonesname, utc_offsetZona waktu
tbl_working_calendarsnameKalender kerja
tbl_working_calendars_non_working_daysworking_calendar_id, date_local, descriptionHari nonkerja

Ruang mengaitkan objek anak lewat tabel kaitan, bukan lewat kolom space_id pada objek itu:

tbl_spaces_meters, tbl_spaces_offline_meters, tbl_spaces_virtual_meters, tbl_spaces_points, tbl_spaces_sensors, tbl_spaces_equipments, tbl_spaces_combined_equipments, tbl_spaces_commands, tbl_spaces_shopfloors, tbl_spaces_stores, tbl_spaces_tenants, tbl_spaces_charging_stations, tbl_spaces_microgrids, tbl_spaces_photovoltaic_power_stations, tbl_spaces_energy_storage_power_stations, tbl_spaces_wind_farms, tbl_spaces_distribution_systems, tbl_spaces_energy_flow_diagrams, tbl_spaces_working_calendars.

Peralatan​

TabelKolom utamaUraian
tbl_equipmentsis_input_counted, is_output_counted, is_enabled, cost_center_id, efficiency_indicator, svg_id, camera_urlPeralatan
tbl_combined_equipmentskolom yang sama dengan tbl_equipmentsPeralatan gabungan
tbl_combined_equipments_equipmentscombined_equipment_id, equipment_idAnggota peralatan gabungan

Kedua jenis mengikat meter, meter luring, meter virtual, parameter, sumber data, dan perintah:

  • tbl_equipments_meters, tbl_equipments_offline_meters, tbl_equipments_virtual_meters, tbl_equipments_parameters, tbl_equipments_data_sources, tbl_equipments_commands
  • tbl_combined_equipments_meters, tbl_combined_equipments_offline_meters, tbl_combined_equipments_virtual_meters, tbl_combined_equipments_parameters, tbl_combined_equipments_data_sources, tbl_combined_equipments_commands

Lantai pabrik, toko, dan penyewa​

TabelKolom utamaUraian
tbl_shopfloorsarea, is_input_counted, is_enabled, contact_id, cost_center_idLantai pabrik
tbl_storesaddress, latitude, longitude, area, store_type_id, is_input_counted, is_enabled, contact_id, cost_center_idToko
tbl_store_typesname, uuid, simplified_codeJenis toko
tbl_tenantsbuildings, floors, rooms, area, tenant_type_id, is_input_counted, is_enabled, is_key_tenant, lease_number, lease_start_datetime_utc, lease_end_datetime_utc, is_in_lease, contact_id, cost_center_idPenyewa
tbl_tenant_typesname, uuid, simplified_codeJenis penyewa

Ketiga objek ini punya tabel kaitan untuk meter, meter luring, meter virtual, titik, sensor, perintah, dan kalender kerja. Lantai pabrik juga punya tbl_shopfloors_equipments.

Pembangkit fotovoltaik​

tbl_photovoltaic_power_stations menyimpan station_code, address, latitude, longitude, latitude_point_id, longitude_point_id, rated_capacity, rated_power, contact_id, cost_center_id, lima slot SVG (svg_id sampai svg5_id), is_cost_data_displayed, phase_of_lifecycle, dan commissioning_date.

Tabel anak:

TabelPeran
tbl_photovoltaic_power_stations_invertors / _invertors_pointsInverter dan titiknya
tbl_photovoltaic_power_stations_grids / _grids_pointsSambungan jaringan dan titiknya
tbl_photovoltaic_power_stations_loads / _loads_pointsBeban dan titiknya
tbl_photovoltaic_power_stations_data_sourcesSumber data
tbl_photovoltaic_power_stations_usersPengguna yang diikat

Penyimpanan energi​

tbl_energy_storage_containers menyimpan rated_capacity, rated_power, contact_id, dan cost_center_id. Tabel komponen dan tabel *_points yang disebutkan:

Tabel komponenTabel titik
tbl_energy_storage_containers_batteries (soc_point_id, power_point_id, charge_meter_id, discharge_meter_id)—
tbl_energy_storage_containers_power_conversion_systemstbl_energy_storage_containers_pcses_points
—tbl_energy_storage_containers_bmses_points (bms_id, point_id; tidak ada tabel induk BMS)
tbl_energy_storage_containers_dcdcstbl_energy_storage_containers_dcdcs_points
tbl_energy_storage_containers_stsestbl_energy_storage_containers_stses_points
tbl_energy_storage_containers_gridstbl_energy_storage_containers_grids_points
tbl_energy_storage_containers_loadstbl_energy_storage_containers_loads_points
tbl_energy_storage_containers_hvacstbl_energy_storage_containers_hvacs_points
tbl_energy_storage_containers_firecontrolstbl_energy_storage_containers_firecontrols_points

Juga: tbl_energy_storage_containers_commands, tbl_energy_storage_containers_data_sources, tbl_energy_storage_containers_schedules.

tbl_energy_storage_power_stations memakai kolom tapak yang sama dengan pembangkit fotovoltaik (address, koordinat, kapasitas dan daya terukur, kontak, pusat biaya, lima SVG, daur hidup). Kontainer dikelompokkan di tbl_energy_storage_power_stations_containers, pengguna di tbl_energy_storage_power_stations_users.

Jaringan mikro​

tbl_microgrids menambah postal_code dan serial_number pada kolom tapak. Tabel anak:

KomponenTitik
tbl_microgrids_batteries—
—tbl_microgrids_bmses_points (bms_id, point_id; tidak ada tabel induk BMS)
tbl_microgrids_power_conversion_systemstbl_microgrids_pcses_points
tbl_microgrids_photovoltaicstbl_microgrids_pvs_points
tbl_microgrids_evchargerstbl_microgrids_evchargers_points
tbl_microgrids_generatorstbl_microgrids_generators_points
tbl_microgrids_gridstbl_microgrids_grids_points
tbl_microgrids_heatpumpstbl_microgrids_heatpumps_points
tbl_microgrids_loadstbl_microgrids_loads_points

Juga: tbl_microgrids_commands, tbl_microgrids_data_sources, tbl_microgrids_schedules, tbl_microgrids_sensors, tbl_microgrids_users.

Pembangkit lain dan integrator​

TabelKolom utamaUraian
tbl_charging_stationsalamat, koordinat, rated_capacity, rated_power, kontak, pusat biaya, lima SVG, daur hidupStasiun pengisian
tbl_wind_farmsalamat, koordinat, rated_power, kontak, pusat biaya, lima SVGLadang angin
tbl_virtual_power_plantscost_center_id, balancing_price_point_id, svg_idPembangkit virtual
tbl_virtual_power_plants_microgridsvirtual_power_plant_id, microgrid_idJaringan mikro dalam pembangkit virtual
tbl_power_integratorspower_point_id, result_point_id, is_enabledMengintegralkan daya menjadi energi
tbl_fuel_integratorsmodel, power_point_id, result_point_id, is_enabledIntegrator bahan bakar
tbl_heat_integratorshigh_temperature_point_id, low_temperature_point_id, flow_point_id, heat_capacity, liquid_density, coefficient, result_point_id, is_enabledIntegrator panas

Perintah dan kendali​

TabelKolom utamaUraian
tbl_commandstopic, payload (LONGTEXT), set_valueDefinisi perintah
tbl_control_modesname, uuid, is_activeMode kendali
tbl_control_modes_timescontrol_mode_id, start_time_of_day, end_time_of_day, power_value, power_point_id, power_equationSatu periode dalam mode kendali

Tarif dan faktor emisi​

TabelKolom utamaUraian
tbl_tariffsenergy_category_id, tariff_type, unit_of_price, valid_from_datetime_utc, valid_through_datetime_utcTarif. tariff_type adalah timeofuse
tbl_tariffs_timeofusestariff_id, start_time_of_day, end_time_of_day, peak_type, price DECIMAL(23, 8)Harga satu periode dalam sehari. peak_type adalah toppeak, onpeak, midpeak, offpeak, atau deep
tbl_cost_centers_tariffscost_center_id, tariff_idIkatan tarif
tbl_emission_factorsenergy_category_id, unit_of_factor, valid_from_datetime_utc, valid_through_datetime_utcFaktor emisi berbatas waktu
tbl_emission_factors_timeofusesemission_factor_id, start_time_of_day, end_time_of_day, factorFaktor satu periode dalam sehari
tbl_cost_centers_emission_factorscost_center_id, emission_factor_idIkatan faktor

Diagram, menu, berkas, dan perintah kerja​

TabelKolom utamaUraian
tbl_distribution_systemsname, uuid, svg_idSistem distribusi
tbl_distribution_circuitsdistribution_system_id, distribution_room, switchgear, peak_load, peak_current, customers, metersSirkuit
tbl_distribution_circuits_pointsdistribution_circuit_id, point_idTitik sirkuit
tbl_energy_flow_diagramsname, uuidDiagram aliran energi
tbl_energy_flow_diagrams_nodesenergy_flow_diagram_id, nameSimpul
tbl_energy_flow_diagrams_linksenergy_flow_diagram_id, source_node_id, target_node_id, meter_uuidTautan
tbl_svgsname, uuid, source_code (LONGTEXT)Grafik SVG
tbl_menusname, route, parent_menu_id, is_hiddenPohon menu. Tidak ada uuid
tbl_knowledge_filesfile_name, uuid, upload_datetime_utc, upload_user_uuid, file_object (LONGBLOB)Berkas basis pengetahuan
tbl_work_ordersnumber, category, title, priority, status, belong_to_object_type, belong_to_object_id, source_type, source_id, creator_user_id, assignee_user_id, stempel waktu rencana dan aktualPerintah kerja
tbl_work_order_logswork_order_id, user_id, action, from_status, to_status, comment, created_datetime_utcJurnal status
tbl_work_order_fileswork_order_id, file_name, file_path, file_size, uploaded_by_user_idJalur lampiran. Bita berkas disimpan di disk
tbl_versionsversion, release_dateVersi skema

2. Basis data historis (myems_historical_db)​

myems_historical_db menyimpan nilai mentah titik dan buku kerja yang diunggah. Ada 12 tabel.

Setiap keluarga nilai punya tabel riwayat dan tabel nilai terbaru. Baris riwayat memuat is_bad dan is_published. Baris terbaru hanya menyimpan point_id, utc_date_time, dan actual_value. Keduanya diindeks pada (point_id, utc_date_time) dan pada utc_date_time.

TabelTipe actual_valueUraian
tbl_analog_value, tbl_analog_value_latestDECIMAL(21, 6)Analog
tbl_energy_value, tbl_energy_value_latestDECIMAL(21, 6)Energi kumulatif
tbl_digital_value, tbl_digital_value_latestINTDigital
tbl_text_value, tbl_text_value_latestLONGTEXTTeks

Berkas unggahan memakai file_name, uuid, upload_datetime_utc, status (new, done, error), dan file_object (LONGBLOB):

TabelKegunaan
tbl_cost_filesBuku kerja biaya
tbl_offline_meter_filesBuku kerja meter luring
tbl_data_repair_filesBuku kerja perbaikan data
tbl_energy_plan_filesBuku kerja rencana energi

3. Basis data energi (myems_energy_db)​

myems_energy_db menyimpan energi aktual per jam. Ada 39 tabel, tanpa tabel harian, bulanan, atau tahunan. Laporan menjumlahkan jam di dalam kueri.

Setiap tabel punya id, id objek induk, start_datetime_utc, dan actual_value DECIMAL(21, 6). Tabel kategori juga punya energy_category_id. Tabel butir juga punya energy_item_id. Indeks gabungan adalah (object_id, [id kategori atau butir], start_datetime_utc).

KelompokTabel
Metertbl_meter_hourly, tbl_offline_meter_hourly, tbl_virtual_meter_hourly
Peralatantbl_equipment_input_category_hourly, tbl_equipment_input_item_hourly, tbl_equipment_output_category_hourly
Peralatan gabungantbl_combined_equipment_input_category_hourly, tbl_combined_equipment_input_item_hourly, tbl_combined_equipment_output_category_hourly
Ruangtbl_space_input_category_hourly, tbl_space_input_item_hourly, tbl_space_output_category_hourly
Lantai pabriktbl_shopfloor_input_category_hourly, tbl_shopfloor_input_item_hourly
Tokotbl_store_input_category_hourly, tbl_store_input_item_hourly
Penyewatbl_tenant_input_category_hourly, tbl_tenant_input_item_hourly
Kontainer penyimpanantbl_energy_storage_container_{charge,discharge,grid_buy,grid_sell,load}_hourly
Pembangkit penyimpanantbl_energy_storage_power_station_{charge,discharge,grid_buy,grid_sell,load}_hourly
Jaringan mikrotbl_microgrid_{charge,discharge,evcharger,grid_buy,grid_sell,load,photovoltaic}_hourly
Pembangkit fotovoltaiktbl_photovoltaic_power_station_{generation,grid_buy,grid_sell,load}_hourly

Tabel meter, meter luring, meter virtual, penyimpanan, jaringan mikro, dan fotovoltaik tidak punya kolom kategori energi. Kategori ditentukan objek induk.

4. Basis data penagihan (myems_billing_db)​

myems_billing_db punya 39 tabel per jam dan kolom yang sama dengan myems_energy_db. actual_value adalah biaya dalam mata uang tarif. Penagihan membaca energi per jam dan tarif yang diikat ke pusat biaya.

5. Basis data karbon (myems_carbon_db)​

myems_carbon_db punya 39 tabel per jam yang sama. actual_value adalah emisi. Perhitungan memakai energi per jam bersama tbl_energy_categories.kgco2e atau baris waktu pakai di tbl_emission_factors.

6. Basis data garis dasar energi (myems_energy_baseline_db)​

myems_energy_baseline_db punya 39 tabel per jam yang sama. actual_value adalah garis dasar jam itu.

7. Basis data model energi (myems_energy_model_db)​

myems_energy_model_db punya 39 kelompok objek yang sama. Nama tabel berakhiran _8760, bukan _hourly, dan kolom waktu adalah hour_of_year (INT), bukan start_datetime_utc. Contoh: tbl_meter_8760(meter_id, hour_of_year, actual_value).

8. Basis data rencana energi (myems_energy_plan_db)​

myems_energy_plan_db punya 39 tabel per jam yang sama dengan myems_energy_db. actual_value adalah jumlah rencana. Buku kerja rencana masuk lebih dulu ke myems_historical_db.tbl_energy_plan_files.

9. Basis data prakiraan energi (myems_energy_prediction_db)​

myems_energy_prediction_db punya 39 tabel per jam yang sama. actual_value adalah jumlah prakiraan.

10. Basis data FDD (myems_fdd_db)​

myems_fdd_db punya 9 tabel.

TabelKolom utamaUraian
tbl_rulesname, uuid, category, fdd_code, priority, channel, expression, message_template, is_enabled, last_run_datetime_utc, next_run_datetime_utc, is_run_immediatelyAturan gangguan. expression adalah JSON. message_template adalah teks biasa dengan substitusi $
tbl_email_servershost, port, requires_authentication, user_name, password, from_addrServer SMTP
tbl_email_messagesrule_id, recipient_email, subject, message, attachment_file_object, scheduled_datetime_utc, statusSurel keluar
tbl_text_messages_outboxrule_id, recipient_mobile, message, acknowledge_code, statusSMS keluar
tbl_text_messages_inboxsender_mobile, message, received_datetime_utc, statusSMS masuk
tbl_web_messagesrule_id, user_id, subject, category, priority, message, status, reply, belong_to_object_type, belong_to_object_idPesan web
tbl_wechat_configsapi_server, app_id, app_secret, access_token, expires_datetime_utcAplikasi WeChat
tbl_wechat_messages_outboxrule_id, recipient_openid, message_template_id, message_data, statusWeChat keluar
tbl_wechat_messages_inboxsender_openid, message, received_datetime_utc, statusWeChat masuk

tbl_rules.category adalah salah satu dari REALTIME, SYSTEM, SPACE, METER, TENANT, STORE, SHOPFLOOR, EQUIPMENT, COMBINEDEQUIPMENT. priority adalah CRITICAL, HIGH, MEDIUM, atau LOW. channel adalah WEB, EMAIL, SMS, WECHAT, atau CALL. fdd_code menandai aturan, misalnya REALTIME01 atau SPACE02.

11. Basis data pengguna (myems_user_db)​

myems_user_db punya 10 tabel.

TabelKolom utamaUraian
tbl_usersname, uuid, display_name, email, phone, salt, password, is_admin, is_read_only, privilege_id, account_expiration_datetime_utc, password_expiration_datetime_utc, failed_login_countPengguna. password adalah hash bergaram (VARCHAR(256))
tbl_privilegesname, data (LONGTEXT, JSON)Himpunan hak
tbl_sessionsuser_uuid, token, utc_expiresSesi masuk
tbl_logsuser_uuid, request_datetime_utc, request_method, resource_type, resource_id, request_bodyJurnal audit API. request_body adalah JSON
tbl_api_keysname, token, created_datetime_utc, expires_datetime_utcKunci API. id bertipe INT
tbl_new_usersname, uuid, display_name, email, salt, passwordPendaftaran yang menunggu
tbl_email_messagesrecipient_email, subject, message, scheduled_datetime_utc, statusSurel pengguna, misalnya setel ulang kata sandi. status adalah new, sent, atau timeout
tbl_email_message_sessionsrecipient_email, token, expires_datetime_utcToken tindakan surel
tbl_verification_codesrecipient_email, verification_code, created_datetime_utc, expires_datetime_utcKode verifikasi. id bertipe INT
tbl_notificationsuser_id, created_datetime_utc, status, subject, message, urlPemberitahuan dalam aplikasi. status adalah unread, read, atau archived

12. Basis data laporan (myems_reporting_db)​

myems_reporting_db punya 4 tabel.

TabelKolom utamaUraian
tbl_reportsname, uuid, expression, is_enabled, last_run_datetime_utc, next_run_datetime_utc, is_run_immediatelyJadwal laporan. expression adalah JSON
tbl_template_filesuuid, report_id, file_name, file_type, file_objectTemplat yang diikat ke laporan
tbl_reports_filesuuid, create_datetime_utc, file_name, file_type, file_objectBerkas yang dihasilkan
tbl_email_messagesrecipient_email, subject, message, attachment_file_object, scheduled_datetime_utc, statusSurel pengiriman laporan. Tabel ini tidak punya rule_id

13. Basis data produksi (myems_production_db)​

myems_production_db punya 8 tabel. Jumlah per jam memakai start_datetime_utc, product_id, dan product_count.

TabelKolom utamaUraian
tbl_productsname, uuid, unit_of_measure, tag, standard_product_coefficientProduk
tbl_teamsname, uuid, descriptionTim
tbl_shopfloors_productsshopfloor_id, product_idProduk yang dibuat di lantai pabrik
tbl_shopfloors_teamsshopfloor_id, team_idTim di lantai pabrik
tbl_shiftsshopfloor_id, team_id, product_id, product_count, start_datetime_utc, end_datetime_utc, reference_timestampCatatan sif
tbl_equipment_hourlyequipment_id, start_datetime_utc, product_id, product_countKeluaran per jam satu peralatan
tbl_shopfloor_hourlyshopfloor_id, start_datetime_utc, product_id, product_countKeluaran per jam lantai pabrik
tbl_space_hourlyspace_id, start_datetime_utc, product_id, product_countKeluaran per jam yang digulung ke ruang

Alur data​

Urutan pemrosesan:

  1. Gerbang menulis nilai titik ke myems_historical_db. Buku kerja yang diunggah masuk ke tabel berkas basis data yang sama.
  2. Normalisasi mengubah nilai titik menjadi bacaan meter, memakai ratio dan offset_constant dari tbl_points.
  3. Agregasi menulis baris per jam di myems_energy_db untuk meter dan setiap objek induk (peralatan, ruang, toko, penyewa, lantai pabrik, penyimpanan, jaringan mikro, pembangkit fotovoltaik).
  4. Penagihan mengalikan jam itu dengan tbl_tariffs / tbl_tariffs_timeofuses dan menulis myems_billing_db.
  5. Karbon mengalikan jam itu dengan kgco2e atau tbl_emission_factors dan menulis myems_carbon_db.
  6. Layanan garis dasar, model, rencana, dan prakiraan menulis basis data masing-masing. Basis data model menyimpan hour_of_year, bukan stempel waktu.
  7. FDD mengevaluasi tbl_rules.expression terhadap batas titik dan nilai agregat, lalu mengantrikan pesan surel, SMS, web, atau WeChat.
  8. Laporan membaca energi, biaya, dan karbon, mengisi tbl_template_files, dan menyimpan hasil di tbl_reports_files.
  9. Jumlah per jam di myems_production_db adalah penyebut intensitas energi.

Aturan struktur tabel​

Kolom umum​

Tabel konfigurasi di myems_system_db biasanya memuat:

KolomTipeUraian
idBIGINT NOT NULL AUTO_INCREMENTKunci primer
nameVARCHAR(128) atau VARCHAR(255)Nama tampilan
uuidCHAR(36) NOT NULLKunci bisnis yang stabil
descriptionVARCHAR(255)Uraian opsional

Tabel deret waktu dan kaitan tidak mengikuti kumpulan itu. Tabel fakta memakai id, kunci asing, dan actual_value. Banyak tabel kaitan hanya berisi id dan dua kunci asing. tbl_points, tbl_menus, dan tbl_iot_sim_cards tidak punya uuid.

Tipe data​

KegunaanTipe
Kunci primer dan asingBIGINT (INT pada tbl_api_keys dan tbl_verification_codes)
Energi, biaya, karbon, batas, luasDECIMAL(21, 6)
Harga periode tarifDECIMAL(23, 8)
LintangDECIMAL(12, 10)
BujurDECIMAL(13, 10)
Stempel waktuDATETIME, disimpan dalam UTC
Tanggal kalenderDATE
Waktu dalam sehariTIME
BenderaBOOL
Kode pendek dan statusVARCHAR
Dokumen JSON (address, faults, definitions, connection, expression aturan dan laporan, data hak, request_body)LONGTEXT
Persamaan (tbl_virtual_meters.equation, power_equation)LONGTEXT
Nilai titik digitalINT
BerkasLONGBLOB

Indeks​

Indeks sekunder dinamai {table_name}_index_{n}.

PolaContoh
Cari menurut namatbl_meters_index_1 (name)
Induk plus waktutbl_meter_hourly_index_1 (meter_id, start_datetime_utc)
Kategori plus waktutbl_space_input_category_hourly_index_1 (space_id, energy_category_id, start_datetime_utc)
Riwayat titiktbl_analog_value_index_1 (point_id, utc_date_time), tbl_analog_value_index_2 (utc_date_time)
Masa berlaku tariftbl_tariffs_index_2 (energy_category_id, valid_from_datetime_utc, valid_through_datetime_utc)

Skrip tidak menyatakan kunci asing. Integritas rujukan dijaga oleh API.