Subway energy consumption prediction method based on situation enhancement and block convolution Transform
By proposing a metro energy consumption prediction method based on context enhancement and block convolutional Transformer, the problems of external context information fusion and line heterogeneity in metro energy consumption prediction are solved. This method achieves high-precision and robust multi-line energy consumption prediction, takes into account both short-term and long-term trends, and improves the adaptability and accuracy of the model in complex operation scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU METRO DESIGN & RES INST CO LTD
- Filing Date
- 2026-01-22
- Publication Date
- 2026-05-08
AI Technical Summary
Existing subway energy consumption prediction methods are difficult to effectively integrate external contextual information and cannot adapt to the heterogeneity of subway lines, resulting in insufficient energy consumption prediction accuracy. Furthermore, they lack unified modeling of local energy consumption fluctuations and long-term and short-term trends, and the models are not robust in handling abnormal data.
A subway energy consumption prediction method based on context enhancement and block convolution Transformer is adopted. The input feature matrix is split by line for independent modeling. Multi-scale convolution enhances self-attention feature extraction and joint loss function, integrates external context information, sets discontinuous critical points and fuzzy connection functions, and dynamically adjusts parameters to achieve multi-scale feature learning and robust prediction.
It significantly improves the accuracy and stability of subway energy consumption prediction, can adapt to the heterogeneity of multiple lines, accurately capture the influence of external factors, reduce the interference of abnormal data, take into account both long-term and short-term trend prediction, and improve the generalization performance of the model in complex operation scenarios.
Smart Images

