disclosure of Invention
The invention aims to provide a micro-grid control method and system to realize safe and stable work of a micro-grid system operating in an isolated island.
In order to achieve the purpose, the invention provides the following scheme:
a microgrid control method is based on a multi-agent system comprising a main controller and a plurality of sub-controllers, wherein the plurality of sub-controllers are connected with a plurality of working units in the microgrid system in a one-to-one correspondence manner, and the sub-controllers are also connected with the main controller, and the control method comprises the following steps:
acquiring state information of each working unit and stability information of a bus node through a plurality of sub-controllers;
a decision tree algorithm is adopted to make a control strategy according to the state information and the stability information through the main controller;
and performing decentralized coordination control on the working units through the sub-controllers according to the control strategy.
Optionally, the obtaining of the state information of each working unit by the plurality of sub-controllers specifically includes:
building a hybrid robot model representing status information of the work cell as shown in the following formula:
H1(D, L, F, S, F, Init); wherein D ═ { δ1,δ2,δ3…, representing a discrete state space set of work units; l represents a continuous state space set of work units; f ═ f1(δ1),f2(δ2),f3(δ3) …) represents the variation law of the continuous state space in the discrete state space; (S) ═ S1,S2,S3…) represents a mapping between a discrete state space and a continuous state space; f ═ F1,F2,F3…) represents conditions for state space transitions;
detecting discrete states and continuous states of the working unit;
and setting the hybrid robot model according to the discrete state and the continuous state of the working unit to obtain the state information of the working unit.
Optionally, the obtaining, by a plurality of sub-controllers, the stability information of the bus node of each working unit specifically includes:
detecting voltage signals of bus nodes of each working unit and power information of each distributed power supply;
and determining a voltage safety index according to the voltage signal, and determining a system power balance state according to the power information.
Optionally, the making of the control strategy by the main controller according to the state information and the stability information by using a decision tree algorithm specifically includes:
constructing a decision tree by adopting a CART classification algorithm;
obtaining a decision tree training sample, and training the decision tree by adopting the training sample;
and according to the state information and the stability information, making a control strategy by utilizing the trained decision tree.
Optionally, the constructing a decision tree by using a CART classification algorithm specifically includes:
selecting an optimal partition attribute by using the minimum Gini index, and executing splitting operation to obtain a CART decision tree;
establishing a loss function, and finding an optimal pruning level of a decision tree through minimizing the loss function;
pruning the CART decision tree to the optimal pruning level.
Optionally, the performing, by the sub-controller, decentralized and coordinated control on the working unit according to the control policy specifically includes:
adjusting the state of the hybrid automata model according to the control strategy through the sub-controller;
and according to the adjusted hybrid automata model, performing coordination switching on the working modes of the working units corresponding to the sub-controllers.
Optionally, the performing, according to the adjusted hybrid automata model, coordinated switching of the working modes of the working units corresponding to the sub-controllers, and then further includes:
and performing master-slave control on the inverter of the working unit corresponding to the sub-controller by adopting a PQ control method or a V/f control method through the sub-controller.
Optionally, the performing, by the sub-controller, decentralized and coordinated control on the working unit according to the control strategy further includes:
and switching and controlling the working unit according to natural conditions through the sub-controller.
Optionally, the switching control of the working unit according to the natural condition through the sub-controller specifically includes:
presetting event trigger control logic under different natural conditions;
acquiring a current natural condition;
and performing switching control on the working unit according to the event trigger control logic and the current natural condition.
A micro-grid control system is a multi-agent system comprising a main controller and a plurality of sub-controllers;
the plurality of sub-controllers are connected with the plurality of working units in the micro-grid system in a one-to-one correspondence manner;
the plurality of sub-controllers are used for acquiring state information of each working unit and stability information of a bus node and sending the state information and the stability information to the main controller;
the main controller is used for making a control strategy by adopting a decision tree algorithm according to the state information and the stability information and sending the control strategy to the sub-controllers;
and the sub-controllers are also used for performing distributed coordination control on each working unit in the micro-grid system according to the control strategy.
According to the specific embodiment provided by the invention, the invention discloses the following technical effects:
the invention discloses a micro-grid control method and a system, wherein the control method is applied to a micro-grid control system, and the micro-grid control system is a multi-agent system comprising a main controller and a plurality of sub-controllers; firstly, acquiring state information of each working unit and stability information of a bus node through a sub-controller; a control strategy is made by the main controller according to the state information and the stability information by adopting a decision tree algorithm; and performing decentralized coordination control on the working units through the sub-controllers according to the control strategy. The invention is based on a multi-agent system, realizes that the main controller adopts a decision tree algorithm to formulate a control strategy, and the sub-controllers carry out decentralized coordination control on the working units according to the control strategy formulated by the main controller, thereby ensuring the power balance and voltage stability of the micro-grid system and realizing the safe and stable work of the micro-grid system operating in an isolated island.
Example 2
Embodiment 2 of the present invention provides a preferred implementation manner of a microgrid control method.
Step 101, acquiring the state information of each working unit through a plurality of sub-controllers specifically includes:
building a hybrid robot model representing status information of the work cell as shown in the following formula:
H1(D, L, F, S, F, Init); wherein D ═ { δ1,δ2,δ3…, representing a discrete state space set of work units; l represents a continuous state space set of work units; f ═ f1(δ1),f2(δ2),f3(δ3) …) represents the variation law of the continuous state space in the discrete state space; (S) ═ S1,S2,S3…) represents a mapping between a discrete state space and a continuous state space; f ═ F1,F2,F3…) represents conditions for state space transitions; for the discrete state spaces of the working units of a hybrid automaton model, when one discrete state space is activated, the discrete state space is defined as logic ' 1 ', and the other discrete state spaces are defined as logic ' 0". The initial state of the hybrid robot model of all the working units can thus be obtained:
a photovoltaic cell unit: d ═ δ1,δ2}=[1,0]。
A wind power generator unit: d ═ δ1,δ2,δ3}=[1,0,0]
A battery cell: d ═ δ1,δ2,δ3,δ4,δ5}=[1,0,0.0,0]。
A load cell: d ═ δ1,δ2}=[1,0]。
A fuel cell unit: d ═ δ1,δ2}=[0,1]。
Detecting discrete states and continuous states of the working unit;
and setting the hybrid robot model according to the discrete state and the continuous state of the working unit to obtain the state information of the working unit.
101, acquiring stability information of each working unit bus node through a plurality of sub-controllers, specifically including:
detecting voltage signals of bus nodes of each working unit and power information of each distributed power supply;
and determining a voltage safety index according to the voltage signal, and determining a system power balance state according to the power information.
The step of obtaining the voltage safety index comprises the following steps: obtaining an actual dynamic voltage value of the s bus of the microgrid by a wide-area signal measurement method, and extracting a voltage sequence as follows: v ═ Vi1,Vi2,…,ViN]TAnd obtaining the average value of the instantaneous voltage of the ith node at the jth moment as shown in the following formula:
the percentage of deviation of the instantaneous voltage value of the ith node at the jth moment from the average voltage value is calculated and expressed as:
in the formula (I), the compound is shown in the specification,
m and N represent the nth and mth times, respectively, for the instantaneous voltage value of the ith node at the jth time.
The voltage stability index at the jth moment of the ith node is shown as follows:
and defining the voltage stability index at the public connection point of the micro-grid and the large grid as U. Then, the voltage safety index U is divided into 7 continuous intervals: (0.8UO, 0.9UO ], (0.9UO, 0.95UO ], (0.95UO, 0.98UO ], (0.98UO, 1.02UO ], (1.02UO, 1.05UO ], (1.05UO, 1.1UO ], (1.1UO, 1.2UO ], wherein UO is a rated voltage value.
After the voltage stability indexes of the bus nodes are processed in a partitioning mode, each interval serves as a critical value of the working mode of each distributed power generation unit in the coordinated switching microgrid, and meanwhile, each interval can also serve as an attribute set of data to be linked with a subsequent decision tree algorithm to coordinate execution of a corresponding coordination control strategy.
102, making a control strategy by the main controller according to the state information and the stability information by using a decision tree algorithm, specifically comprising:
constructing a decision tree by adopting a CART classification algorithm; the method specifically comprises the following steps: selecting an optimal partition attribute by using the minimum Gini index, and executing splitting operation to obtain a CART decision tree; setting up a loss function, and finding the optimal pruning level of the decision tree by minimizing the loss function; pruning the CART decision tree to the optimal pruning level.
And obtaining a decision tree training sample, and training the decision tree by adopting the training sample.
And according to the state information and the stability information, making a control strategy by utilizing the trained decision tree.
Specifically, the decision tree algorithm is applied to a main controller, in the main controller, feature extraction is carried out on the working state of the micro-grid system and the working mode of a corresponding working unit in a physical layer, a feature set is built and combined to form a corresponding label set, and then the algorithm is trained through a training sample to generate a corresponding decision tree model. And then, the decision tree algorithm analyzes new characteristic data, obtains corresponding labels by executing a multi-classification problem, triggers corresponding events, determines a specific coordination switching control command in a certain working state, and sends out a command to control the coordination switching of the working modes of the working units. The implementation steps are as follows:
①, feature extraction:
on the other hand, the operation modes of the battery, the fuel cell, and the load are extracted as discrete attributes. On the other hand, considering that the stability of the operation of the micro-grid is the factor to be considered primarily, and the voltage safety evaluation index U and the state of charge SOC of the storage battery play a crucial role in evaluating the stability of the micro-grid, the U and the SOC are used as continuous attributes for feature extraction. In summary, the extracted attribute set of the features is { U, SOC, battery, fuel, load }. Wherein, for the continuous attribute: the voltage safety index U is divided into 7 consecutive intervals by the above-mentioned classification strategy: (0.8,0.9],(0.9,0.95],(0.95,0.98],(0.98,1.02],(1.02,1.05],(1.05,1.1],(1.1,1.2]The value range of 10% to 90% of the SOC index of the storage battery is divided into 5 continuous intervals: (10, 20],(20,40],(40,60],(60,80],(80,90]Wherein 10% and 90% are respectively the minimum allowable value SOC of the storage batteryminAnd maximum allowable value SOCmax(ii) a For discrete attributes: battery ═ 0, 1, 2}, where 0 denotes the charge mode, 1 denotes the discharge mode, and 2 denotes the shutdown mode. fuel is {0, 1}, where 0 denotes a rated output mode of the fuel cell,and 1 denotes a shutdown mode. load is {0, 1}, where 0 denotes a normal operation mode and 1 denotes a load shedding mode.
The set of labels is defined as y ═ y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y 15. The labels are divided into two types according to the switching times: the primary switching labels are { y1, y2, y4, y5, y7, y9, y11, y13 and y15}, and the secondary switching labels are { y3, y6, y8, y10, y12, y14}
② data collection and processing
For 7 levels with the attribute "voltage safety index U" divided, since the level section corresponding to each level is a continuity section and more data can be taken in each section, 7 levels are respectively defined as "VL", "ML", "L", "Z", "H", "MH", "VH" 7 attribute values from low to high. Similarly, the 5 levels of the attribute "SOC" can be defined from low to high as "VL", "L", "Z", "H", and "VH" 5 attribute values, respectively. Considering the complex working condition of the operation of a micro-grid island, 264 types of original data can be obtained after 2 continuous attributes 'U', 'SOC' and 3 discrete attributes 'battery', 'fuel' and 'load' are combined. After the continuous attributes are valued in the corresponding grade interval, 1056 pieces of data can be obtained as training samples.
(iii) decision tree algorithm
A decision tree is constructed by using a CART classification algorithm, namely a binary classification tree with a simple structure is constructed by using the CART algorithm, and the algorithm process is to start from a root node to carry out division, recursion and growth continuously until the decision tree meeting the requirements is obtained. When performing classification tasks, the CART algorithm uses "kini index" to select partition attributes. First, the "kini value" used to measure the purity of data set D is defined as:
in the formula, the probability that the sample subset belongs to the kth class is represented, and y is the number of classes.
The smaller Gini (D), the higher the purity of data set D.
Secondly, if the sample set D is divided into V parts according to whether the attribute a takes a certain possible value, the kini index of the attribute a is defined as:
where | D | represents the number of samples in set D, | DvAnd | represents the number of the v-th partial sample in the sample set D.
Then, in the candidate attribute set a, an attribute that minimizes the post-division kini index, i.e., a, is selected as the optimal division attribute*=argminGini-index(D,a),a∈A。
For the pruning operation of the decision tree, a 'minimum loss function' method is adopted for pruning. Setting the number of leaf nodes of decision tree as T, T as leaf node of tree, and setting N in the leaf node TtA number of sample points, where the class k sample points have NktK is 1, 2, …, K is empirical entropy at leaf node t, and a is more than or equal to 0 as parameter. The loss function is defined as:
wherein the empirical entropy is:
c is to beaAnd (T) taking the value of the (T) as a target to carry out minimization operation, thus obtaining a proper decision tree.
The CART algorithm can be obtained to construct the classification tree in the following steps:
1) and selecting the optimal division attribute by using the minimum index, and executing the splitting operation. And continuously and recursively executing the splitting operation until the splitting stopping condition is met, and generating a corresponding CART decision tree.
2) And pruning the decision tree. Setting up a loss function Ca(T) pruning the decision tree by minimizing it to find an optimal pruning level for the decision treeTo an optimal clipping level.
fourthly, constructing decision tree
The present invention utilizes MATLAB software to execute a decision tree algorithm. Firstly, using 1056 training samples to train a decision tree model; and then finding the optimal pruning level through a minimized loss function, and pruning the decision tree to the optimal pruning level. A decision tree with 89 nodes and 45 leaf nodes is generated and the decision tree model is shown in fig. 4. In the figure, [ x1, x2, x3, x4, and x5] respectively correspond to [ U, SOC, battle, fuel, load ] in the feature set.
The partial rules extracted from the generated decision tree model are explained as follows:
rule 1: if x1 is less than 1, x3 is more than or equal to 0.5, x2 is less than 20.5, x4 is less than 0.5, and x5 is less than 0.5, then label y1 is returned.
Rule 2: if x1 < 1, x3 < 0.5, x2 > 20.5, x2 < 51.5, x4 > 0.5, x1 < 0.905, then the label y6 is returned.
Rule 3: if x1 is greater than or equal to 1, x3 is less than 1.5, x2 is less than 75.5, x3 is greater than or equal to 0.5, and x2 is less than 46.5, then label y13 is returned.
Rule 4 if x1 is greater than or equal to 1, x3 is less than 1.5, x2 is greater than or equal to 75.5, x4 is less than 03, x5 is greater than or equal to 0.5, and x1 is less than 1.055, then the label y9 is returned.
Rule 5: if x1 is greater than or equal to 1, x3 is greater than or equal to 0.5, x2 is less than 79.5, x2 is greater than or equal to 53.5, and x4 is greater than or equal to 0.5, then label y15 is returned.
And (3) making a control strategy according to the decision tree: the control strategy is a coordinated switching control strategy which is mainly classified according to a label set of a decision tree algorithm, a specific control command is transmitted to a bottom agent (a sub-controller) by an upper agent (a main controller), and then the sub-controller controls each working unit to switch working modes; the specific content of the establishment of the coordinated switching control strategy is as follows:
according to the decision tree model, different label results can be obtained according to the classification results when the micro-grid faces different working states. Each label corresponds to different switching strategies, the following is a coordinated switching control strategy based on event trigger corresponding to each label, wherein Ey1~Ey15For each decision tree label corresponding trigger event, δijFor each bottom layerCertain discrete state space, t, of a hybrid automaton model of a working cellFijΔ t is the interval time for the duration of the trigger when a command is executed.
y1:P(y1)=Ey1(t)δ51(1(t-to)-1(t-to-tF51)).
y2:P(y2)=Ey2(t)[δ12(1(t-to)-1(t-to-tF12))+δ22(1(t-to)-1(t-to-tF25))+δ23(1(t-to)-1(t-to-tF26))+δ33(1(t-to)-1(t-to-tF33))+δ42(1(t-to)-1(t-to-tF42))].
y3:P(y3)=Ey3(t)δ41(1(t-to)-1(t-to-tF41))+Ey3(t+Δt)δ51(1(t-to-Δt)-1(t-to-Δt-tF51)).
y4:P(y4)=Ey4(t)δ41(1(t-to)-1(t-to-tF41)).
y5:P(y5)=Ey5(t)δ33(1(t-to)-1(t-to-tF33)).
y6:P(y6)=Ey6(t)δ33(1(t-to)-1(t-to-tF33))+Ey6(t+Δt)δ41(1(t-to-Δt)-1(t-to-Δt-tF41)).
y7:P(y7)=Ey7(t)δ31(1(t-to)-1(t-t0-tF31)).
y8:P(y8)=Ey8(t)δ31(1(t-to)-1(t-to-tF31))+Ey8(t+Δt)δ41(1(t-to-Δt)-1(t-to-Δt-tF41)).
y9:P(y9)=Ey9(t)δ42(1(t-to)-1(t-to-tF42)).
y10:P(y10)=Ey10(t)δ42(1(t-to)-1(t-to-tF42))+Ey10(t+Δt)δ52(1(t-to-Δt)-1(t-to-Δt-tF52)).
y11:P(y11)=Ey11(t)δ52(1(t-to)-1(t-to-tF52)).
y12:P(y12)=Ey12(t)832(1(t-to)-1(t-to-tF32))+Ey12(t+Δt)δ42(1(t-to-Δt)-1(t-to-Δt-tF42)).
y13:P(y13)=Ey13(t)δ32(1(t-to)-1(t-to-tF32)).
y14:P(y14)=Ey14(t)δ31(1(t-to)-1(t-to-tF34))+Ey14(t+Δt)δ42(1(t-to-Δt)-1(t-to-Δt-tF42)).
y15:P(y15)=Ey15(t)δ31(1(t-to)-1(t-to-tF34)).
According to the coordination switching control strategy, on one hand, the total switching times of the working modes of all the working units are limited to at most two times, so that the switching times are reduced, and the stable operation of a system is facilitated; on the other hand, abundant label sets represent enough control commands, and the flexibility of the system in coping with different working conditions is improved. In addition, the working condition of the micro-grid system is analyzed through a decision tree algorithm, and the event triggering condition is judged, so that the execution efficiency of the coordinated switching control command and the intelligent level of the system are improved.
103, performing decentralized coordination control on the working unit through the sub-controllers according to the control strategy, specifically including: and according to the control strategy, under the control of the sub-controllers at the bottom layer, the coordination switching of the working modes of the working units is realized through the state transition of the hybrid automatic machine model. Further, adjusting the state of the hybrid automatic machine model according to the control strategy through the sub-controller; and according to the adjusted hybrid automata model, performing coordination switching on the working modes of the working units corresponding to the sub-controllers.
And the coordination switching of the working modes of the working units corresponding to the sub-controllers is performed according to the adjusted hybrid automata model, and then the method further comprises the following steps: and performing master-slave control on the inverter of the working unit corresponding to the sub-controller by adopting a PQ control method or a V/f control method through the sub-controller.
Specifically, a distributed dynamic control strategy is constructed according to the control strategy, namely, according to a master-slave control method adopted by a micro-grid in an island mode, an energy storage unit model is used as a master control unit, and a V/f control algorithm is adopted; the photovoltaic cell, the fan and the fuel cell are used as slave control units, and a PQ control algorithm is adopted.
For the V/f control algorithm, as shown in fig. 5, two links can be divided: the external power reference value forms a link and an internal power control link. In the external link, the system frequency f and the reference frequency f output by the phase-locked looprefBy comparison, an active power reference signal P is formed by a PI regulatorref(ii) a Voltage U and reference voltage UrefBy comparison, a reactive power reference signal Q is formed by a PI regulatorref。PrefAnd QrefRespectively with the average power PfiltAnd QfiltComparing, and performing PI control on the obtained error in an internal power control link to obtain a reference signal l of the inner loop current controllerdrefAnd lqref。
For the PQ control algorithm, in FIG. 6, the three-phase instantaneous voltage u is measuredabcAnd three-phase instantaneous value current iabcAfter park transformation, dq axis component u is obtainedd、uq、id、iqThe instantaneous power P is obtained by power calculationgrid、Qgrid,PgridAnd QgridThe average power P is obtained after passing through a low-pass filterfiltAnd QfiltThen with the given reference signal PrefAnd QrefComparing and carrying out PI control on the error so as to obtain a reference signal i of the inner loop current controllerdrefAnd iqref. When the power output by the inverter is not equal to the reference power, the error signal is not zero, so that the PI regulator carries out non-static tracking regulation until the error signal is zero, the controller reaches a steady state, and the power output by the inverter is recovered to the reference power.
Optionally, the performing, by the sub-controller, decentralized and coordinated control on the working unit according to the control strategy further includes:
and switching and controlling the working unit according to natural conditions through the sub-controller.
Optionally, the switching control of the working unit according to the natural condition through the sub-controller specifically includes:
presetting event trigger control logic under different natural conditions; specifically, the switching control of the working unit is performed by the sub-controller according to the natural condition, and the natural condition triggering switching control strategy belongs to a distributed control strategy, and means that certain indexes are used as the natural condition, so that the switching of the working mode of the power generation unit is controlled through condition change. The construction of the natural condition trigger switching control strategy specifically comprises the following contents: the control logic based on event triggering, namely natural condition switching control, is designed by taking the illumination intensity, the wind speed and the SOC value as natural conditions. When the natural condition changes, the transfer condition is met, and a corresponding event is triggered, namely logic '1' occurs, the hybrid automatic machine models corresponding to the photovoltaic cell, the fan and the storage battery can switch the working modes.
For photovoltaic cells, the control logic based on natural switching conditions is as follows, where G (t) is the instantaneous light intensity, C is the light intensity threshold, E1iFor a corresponding triggering event, δ, of the photovoltaic cell1iDiscrete state space, t, for a hybrid automaton model of a photovoltaic cell unitF1iTrigger duration when a certain command is executed for the photovoltaic cell:
when t is equal to toIf G (t) is not less than C, then I (E)11)=E11(t)δ11(1(t-to)-1(t-to-tF11)).
When t is equal to toIf G (t) < C, then I (E)12)=E12(t)δ12(1(t-to)-1(t-to-tF12)).
For the fan unit, the control logic based on natural switching conditions is as follows, where V (t) is the instantaneous wind speed, VciFor cutting into wind speed, VcoFor cutting out wind speed, VrRated wind speed, E2iFor a corresponding triggering event, δ, of a fan unit2iDiscrete state space, t, for a hybrid automaton model of a fan unitF2iTrigger duration for the fan unit when executing a certain command:
when t is equal to t0If V (t) rises to Vr>V(t)≥VciAnd then:
I(E21)=E21(t)δ21(1(t-to)-1(t-to-tF21))。
when t is equal to t0If V (t) rises to Vco>V(t)≥VrAnd then:
I(E22)=E22(t)δ21(1(t-to)-1(t-to-tF22))and
I(E23)=E23(t)δ22(1(t-to)-1(t-to-tF23))。
when t is equal to t0If V (t) falls to Vr>V(t)≥VciAnd then:
I(E24)=E24(t)δ23(1(t-to)-1(t-to-tF24))。
when t is equal to t0If V (t) falls to VciV (t), then:
I(E25)=E25(t)δ22(1(t-to)-1(t-to-tF25))。
when t is equal to t0If V (t) rises to V (t) ≥ VcoAnd then:
I(E26)=E26(t)δ23(1(t-to)-1(t-to-tF26))。
when t is equal to t0If V (t) falls to Vr>V(t)≥VciAnd then:
I(E27)=E27(t)δ21(1(t-to)-1(t-to-tF27))。
when t is equal to t0If V (t) falls to Vco>V(t)≥VrAnd then:
I(E28)=E28(t)δ21(1(t-to)-1(t-to-tF28))。
for the battery cell, the control logic based on natural switching conditions is as follows, where SOC (t) is the value of the battery's instantaneous state of charge, SOCminAt minimum state of charge, SOCmaxMaximum state of charge allowed value, E3iFor a corresponding triggering event, δ, of the battery cell3iDiscrete state space, t, for battery cell hybrid automaton modelF3iTrigger duration for the battery cell when executing a certain command:
when t is equal to t0If SOC (t) drops to SOCminSOC (t) is more than or equal to:
I(E31)=E31(t)δ32(1(t-to)-1(t-to-tF39))。
when t is equal to t0If SOC (t) rises to SOCmaxSOC (t), then:
I(E32)=E32(t)δ33(1(t-to)-1(t-to-tF40))。
acquiring a current natural condition;
and switching and controlling the working unit according to the event trigger control logic and the current natural condition, so that the switching of the working mode of the power generation unit is controlled through the change of the natural condition.