Figure CN121998186A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the interdisciplinary field of artificial intelligence time series forecasting and urban rail transit energy management, and is specifically applied to energy consumption forecasting of multi-line subway networks. Background Technology
[0002] With the acceleration of urbanization, ground transportation can hardly meet the rapidly growing travel needs of urban residents. Urban rail transit, with its advantages of large capacity, high efficiency, low energy consumption and stable operation, has gradually become an important part of the urban public transportation system.
[0003] As subway systems evolve towards a networked, high-density operation model, energy consumption issues are becoming increasingly prominent. This not only increases operating costs but also directly impacts urban carbon reduction goals. Therefore, accurate prediction of energy consumption for urban subway networks is crucial for achieving refined power supply scheduling, improving operational efficiency, and reducing carbon emissions. Predicting energy consumption for subway networks is extremely challenging, encompassing multiple components such as train traction energy consumption, station lighting energy consumption, ventilation energy consumption, and air conditioning energy consumption. Furthermore, different subway lines exhibit variations in passenger flow profiles, peak hours, operating modes, and conditions, resulting in significant heterogeneity in energy consumption patterns. The difficulty of prediction increases dramatically when the prediction scope expands to multi-line interconnected subway networks.
[0004] Existing methods for predicting subway energy consumption mainly include statistical models, machine learning models, and deep learning models. Traditional statistical models, based on linear assumptions, cannot capture nonlinear fluctuations caused by peak passenger flow, holiday effects, and sudden scheduling changes, resulting in insufficient prediction accuracy in complex subway operation scenarios. Machine learning models rely on feature engineering to extract key variables, are sensitive to noise, and have limited generalization ability. Deep learning methods excel in time series prediction; convolutional neural networks can effectively extract local features, and recurrent neural networks can capture temporal dependencies. However, the recurrent structure of recurrent neural networks is difficult to process in parallel, and gradient vanishing is prone to occur in long-sequence predictions.
[0005] Transformer and its improved models utilize self-attention mechanisms to model long-range dependencies, demonstrating excellent performance in sequence prediction. However, these models are mostly designed for general time series scenarios and are not optimized for the periodicity, line heterogeneity, and susceptibility to external factors of metro energy consumption data. Some studies have attempted to improve prediction accuracy through methods such as mode decomposition, spectral analysis, and signal decomposition, but a unified modeling framework specifically applicable to energy consumption prediction in multi-line metro networks is still lacking.
[0006] Unlike industrial load or meteorological data, subway energy consumption sequences exhibit strong periodicity, complex non-stationarity, and significant structural differences between lines. Simply using a multi-line mixed modeling approach ignores the individualized energy consumption characteristics of each line, easily introducing erroneous spurious correlations, leading to model overfitting and limiting prediction accuracy. Furthermore, existing prediction methods merely correlate passenger flow data without considering the unique characteristics of subway passenger flow and environmental control systems. The impact of passenger flow on energy consumption is not a continuous linear relationship; key energy-consuming equipment such as air conditioners and elevators have stable energy consumption thresholds, with significant changes only occurring when passenger flow reaches a specific critical point. Moreover, different subway stations have different equipment configurations and spatial layouts, and the energy consumption critical point of the same subway station may dynamically change at different times. Existing models lack specific modeling for this characteristic, further contributing to insufficient prediction accuracy.
[0007] Furthermore, existing self-attention mechanisms focus more on capturing the global long-range dependencies of sequences, with limited ability to characterize local energy consumption fluctuations. They struggle to simultaneously handle both long-term trend prediction and short-term fine-grained prediction, creating a bottleneck in the model's learning of multi-scale sequence features. Existing methods generally employ a single loss function for optimization. Mean squared error is overly sensitive to anomalous peaks common in subway operations, easily disrupting the learning of overall trends. While mean absolute error is robust to outliers, it may lead to insufficient accuracy in fitting smooth trends. Currently, there is a lack of an optimization mechanism that can simultaneously ensure high-fidelity fitting of energy consumption data from real subway networks and robust handling of outliers. Summary of the Invention
[0008] The purpose of this invention is to provide a subway energy consumption prediction method based on context enhancement and block convolutional Transformer, which solves the problem that existing methods are unable to effectively integrate external context information and cannot adapt to the heterogeneity of subway lines, resulting in insufficient energy consumption prediction accuracy.
[0009] To achieve the above objectives, the present invention provides the following technical solution:
[0010] A subway energy consumption prediction method based on context enhancement and block convolutional Transformer, characterized by the following steps:
[0011] Obtain subway-related data, preprocess the subway-related data, and construct an input feature matrix based on the preprocessed subway-related data;
[0012] The input feature matrix is split according to the subway lines to obtain multiple single-line feature sequences;
[0013] Each single-line feature sequence is processed by block modeling to obtain a block sequence;
[0014] The block sequence is input into the PCformer model, and multi-scale convolution is performed on the block sequence to enhance self-attention feature extraction.
[0015] The PCformer model is trained using a joint loss function until the model converges;
[0016] The trained PCformer model is used to perform independent inference on each single-line block sequence, and the inference results are denormalized to obtain the actual energy consumption value.
[0017] In one possible implementation, when acquiring the subway-related data, historical energy consumption data, passenger flow data, external context data, and station attribute data are collected.
[0018] When preprocessing the subway-related data, missing values are filled by linear interpolation, abnormal peak values are removed by outlier identification criteria and replaced with the mean of adjacent time steps, continuous data is normalized, and categorical data is encoded.
[0019] When constructing the input feature matrix, the historical energy consumption master sequence, passenger flow sequence, meteorological related sequence, date attribute identifier, peak period identifier and passenger flow classification feature are integrated. The passenger flow classification feature is generated by setting critical points, constructing fuzzy connection functions, adapting multi-scenario influence coefficients and dynamically adjusting parameters.
[0020] In one possible implementation, the input feature matrix is split according to the subway line, without performing cross-line feature concatenation, and only retaining the shared parameters of the subsequent model to obtain the single-line feature sequence corresponding to each line.
[0021] In one possible implementation, when performing block modeling processing on each single-line feature sequence, feature extraction and channel expansion are performed on the single-line feature sequence through one-dimensional convolution; the expanded features are block-based through one-dimensional depthwise separable convolution, and the block-based features are linearly weighted and fused; the fused features are channel-compressed through one-dimensional convolution to obtain the block sequence containing semantic fragments of the operation cycle.
[0022] In one possible implementation, after the block sequence is input into the PCformer model, the key and value in the self-attention mechanism are extracted using multi-scale convolution kernels. The extracted multi-scale features are then fused, and the fused features are fed into a probabilistic sparse attention mechanism for long-range dependency modeling, thus completing the multi-scale convolution-enhanced self-attention feature extraction.
[0023] In one possible implementation, when training with the joint loss function, the mean squared error and the mean absolute error are fused, and weight parameters are set differently based on line type, time period, and passenger flow intensity. Passenger flow change duration matching error is introduced to construct a dual optimization objective function. The PCformer model is trained by an optimizer, and after each round of training, the passenger flow classification threshold, fuzzy connection function parameters, and duration matching weights are dynamically adjusted based on the validation set error until the dual optimization objective function converges.
[0024] In one possible implementation, the external context data includes meteorological data, date attribute data, operating period data, and urban event data, and the station attribute data includes station type labeling information.
[0025] In one possible implementation, the characteristic is that, when setting the critical point, the critical point for passenger flow change is set according to the station type and time period, and the critical point for passenger flow duration is set according to the equipment adjustment characteristics.
[0026] When constructing the fuzzy connection function, a triangular fuzzy function is established between the critical points of adjacent passenger flow changes;
[0027] When adapting the multi-scenario impact coefficients, combined scenarios are constructed by integrating passenger flow changes, passenger flow duration, station type, and time period, and a corresponding energy consumption impact coefficient matrix is established; when dynamically adjusting parameters, the parameters of each critical point, fuzzy connection function, and time period are adjusted by gradient descent method to match the weights.
[0028] In one possible implementation, when performing the one-dimensional depthwise separable convolution block operation, the convolution kernel size and stride are set to divide the single-line feature sequence into blocks corresponding to the operational semantic segments, thereby obtaining the block-wise features.
[0029] In one possible implementation, when training the PCformer model, the preprocessed subway-related data is divided into a training set, a validation set, and a test set. The training rounds, batch size, and learning rate are set, and a learning rate decay strategy is used to adjust the learning rate. When using the trained PCformer model for inference, the energy consumption prediction results for each line in future time periods are output. The original scale of the data is restored by inverse normalization to obtain the actual energy consumption value that can be directly applied.
[0030] Compared with the prior art, the advantages of this invention are as follows:
[0031] The combination of the external context feature fusion step and the passenger flow classification prediction step effectively supplements the external stimulus information missing when relying solely on internal operational data. This allows the model to fully adapt to energy consumption fluctuations caused by external factors such as weather, holidays, and urban events. The passenger flow classification prediction step accurately captures the discontinuous impact of passenger flow on energy consumption by setting discontinuous critical points, constructing fuzzy connection functions, and dynamically adjusting parameters. It also adapts to the energy consumption lag effect caused by passenger flow variation duration, significantly reducing prediction bias caused by passenger flow fluctuations or misjudgments of duration, allowing the model to maintain stable predictive capabilities even in complex operational scenarios.
[0032] The channel-independent modeling step achieves independent modeling of data for each line by splitting the input feature matrix according to the line. This mechanism suppresses cross-line pseudo-correlation interference and avoids the dilution of fine-grained fluctuation features of a single line. Simultaneously, parameter sharing enables the model to transfer common temporal patterns across different lines, ensuring the independence of single-line modeling while improving the model's generalization performance in heterogeneous multi-line environments. This effectively avoids the overfitting problem caused by traditional channel mixing strategies.
[0033] The segmented modeling step uses one-dimensional convolutional feature extraction and depthwise separable convolutional segmentation to divide the original long sequence into segmented sequences containing semantic fragments of the operational cycle. This not only reduces the computational complexity of the subsequent model, but also allows the model to explicitly extract and learn key features of short cycles such as morning peak, off-peak, weekend, and holidays. As a result, the model can better capture fine-grained changes within the cycle while retaining long-term trend information, thus improving the accuracy of predicting short-cycle fluctuations.
[0034] The multi-scale convolutional enhanced self-attention structure uses multi-scale convolutional kernels to extract features from keys and values. Different scale convolutional kernels correspond to different receptive fields, enabling the capture of multi-level temporal dependencies such as fine-grained short-term fluctuations, hourly patterns, and inter-weekly periodic structures. By fusing multi-scale features before long-range dependency modeling, the efficiency of long-sequence processing is preserved while enhancing the model's sensitivity to local energy consumption fluctuations. This achieves unified modeling of short-term rapid fluctuations and long-term periodic dependencies, improving the robustness of long-term trend prediction.
[0035] The joint loss function balances the need for global trend fitting and local anomaly suppression by fusing mean squared error and mean absolute error. Weight parameters are set differently based on operational parameters such as line type, time period, and passenger flow intensity, and a dynamic fine-tuning mechanism is introduced. This allows the model to adaptively adjust its optimization direction according to different operational scenarios. This ensures accurate fitting of the overall energy consumption trend while reducing the interference of abnormal peaks on model training, further improving the model's stability and generalization performance in real subway operation scenarios. Attached Figure Description
[0036] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0037] Figure 1 This is a flowchart illustrating the overall process of subway energy consumption prediction according to an embodiment of the present invention.
[0038] Figure 2 This is a schematic diagram of the channel independence modeling process in an embodiment of the present invention;
[0039] Figure 3 This is a schematic diagram of the block modeling process according to an embodiment of the present invention;
[0040] Figure 4 This is a schematic diagram of the overall structure of the PCformer model according to an embodiment of the present invention;
[0041] Figure 5 This is a schematic diagram of a multi-scale convolutional enhanced self-attention structure according to an embodiment of the present invention;
[0042] Figure 6 This is a flowchart illustrating the subway energy consumption prediction method according to an embodiment of the present invention. Detailed Implementation
[0043] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0044] Example:
[0045] It should be noted that the terms "comprising" and "having" and any variations thereof in the embodiments of the present invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such processes, methods, products, or devices.
[0046] Combination Figure 1 and Figure 6 This embodiment of a subway energy consumption prediction method based on context enhancement and block convolutional Transformer includes the following steps:
[0047] Step 101: Obtain subway-related data, preprocess the subway-related data, and construct an input feature matrix based on the preprocessed subway-related data.
[0048] Specifically, the subway-related data are various basic data that support energy consumption prediction, such as historical energy consumption data, passenger flow data, temperature data, station type data, etc.; the input feature matrix is a multi-dimensional data set that integrates various preprocessed data, such as a matrix containing 7 days of historical energy consumption, 15-minute passenger flow, and meteorological indicators.
[0049] When acquiring the subway-related data, historical energy consumption data, passenger flow data, external context data, and station attribute data are collected. During preprocessing of the subway-related data, missing values are filled using linear interpolation, outlier peaks are removed using an outlier identification criterion and replaced with the average of adjacent time steps, continuous data is normalized, and categorical data is encoded. When constructing the input feature matrix, historical energy consumption master sequence, passenger flow sequence, meteorological related sequence, date attribute identifier, peak period identifier, and passenger flow classification features are integrated. The passenger flow classification features are generated by setting critical points, constructing fuzzy connection functions, adapting multi-scenario influence coefficients, and dynamically adjusting parameters.
[0050] Specifically, historical energy consumption data can be traction energy consumption and lighting energy consumption data every 15 minutes; passenger flow data can be passenger flow statistics for entering and exiting the station; external context data can be temperature, humidity, and holiday indicators; station attribute data can be station type labels; outlier identification criteria can be the 3σ criterion; normalization processing can be Min-Max normalization; coding can be unique thermal coding; meteorological correlation sequences can be temperature change sequences; date attribute indicators can be weekday, weekend, and holiday indicators; peak period indicators can be 7:00-9:00 AM and 5:00-7:00 PM indicators; passenger flow classification characteristics can be energy consumption impact characteristics based on passenger flow change and duration; the critical point can be the passenger flow change critical point of 200 people / 15 minutes; the fuzzy connection function can be a triangular fuzzy function; and the multi-scenario influence coefficient can be 1.5 when passenger flow suddenly increases and lasts for a long time.
[0051] During the data collection phase, historical energy consumption data was collected from the subway operation energy consumption management system, passenger flow data from the automatic fare collection system, external context data such as temperature and humidity from the city meteorological platform, and station attribute data from the subway operation system. In the preprocessing phase, linear interpolation was used to fill in a small amount of missing data, the 3σ criterion was used to identify abnormal energy consumption peaks and replace them with the average of adjacent time steps, Min-Max normalization was performed on continuous data such as energy consumption and passenger flow, and one-hot encoding was used for categorical data such as weather type and holidays. When constructing the feature matrix, historical energy consumption master sequences, passenger flow sequences, and other basic data were first integrated. Features; Regenerating passenger flow classification features: Set the critical point for passenger flow change based on station type and time period, setting it to 200 people / 15min for the morning peak of hub stations and 50 people / 15min for the off-peak of ordinary stations; Set the critical point for passenger flow duration based on equipment characteristics, setting it to 30min for air conditioning systems; Construct a triangular fuzzy function between adjacent critical points to smooth the transition of energy consumption influence coefficients; Establish an influence coefficient matrix integrating multiple scenarios, setting the coefficient for sudden and prolonged passenger flow increases to 1.5; Dynamically adjust each parameter using the gradient descent method; Finally, integrate the passenger flow classification features to form a complete input feature matrix.
[0052] Furthermore, the external contextual data includes meteorological data, date attribute data, operating period data, and urban event data, and the station attribute data includes station type labeling information.
[0053] Specifically, meteorological data can be temperature, humidity, and precipitation; date-related data can be statutory holidays and winter / summer vacation indicators; operating period-related data can be operating mode indicators and passenger flow levels; urban event-related data can be large-scale event day indicators; and station type labeling information can be hub station, transfer station, or ordinary station labeling.
[0054] When collecting external contextual data, meteorological data such as temperature, humidity, and precipitation are obtained from the city's meteorological platform; date-related data such as statutory holidays and summer / winter vacations are obtained from the State Council's holiday platform; operating time-related data such as operating modes and passenger flow levels are obtained from the subway operation and dispatch system; and city event-related data such as large-scale event days are obtained from the municipal event release system. When collecting station attribute data, the type labeling information of each station is obtained from the subway operation system to distinguish between hub stations, transfer stations, and ordinary stations; as shown in Table 1:
[0055] All collected data is aggregated and fed into the data preprocessing module for further processing.
[0056] Table 1. External context characteristics that can be introduced into subway energy consumption prediction and their influencing mechanisms;
[0057] Furthermore, when setting the critical points, the critical points for passenger flow change are set according to station type and time period, and the critical points for passenger flow duration are set according to equipment adjustment characteristics; when constructing the fuzzy connection function, a triangular fuzzy function is established between adjacent critical points for passenger flow change; when adapting the multi-scenario influence coefficients, combined scenarios are constructed by integrating passenger flow change, passenger flow duration, station type, and time period, and a corresponding energy consumption influence coefficient matrix is established; when dynamically adjusting parameters, the parameters of each critical point, fuzzy connection function, and time period are adjusted using the gradient descent method.
[0058] Specifically, the critical points for passenger flow variation can be 200 people / 15min and 300 people / 15min during the morning peak at the hub station; the critical points for passenger flow duration can be 30min and 60min for the air conditioning system; a triangular fuzzy function is constructed between adjacent critical points to smooth the transition of energy consumption impact coefficients in different passenger flow intervals. Let the critical points for passenger flow variation between two adjacent points be... and The corresponding energy consumption impact coefficient is and Then the triangular fuzzy function is expressed as: (when (time); among which, For passenger flow changes, This is the energy consumption impact coefficient corresponding to changes in passenger flow. This is the (k-1)th critical point for passenger flow change. This is the critical point for the k-th change in passenger flow.
[0059] The combined scenario can be a combination of scenarios such as a sudden increase in passenger flow, long duration, hub station, and morning peak; the energy consumption impact coefficient matrix can be a matrix with a coefficient of 1.5 under this scenario; the gradient descent method can be the stochastic gradient descent method; the duration matching weight can be a value of 0.1-0.3.
[0060] When setting critical points, based on station type and time period, the critical points for passenger flow change during the morning peak at hub stations are set at 200 people / 15min and 300 people / 15min, while those for ordinary stations during off-peak periods are set at 50 people / 15min and 100 people / 15min. Based on equipment adjustment characteristics, the critical points for passenger flow duration are set at 30min and 60min for air conditioning systems and 15min and 30min for elevator systems. When constructing fuzzy connection functions, triangular fuzzy functions are established between adjacent critical points for passenger flow change to achieve a smooth transition of energy consumption impact coefficients. When adapting to multi-scenario impact coefficients, combined scenarios are constructed by integrating passenger flow change, duration, etc. The scenario coefficient for the combination of scenarios such as sudden passenger flow increase, long duration, hub stations, and morning peak is set at 1.5. When dynamically adjusting parameters, guided by a dual optimization objective function, the parameters of each critical point, fuzzy function, and duration matching weight are iteratively adjusted using the gradient descent method, and updated once after each round of training.
[0061] Step 102: Split the input feature matrix according to the subway lines to obtain multiple single-line feature sequences.
[0062] Specifically, a single-line feature sequence is a sequence of corresponding feature data for a single metro line, which can be a 15-minute feature sequence for the backbone line L1.
[0063] Specifically, the input feature matrix is split according to the subway line, without cross-line feature concatenation, and only the shared parameters of the subsequent model are retained to obtain the single-line feature sequence corresponding to each line.
[0064] Specifically, line splitting can be splitting the feature matrix containing multiple lines by column; cross-line feature splicing can be connecting the features of different lines end to end; parameter sharing can be the encoder and decoder parameters of the PCformer model being shared by all lines; single-line feature sequence can be the feature sequence of hub connection line L3.
[0065] Obtain the constructed input feature matrix, where each column corresponds to the feature data of a subway line at each time step; start the line splitting module to split the feature matrix by column, with each line corresponding to one column of data, and directly extract it as the single-line feature sequence for that line; during the splitting process, no cross-line feature splicing or fusion is performed to avoid mutual interference between features of different lines; the subsequent PCformer model adopts a parameter sharing mechanism, that is, the feature sequences of all lines are input into the same model, and the parameters of the encoder, decoder and other components of the model are shared, but the feature processing paths of each line are independent of each other; the single-line feature sequences obtained after splitting are directly input into the block modeling module for subsequent processing.
[0066] For example, see Figure 2 Let the first The energy consumption sequence of the subway lines is as follows , length is :
[0067] in, Let be the original energy consumption sequence of the i-th subway line, containing the energy consumption data of the line from the first time step to the L-th time step, representing the characteristic sequence of a single line; This refers to the subway line number, with values ranging from 1, 2, ..., M, corresponding to M subway lines. This can correspond to multiple single lines. Multivariable input sequence of a line First, split into channels Single variable sequence:
[0068] in, The feature sequence of the i-th subway line obtained after modeling and decomposing the passage independence is not concatenated with the features of other lines. This is the data dimension identifier for a single-line feature sequence, where 1 represents a single-line channel and L represents the sequence time step length.
[0069] Based on this, with independent channel settings, each sequence is fed into the same parameter-shared PCformer backbone network, and the backbone network independently outputs the future sequence for each channel. Step prediction:
[0070] Subsequently, with independent channel settings, the energy consumption sequence of each line is input into the same prediction backbone network (PCformer), and no feature concatenation is performed between channels; only the network parameters are shared. The backbone network independently outputs the future value for each channel. Prediction results for the step:
[0071] in, Let i be the energy consumption prediction sequence for the i-th line. For the i-th line, here is the predicted energy consumption data for the first to T time steps in the future. The data dimension identifier for the predicted sequence is 1, which represents a single-channel path, and T represents the prediction time step length.
[0072] Through the above steps, the forward inference paths of each line are decoupled from each other, which suppresses cross-line interference and spurious correlation propagation from a mechanism perspective. At the same time, parameter sharing enables the model to transfer common temporal patterns between different lines, thereby obtaining more robust prediction performance in multi-line heterogeneous environments.
[0073] Step 103: Perform block modeling processing on each of the single-line feature sequences to obtain block sequences.
[0074] Specifically, a segmented sequence is a collection of fragments of a single-line feature sequence after segmentation processing, which can be feature fragments corresponding to the morning peak, off-peak, and evening peak.
[0075] Specifically, when performing block modeling processing on each single-line feature sequence, feature extraction and channel expansion are performed on the single-line feature sequence through one-dimensional convolution; block operation is performed on the expanded features through one-dimensional depthwise separable convolution, and linear weighted fusion is performed on the block features; channel compression is performed on the fused features through one-dimensional convolution to obtain the block sequence containing semantic segments of the operation cycle.
[0076] Specifically, one-dimensional convolution can be Conv1D with a kernel size of 3; feature extraction and channel expansion can be expanding the feature dimension from 64 to 256; one-dimensional depthwise separable convolution can be DWConv1D with a kernel size of 24 and a stride of 12; block operation can be dividing the sequence into segments corresponding to 6-hour time periods; linear weighted fusion can be assigning weights to multi-channel block features and summing them; channel compression can be compressing 256-dimensional features to 128-dimensional features; operational cycle semantic segments can be feature segments corresponding to morning peak, off-peak, and evening peak; and block sequences can be sequences composed of multiple operational semantic segments.
[0077] For each single-line feature sequence, feature extraction and channel expansion are first performed using one-dimensional convolution with a kernel size of 3 and ReLU activation function, expanding the original feature channel count to 256. Next, one-dimensional depthwise separable convolution is used for block segmentation, with a kernel size of 24 and a stride of 12, dividing the sequence into multiple blocks containing operational semantics according to 6-hour time periods, obtaining the segmented features. The segmented features are then linearly weighted and fused, with weights assigned according to the importance of each block, and the summation yields the fused features. Finally, one-dimensional convolution is used for channel compression, compressing the 256-dimensional fused features to 128 dimensions, resulting in a segmented sequence containing operational cycle semantic segments.
[0078] Furthermore, when performing the one-dimensional depth-separable convolution block operation, the convolution kernel size and stride are set to divide the single-line feature sequence into blocks corresponding to the operational semantic segments, thereby obtaining the block-wise features.
[0079] Specifically, the kernel size can be 24; the stride can be 12; the operational semantic segment can be a 6-hour segment of morning peak and off-peak; and the segmented features can be feature tensors with dimensions of [batch, number of segments, feature dimension].
[0080] Before performing one-dimensional depthwise separable convolution block operations, parameters are set according to the characteristics of the subway operation cycle: the convolution kernel size is set to 24 (corresponding to 6 hours of data, matching the length of morning / evening peak hours), and the stride is set to 12 (corresponding to 3 hours). The expanded single-line feature sequence is input into the one-dimensional depthwise separable convolution module. The module performs sliding window-style block division on the sequence according to the set convolution kernel size and stride. Each window corresponds to a segment of operational semantics, such as morning peak, off-peak, and evening peak. The long sequence is divided into multiple short blocks to obtain the block features.
[0081] For example, see Figure 3The energy consumption sequence of subway lines exhibits significant periodicity, typically manifested as: a 7-day weekday pattern (high energy consumption on weekdays and low energy consumption on weekends), and short-term peak-valley fluctuations driven by operational strategies and passenger flow organization (such as differences in vehicle traction and station power load corresponding to morning peak, off-peak, and evening peak). Furthermore, scheduling strategies such as holidays, temporary passenger flow restrictions, and additional / reduced train services cause shifts in the cyclical pattern between adjacent days, resulting in a sequence that is periodically stable but locally volatile. Existing methods often rely on long backtesting windows (e.g., more than 30 days) to learn the overall trend, which can flatten the fine-grained structures within the cycle, such as peak-hour / evening and weekend pattern switching. This leads to problems such as increased peak deviation and misjudgment of weekends / holidays in real-world operational scheduling scenarios.
[0082] To specifically describe the unique periodic patterns of the subway, a convolutional block modeling mechanism is introduced at the input end. By performing local periodic slicing and feature enhancement on the original energy consumption sequence, the model can explicitly extract and learn key features of short periods such as morning peak, off-peak, and evening peak while retaining long-term trend information, thereby improving prediction accuracy and stability.
[0083] See you again Figure 3 For each line input one-dimensional time series First, a one-dimensional convolutional layer (Conv1D) is used for preliminary feature extraction and channel expansion to enhance the model's ability to represent energy consumption patterns under different operating conditions (such as daily morning and evening peak fluctuations, weekday and weekend pattern differences, and peak-valley shifts caused by holiday disturbances). Subsequently, a one-dimensional depthwise separable convolution (DWConv1D) is introduced for block segmentation.
[0084] Let its convolution kernel size be Step size is This operation divides the sequence into several patches according to local time windows, so that each patch corresponds to a segment with clear operational semantics (such as peak / off-peak periods), thereby achieving structured modeling of short-cycle fluctuations. After this segmentation operation, the sequence length is reduced from the original... Become :
[0085] in , where is the length of the block sequence after the single-line feature sequence is modeled by block segmentation. The kernel size for one-dimensional depthwise separable convolutions for block segmentation. The stride of a one-dimensional depthwise separable convolution is used for block segmentation. This is the floor function.
[0086] After obtaining the patch representation, a linear layer is used to weightedly fuse the local features of multiple channels to capture the interdependencies of subway energy consumption during different operating periods (e.g., the differences and patterns of power load between the main line and branch lines, and between morning and evening peak hours and off-peak hours). Finally, a Conv1D layer recompresses the multi-channel features into a single-channel output, resulting in the final block sequence representation. The entire calculation process of the Patching Block can be represented as follows:
[0087] in, The block sequence of the i-th route after block modeling contains semantic segments of the operating cycle, such as morning peak and off-peak. This is a one-dimensional convolution operation used for feature extraction, channel augmentation, or compression. This is a linear layer operation used for linear weighted fusion of block features; This is a one-dimensional depthwise separable convolution operation used to divide augmented features into blocks; Let be the single-line characteristic sequence of the i-th line.
[0088] Through this block-based modeling mechanism, the number of PCformer input tokens is reduced from the original... Reduce to This results in a quadratic reduction in the memory consumption and computational complexity of the attention matrix in subsequent models. This provides a significant advantage in scenarios with limited GPU memory and training time. Furthermore, because the patch representation explicitly preserves the cyclical characteristics of subway operations at the input (local morphological changes caused by peak hours, weekend patterns, and holiday switching), the model can still focus on local cyclical fluctuations over a longer period, thus balancing both long-term dependencies and short-term cyclical dynamics.
[0089] Step 104: Input the segmented sequence into the PCformer model and perform multi-scale convolution to enhance self-attention feature extraction on the segmented sequence.
[0090] Specifically, the PCformer model is an improved Transformer model that combines block modeling with multi-scale convolution to enhance attention.
[0091] Specifically, after the block sequence is input into the PCformer model, the key and value in the self-attention mechanism are extracted using multi-scale convolution kernels. The extracted multi-scale features are then fused, and the fused features are fed into a probabilistic sparse attention mechanism for long-range dependency modeling, thus completing the multi-scale convolution-enhanced self-attention feature extraction.
[0092] Specifically, the multi-scale convolution kernel can be a one-dimensional convolution kernel with sizes of 1, 3, 5, and 7; the key and value can be the feature matrix used to calculate attention weights in the self-attention mechanism; the multi-scale features can be fine-grained short-term fluctuation features or hourly pattern features; the fusion can be weighted summation fusion; the probabilistic sparse attention mechanism can be the sparse attention mechanism in Informer; and the long-range dependency modeling can be the energy consumption correlation modeling within a 7-day cycle.
[0093] The block sequence is input into the PCformer model. The model first performs embedding processing on the block sequence to obtain a feature representation of a unified dimension. In the self-attention mechanism, instead of using traditional linear mapping to generate keys and values, multi-scale convolutional kernels are used to extract features from the feature representation separately. 1-dimensional convolutional kernels capture fine-grained short-term fluctuations, 3-dimensional kernels capture hourly patterns, and 5-dimensional and 7-dimensional kernels capture inter-weekly periodic structures. The key and value features extracted by convolution at different scales are weighted and fused, with the sum of the weights being 1. The fused keys and values are then fed into the probabilistic sparse attention mechanism to calculate attention weights. Based on the features of key time steps, long-range dependency modeling is performed to complete the multi-scale convolution-enhanced self-attention feature extraction.
[0094] For example, to simultaneously capture the short-term rapid fluctuations and long-term periodic dependence structure in the subway energy consumption sequence, this embodiment proposes an improved model—PCformer (Patch ConvolutionalTransformer)—based on the Informer framework. Its overall structure is as follows: Figure 4 As shown.
[0095] In the multi-head probabilistic sparse self-attention mechanism used by Informer, the generation of both keys and values depends on linear mapping. This type of point-wise embedding is difficult to effectively represent the local time-related patterns that are common in subway energy consumption, such as instantaneous load changes during morning and evening rush hours and short-cycle disturbances caused by holiday mode switching.
[0096] To address this issue, a multi-scale convolutional enhancement structure is introduced into the self-attention module. By using one-dimensional convolutional kernels of different scales in the key and value generation processes, the extraction and fusion of features across multiple time scales are achieved. Figure 5 As shown.
[0097] In this structure, different convolutional kernels (e.g., convolutions with kernels of 1, 3, 5, and 7) correspond to different receptive fields, which can capture multi-level temporal dependencies such as fine-grained short-term fluctuations, hourly patterns within a workday, and weekly cyclical structures. Subsequently, several key / value representations generated by multi-scale convolutions are fused to form an enhanced temporal representation, which is then fed into a probabilistic sparse attention mechanism for long-range dependency modeling.
[0098] For the input sequence Original linear mapping:
[0099] in, This is the key matrix in the self-attention mechanism, used to calculate attention weights; This is the value matrix in the self-attention mechanism, used to generate attention output features; The linear mapping weight parameters of the key matrix, The linear mapping weight parameters of the value matrix.
[0100] Change to multi-scale convolution form:
[0101] in, The key feature matrix extracted by the convolution kernel of the s-th scale; The value feature matrix extracted by the convolution kernel at the s-th scale is, and Corresponding to the same scale; For a one-dimensional convolution operation of the s-th scale, the kernel size is s; The scale number represents the multi-scale convolution kernel.
[0102] Then, the final representation is obtained by merging:
[0103] in, The fusion weights for the s-th scale feature are used to adjust the contribution of features at different scales. To incorporate the normalization constraints of the weights, ensure that the sum of the weights is 1.
[0104] Through the above steps, the self-attention module not only retains the efficiency of Informer in processing long sequences, but also significantly improves the model's sensitivity to local dynamic features of subway energy consumption, enabling PCformer to achieve unified modeling of short-term fine-grained and long-term trend information in complex energy consumption scenarios with long-term trends and short-term disturbances.
[0105] Step 105: Train the PCformer model using a joint loss function until the model converges.
[0106] Specifically, the joint loss function is an optimization function that integrates multiple error calculations, and can be a weighted combination of mean squared error and mean absolute error.
[0107] When training with the joint loss function, the mean squared error and the mean absolute error are fused, and weight parameters are set differently according to the route type, time period and passenger flow intensity. The passenger flow change duration matching error is introduced to construct a dual optimization objective function. The PCformer model is trained by the optimizer. After each training round, the passenger flow classification critical point, fuzzy connection function parameters and duration matching weights are dynamically adjusted based on the validation set error until the dual optimization objective function converges.
[0108] Specifically, the joint loss function can be a weighted combination of mean squared error and mean absolute error; the weight parameters can be λ1 and λ2; the passenger flow change duration matching error can be the absolute difference between the predicted duration and the actual duration; the dual optimization objective function can be... (in To predict energy consumption, For actual energy consumption, For the predicted duration of passenger flow changes, The duration of actual changes in passenger flow The duration matching weight is set to 0.1-0.3 based on the stability of line operation (0.3 for backbone lines and 0.1 for suburban lines). The optimizer can be the Adam optimizer. The duration matching weight can be 0.3 for backbone lines. The dynamic adjustment parameter can be the adjustment of the critical point of passenger flow change.
[0109] A joint loss function is constructed, fusing mean squared error and mean absolute error. Weights are set according to line type: λ1=0.3 and λ2=0.7 during peak hours for backbone lines, and λ1=0.6 and λ2=0.4 for all hours for suburban lines. A passenger flow variation duration matching error is introduced, with the duration matching weight ω determined based on line stability: 0.3 for backbone lines and 0.1 for suburban lines. A dual optimization objective function is constructed. The Adam optimizer is used to train the model with an initial learning rate of 0.001, a cosine annealing learning rate decay strategy, a batch size of 32, and 100 training epochs. After each training epoch, the energy consumption prediction error and passenger flow duration matching error of the validation set are calculated. Based on the dual objective function, the passenger flow classification threshold, fuzzy connection function parameters, and duration matching weights are dynamically adjusted using gradient descent. This iteration is repeated until the dual optimization objective function converges, completing model training.
[0110] Furthermore, when training the PCformer model, the preprocessed subway-related data is divided into a training set, a validation set, and a test set. The training rounds, batch size, and learning rate are set, and a learning rate decay strategy is used to adjust the learning rate. When using the trained PCformer model for inference, the energy consumption prediction results for future time periods of each line are output. The original scale of the data is restored by inverse normalization to obtain the actual energy consumption values that can be directly applied.
[0111] Specifically, the training set can be data from January 1, 2024 to November 30, 2024; the validation set can be data from the training set divided into 10% segments; the test set can be data from December 1, 2024 to December 31, 2024; the training epochs can be 100; the batch size can be 32; the learning rate can be initially 0.001; the learning rate decay strategy can be cosine annealing; the inverse normalization can be Min-Max inverse transform; the future time period can be the next 24 hours; and the actual energy consumption value can be the total energy consumption prediction value every 15 minutes.
[0112] The preprocessed subway-related data was divided chronologically, with the training set comprising 90%, the validation set 10%, and the test set 10%. Model training parameters were set with 100 training epochs, a batch size of 32, an initial learning rate of 0.001, and a cosine annealing learning rate decay strategy. The PCformer model was trained using the training set, while the validation set was used to monitor errors in real time and dynamically adjust parameters. After training, the historical feature sequences from the test set were input into the model, which outputs energy consumption predictions for each line over the next 24 hours (96 time steps). The prediction results were then subjected to Min-Max inverse normalization to restore the original data scale, yielding directly applicable actual energy consumption values.
[0113] For example, in the task of predicting subway energy consumption, the energy consumption sequence has significant non-stationarity: the changes are gradual in most periods, but energy consumption will reach its peak during holidays, large events, or sudden failures. If only mean squared error (MSE) is used, the model training is easily affected by extreme values; while using mean absolute error (MAE) alone is not sensitive enough to abnormal fluctuations and is difficult to capture abnormal energy consumption patterns.
[0114] Therefore, this embodiment constructs a joint loss function of MSE (mean squared error) and MAE (mean absolute error) to balance the needs of global trend modeling and local anomaly suppression. Let the predicted value be... The actual value is Then the joint loss function value Defined as:
[0115] in, and These are the weighting coefficients for MSE and MAE, used to adjust the balance between trend fitting and anomaly robustness; This is the predicted energy consumption sequence for the i-th line from the L+1 to the L+T time steps in the future; This is the actual energy consumption sequence of the i-th line from the L+1 to the L+T-th time steps in the future; Calculate the squared error between the predicted and true sequences, taking the square of the L2 norm.
[0116] against and The parameters are refined and differentiated based on specific subway operating parameters (line type, passenger flow intensity, time period characteristics), as follows:
[0117] (1) Basis for parameter value selection: Used to balance the accuracy of global trend fitting. To enhance outlier robustness, both satisfy... (Ensure weight normalization).
[0118] (2) Refine by route type: backbone routes (high passenger flow, large energy consumption fluctuations) take , Enhance robustness to abnormal peaks; suburban routes (with stable passenger flow and small energy consumption fluctuations) should take... , This improves the accuracy of trend fitting.
[0119] (3) Detailed by time period: Peak passenger flow periods (7:00-9:00 AM and 5:00-7:00 PM) are taken as follows: , To cope with abnormal energy consumption caused by sudden surges in passenger flow; during off-peak hours... , Pick up during nighttime hours (23:00-6:00 the next day) , It adapts to the trend of stable energy consumption.
[0120] (4) Dynamic fine-tuning mechanism: Based on the output of the passenger flow classification prediction submodule, if the current scenario is "sudden passenger flow change + long duration" (high anomaly risk), then dynamically adjust Increase by 0.1, Reducing it by 0.1 further enhances the ability to suppress abnormalities.
[0121] This joint loss function can reduce the interference of abnormal extreme values while ensuring that the model accurately models the overall energy consumption trend. Furthermore, by refining the weight parameters through association with specific subway operation parameters, it can further improve the stability and generalization performance of the PCformer model in complex operating scenarios.
[0122] Step 106: Use the trained PCformer model to perform independent reasoning on each single-line block sequence, and perform inverse normalization on the reasoning results to obtain the actual energy consumption value.
[0123] Specifically, the actual energy consumption value is the energy consumption prediction result that can be directly applied after inverse normalization, and it can be the traction energy consumption value of a certain line in the next 15 minutes.
[0124] The block sequence is input into the PCformer model, and features are extracted by enhancing self-attention through multi-scale convolution. The model is trained using a joint loss function and iterated with the Adam optimizer, with parameters dynamically adjusted in each round until convergence. After training, the model independently infers each single-line block sequence, and the actual energy consumption value is obtained after inverse normalization.
[0125] This implementation case uses three typical subway lines in a first-tier city (backbone line L1, suburban commuter line L2, and hub connection line L3) as the prediction objects to achieve energy consumption prediction for the next 24 hours (with 15-minute time steps and a total of 96 prediction points). The specific process is as follows:
[0126] Step 1: Data Sources and Preprocessing
[0127] (1) Data types and sources: ① Historical energy consumption data: Energy consumption data for 3 lines from January 1, 2024 to December 31, 2024, was obtained from the Metro Operation Energy Consumption Management System, including traction energy consumption, lighting energy consumption, air conditioning energy consumption and total energy consumption, totaling 35,040 time steps; ② Passenger flow data: Passenger flow data for entering and exiting stations was obtained from the Metro Automatic Fare Collection System (AFC) for the same period; ③ External context data: Temperature, humidity and weather type (sunny / rainy / snowy) data for the same period were obtained from the city meteorological platform, statutory holiday identifiers were obtained from the State Council Holiday Platform, and train departure frequency and operation mode identifiers were obtained from the Metro Operation Dispatch System; ④ Station attribute data: Type labeling of 52 stations in 3 lines (8 hub stations, 12 transfer stations and 32 ordinary stations).
[0128] (2) Data preprocessing: ① Missing value filling: Linear interpolation is used to fill a small number of missing energy consumption and passenger flow data; ② Outlier handling: The 3σ criterion is used to identify and remove abnormal peak values of energy consumption (such as sudden data increase caused by equipment failure) and replace them with the mean of adjacent time steps; ③ Data normalization: Continuous data such as energy consumption, passenger flow and temperature are normalized to the [0,1] interval using Min-Max, and classified data such as weather type and holidays are processed using one-hot encoding.
[0129] Step 2: Selection and setting of prediction parameters
[0130] (1) Core parameters of the model: backtracking window length L=168 (corresponding to 7 days of 15-minute data, covering the complete cycle), prediction step size T=96 (corresponding to 24 hours of 15-minute data), block modeling convolution kernel size K=24 (corresponding to 6 hours of data, matching the length of morning / evening peak periods), step size S=12 (corresponding to 3 hours), multi-scale convolution kernel size is 1, 3, 5, 7; PCformer model encoder layer NEncoder=4, decoder layer NDecoder=2, multi-head attention head NHead=8, model hidden layer dimension dmodel=512.
[0131] (2) Passenger flow classification parameters: ① Critical point of passenger flow change ∆P k ① For hub stations, during the morning peak, ∆P1 = 200 people / 15min and ∆P2 = 300 people / 15min; for ordinary stations, during the off-peak, ∆P1 = 50 people / 15min and ∆P2 = 100 people / 15min; ② Critical point T for passenger flow duration. k For the air conditioning system, T1=30min, T2=60min; for the elevator system, T1=15min, T2=30min; ③ The fuzzy connection function adopts the triangular fuzzy function, and the initial influence coefficient α ranges from 1.0 to 1.5 (α=1.0 indicates no change in energy consumption, and α=1.5 indicates a significant increase in energy consumption).
[0132] (3) Loss function parameters: L1 (backbone line) peak period λ1=0.3, λ2=0.7, off-peak period λ1=0.5, λ2=0.5; L2 (suburban line) all-time λ1=0.6, λ2=0.4; L3 (hub line) peak period λ1=0.2, λ2=0.8, off-peak period λ1=0.4, λ2=0.6.
[0133] Step 3: Predict Implementation Steps
[0134] (1) Feature construction: Based on the preprocessed data, an input feature matrix is constructed, including a 7-day historical energy consumption sequence (main sequence), passenger flow sequence, meteorological sequence, date attributes (weekday / weekend / holiday), peak period identifier and passenger flow classification features (including critical point judgment and influence coefficient calculation).
[0135] (2) Model training: The data from January 1, 2024 to November 30, 2024 was used as the training set (33,600 time steps), and the data from December 1, 2024 to December 31, 2024 was used as the test set. The Adam optimizer was used with an initial learning rate of 0.001, a learning rate decay strategy of cosine annealing, a batch size of 32, and 100 training rounds. After each training round, the energy consumption prediction error and passenger flow change duration matching error were calculated using the validation set. Based on the dual objective function, the passenger flow classification critical point, fuzzy connection function parameters, and duration matching weights were dynamically adjusted to ensure that the sub-objective function miny−y+ω×Tpred−Ttrue converged.
[0136] (3) Prediction and reasoning: Input the historical feature sequence of the test set into the trained PCformer model, perform energy consumption prediction on the three lines by channel independent modeling, and obtain the energy consumption prediction results of each line for the next 24 hours in 15 minutes; finally, the normalized prediction results are reversed through the post-processing module to obtain the actual energy consumption value.
[0137] Step 4: Validate the prediction results
[0138] The prediction accuracy was evaluated using the mean absolute percentage error (MAPE). The results showed that the MAPE for line L1 was 3.2%, for line L2 it was 2.8%, and for line L3 it was 3.5%, all of which were better than the traditional Informer model (MAPE=5.1%) and the random forest model (MAPE=7.8%). In scenarios with sudden changes in passenger flow (such as peak holiday periods on line L3), the prediction error of this model was reduced by more than 40% compared with the traditional model, which verified the effectiveness of the passenger flow classification prediction mechanism and the refined parameter design.
[0139] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0140] The above embodiments are merely illustrative of the technical concept and features of the present invention, and are intended to enable those skilled in the art to understand the content of the present invention and implement it accordingly. They should not be construed as limiting the scope of protection of the present invention. All equivalent changes or modifications made based on the essence of the content of the present invention should be covered within the scope of protection of the present invention.
Claims
1. A subway energy consumption prediction method based on context enhancement and block convolutional Transformer, characterized in that, Includes the following steps: Obtain subway-related data, preprocess the subway-related data, and construct an input feature matrix based on the preprocessed subway-related data; The input feature matrix is split according to the subway lines to obtain multiple single-line feature sequences; Each single-line feature sequence is processed by block modeling to obtain a block sequence; The block sequence is input into the PCformer model, and multi-scale convolution is performed on the block sequence to enhance self-attention feature extraction. The PCformer model is trained using a joint loss function until the model converges; The trained PCformer model is used to perform independent inference on each single-line block sequence, and the inference results are denormalized to obtain the actual energy consumption value.
2. The method according to claim 1, characterized in that, When acquiring the subway-related data, historical energy consumption data, passenger flow data, external context data, and station attribute data are collected. When preprocessing the subway-related data, missing values are filled by linear interpolation, abnormal peak values are removed by outlier identification criteria and replaced with the mean of adjacent time steps, continuous data is normalized, and categorical data is encoded. When constructing the input feature matrix, the historical energy consumption master sequence, passenger flow sequence, meteorological related sequence, date attribute identifier, peak period identifier and passenger flow classification feature are integrated. The passenger flow classification feature is generated by setting critical points, constructing fuzzy connection functions, adapting multi-scenario influence coefficients and dynamically adjusting parameters.
3. The method according to claim 1, characterized in that, The input feature matrix is split according to the subway line, without cross-line feature concatenation, and only the shared parameters of the subsequent model are retained to obtain the single-line feature sequence corresponding to each line.
4. The method according to claim 1, characterized in that, When performing block modeling processing on each single-line feature sequence, feature extraction and channel expansion are performed on the single-line feature sequence through one-dimensional convolution; block operation is performed on the expanded features through one-dimensional depthwise separable convolution, and linear weighted fusion is performed on the block features; channel compression is performed on the fused features through one-dimensional convolution to obtain the block sequence containing semantic fragments of the operation cycle.
5. The method according to claim 1, characterized in that, After the block sequence is input into the PCformer model, the key and value in the self-attention mechanism are extracted using multi-scale convolution kernels. The extracted multi-scale features are fused and then fed into the probabilistic sparse attention mechanism for long-range dependency modeling, thus completing the multi-scale convolution-enhanced self-attention feature extraction.
6. The method according to claim 1, characterized in that, When training with the joint loss function, mean square error and mean absolute error are fused, and weight parameters are set differently according to line type, time period and passenger flow intensity. Passenger flow change duration matching error is introduced to construct a dual optimization objective function. The PCformer model is trained using an optimizer. After each training round, the passenger flow classification threshold, fuzzy connection function parameters, and time-matching weights are dynamically adjusted based on the validation set error until the dual optimization objective function converges.
7. The method according to claim 2, characterized in that, The external contextual data includes meteorological data, date attribute data, operating period data, and urban event data, while the station attribute data includes station type labeling information.
8. The method according to claim 2, characterized in that, When setting the critical point, the critical point for passenger flow change is set according to the station type and time period, and the critical point for passenger flow duration is set according to the equipment adjustment characteristics. When constructing the fuzzy connection function, a triangular fuzzy function is established between the critical points of adjacent passenger flow changes; When adapting to the multi-scenario impact coefficients, combined scenarios are constructed by integrating passenger flow changes, passenger flow duration, station type, and time period, and a corresponding energy consumption impact coefficient matrix is established. When dynamically adjusting parameters, the critical points, fuzzy connection function parameters, and time-matching weights are adjusted using the gradient descent method.
9. The method according to claim 4, characterized in that, When performing the one-dimensional depth-separable convolution block operation, the convolution kernel size and stride are set, and the single-line feature sequence is divided into blocks corresponding to the operational semantic segments to obtain the block-wise features.
10. The method according to claim 1, characterized in that, When training the PCformer model, the preprocessed subway-related data is divided into a training set, a validation set, and a test set. The training rounds, batch size, and learning rate are set, and the learning rate is adjusted using a learning rate decay strategy. When using the trained PCformer model for inference, the energy consumption prediction results for each line in future time periods are output. The original scale of the data is restored by inverse normalization to obtain the actual energy consumption values that can be directly applied.