Unit Commitment and Economic Dispatch - UC & ED by Salp Swarm Algorithm (SSA) MATLAB Code

 Hello, brothers, so we want to explain the code of, SSA for, unit commitment and economic dispatch. So the first thing is to, uh, the, the function. will, indentify some parameters like, initial, t on, initial t off as you see here, there is the first two generate on, and the other is off, and this is the initial t of time.

unit outages time. So, the other, eight , units is off and, this is the minimum, uh, minimum down and minimum uptime allowed for to continuous, boot time or continuous shutdown time. And this is the initial stage for each generation. As you see here, the first two generation is on in the first of this period.

And the period is for 24 hours. And after that, we define the power max for each generation and, power minimum for each generation. And then we define the, the power demand for 24 hours. And after that we calculated the spinning reserve and then, we define the, the wind power of this file and define the velocity V cutt on cutt off, and the normal velocity and power, uh, rated power, And after that, we calculated, uh, for 24 hours the profile of wind from here.

As you see here, this is profile for wind. And after that, we calculated the net load that went from unit to economic dispatch and unit commitments by, uh, subtract between the load of the system minus the power from the wind. And after that, we defined a and b for each generation. For eight generation. And also the conversion factor emission factors, a1, b1 and c1 and, start up costs at what condition and startup costs, at cold condition.

And after that we defined that when the unit is, to be cold or hot. And after that we, as you see here, we defined the maximum iteration and the sending or descending the power, maximum. that means we defined, the power maximum, from the maximum to the minimums. And, it identifies some other parameters for SSA.

Learn more about the unit commitment and economic dispatch MATLAB code here. 

uc and ed matlab code


And after that, from here, we will initialize the, particles number of particles, feasible particles. These are initialize randomly, as you see here, the initial of the swarm here, the swarm initialization from the initial, function. And then we calculated if the function verify. And after that, we calculated that, uh, fitness or object function, and calculated of coast of generation.

As you see, we will explain deeply in this. But first we defined the, the initial is, to initial state for each generation for 24 hours. This is the function of initial. The swarm is the initial for each generation for 24 hours. And then we enter the, the swarm 1, to verify function, to check on, the load is covered by generation.

Or if you, the generation is more than load or the load is more than generation. And after that we also check on the minimum upper and minimum down time for each generation and verify that if the swarm is okay. so we put it in the, the swarm. here. but if not, okay, we will make some, modification.

And after that, the swarm, gets it from verify function. We put it in the object function to calculate the fitness. And after that, after calculating the fitness for each particles or for each swarms, we now compare, as you see here, we compare between the, swarms, to get the best or food, position and food fitness, the leader fitness and leader position.

So this is, we compare between all particles, swarm to get the best one dependent on the fitness function, that this is the particle which has, the minimum fitness values, and these values will be lead all other, particles in the next system, and after that, we, display, the best food fitness, on the command windows.

And after that from here we will start the code of SSA optimization that will be explained in the, and next video.

This is the second video to explain this SSA, optimization function for unit commitments. And after that, as you see here, we started from here by iteration, dependent on the maximum iteration of the SSA optimization. The first thing is to calculate C1 C2, C3 As you see here, this is from the SSA algorithm.

So the constant one dependent on the current iteration and the maximum iteration. And we calculated C1 and the C2 and C3 is a random variable and random numbers. If the C2 if the C3 is less than a point five. So the function the new position of the swarm is the best position we we got it from the initial state plus C1 multiply C2 if the C3 is more than 0.5, the the real or the position.

The new position is the food position minus C1 multiplied C2. And after that we compared between the new position and the random variable to get it. A new position for each generation for 24 hour as you see here. This is after that for each generation, for 24 hours. As you see here, this is the new position.

Now we get it's the new position for the swamrs and after that, we, as you see here, get this swarm that we get it from here on that a verify function, as you see, to to check on the a minimum and maximum down time and the minimum uptime and the load is covered by the generation.

And after that we get to the new. And after that we get this worm and put it in the object fitness function and calculate the fitness and compare with the leader fitness. If the fitness, the new fitness is less than the leaders. So this is the fitness or the swam will be the leaders if not we, we the leaders will be the same.

and this is for if the iteration, as you see here, less than 15, if the iteration is more than 15, and we get another function, another function to get the new position of the follower slap, as you see here, the follower slap is point five multiplied by swarm, the current swarm and the previous one.

So this is and get it, the new position for the swarm and compared with the random and get it to the X and to get it the state for each generation for 24 hours for the new swarms. And after that we store in the swarm and put it in the verify to get to test the feasibility of the, this a swarm and get it.

the new swarm. If we make some change and some condition does not, happen or, verify. And after that we put this a swarm in the object's function and, calculate the fitness. And compared with the leaders, if their fitness is less than the leaders, fitness. So the new swarm is this. This is the leader position, and the new fitness is the leader fitness.

And this is stage. This is the procedure repeated for, for all the swarms. And after that we calculated with the leaders, with the food fitness. If the leader’s fitness, is this more than, or less than the food fitness or food position. So the leader will be the food position and the leader fitness will be food fitness.

And after that, repeated for all swarms as you see here. And then we display on the command window, in the command window the best food fitness values, and repeated that for maximum iteration and that will be defined in, the first of the program. And this is the finish of the, the iteration and the function of, uh, main function of SSA.

And after that we will start with that to display the result that calculated the result that will be explained in that video Three. 

 Hello, brother. This is the third videos for, explanation of SSA optimization functions. So after we get to the value of the state of each generation for 24 hours now, we will start to calculated, the all result from here.

As you see here, we defined some, uh, initially state type of optimization as you see here, Uh, the type of optimization for economic dispatch and display of all of our warning or anything. And after that, we initialization the fuel cost and the emission cost and then, fuel cost for 24 hours and the emission cost for 24 hours.

And after that, we will start to calculate the H and C and the AeQ that dependent on the state of food fitness the H is dependent on the C factor for each generation, and that will be used in the economic dispatch and the C also dependent on the B for each units and, the state of that generation unit and use it in the economic, dispatch and after that we will define the, maximum minimum and maximum generation and define the, uh, and, and define the load power demand also and the initial for each generation from where it started.

, in the economic dispatch. And after that, we will use quadprog to calculated the economic dispatch dependent on the H and C and the load power minimum maximum initial power and the option and type of optimization. And after that, we get that value of power and the storage in the G bests, the value of power from each generation multiplied by the state of that generation.

And after that, we calculated the, the, uh, fuel, the accumulated the fuel cost and the emission cost and the fuel cost and the emission cost for 24 hours. And after that we start to display the power from each units for 24 hours and the power from the wind. As you see here, this is the generation from economic dispatch.

And after this is displayed here, and then we display also fuel costs, emission cost and the startup cost and the total cost, and after that, we start to plot as you see here, plot the converging curve for this optimization SSA. And then we also plots for each generation, unit the generation in each hours.

and after that we plot the cost in each hour and the emission of each hour. And then we end this the main function 

 in the next video, uh, videos. We will explain the sub title sub function in this program. 

 This is the the video of to calculate to explain the sub, function in the SSA function.

The first function is the initial, the initial. This is, as you see here the x, we initialized, the x by one for 24 hours for each generation. And after that we uh, multiply the random and multiply by one for 24 hours for each generation divided by P and this is random. And after that we compare between the STF that we calculated here and the the random number and put it in the X as the initial states and therefore the verify as you see here, this is function, this is function for minimum down correction as you see here.

And this is the reserve constraint correction if we need and uh, if this is for uh, if you need to increase the power from generation and or decommitment constraint correction, if you want to decrease the object function, we will uh, uh, concentrated as the same of the results. We, uh, the object function we have input the state of each generation that will, uh, defined as a unit commitment.

So SSA will define the unit commitment. And after that the program is calculated the economic dispatch. So in the object function, the X that mean the unit commitment uh, states for each generation and the number of generations, the number of times the initial for the generation minimum downtime, maximum power and minimum power power demand A and B and C for generation and the start up hot and cold uh, anti cold and t off and all the, uh, convergence factor of the emission also.

So as explained in the first video, this is X, this is the states of each generation that uh, defined the unit commitments. The SSA will define this x zero or one. So the zero mean the unit is off and one is means the unit is on and this is, how do you say this is explained or uh, defined as a unit commitment.

This is a relation between SSA as, SSA will try to optimize this X and after that all thing is the same thing to calculate the economic dispatch, as we explained before and uh, calculated the startup cost and after that the F object is the sum of uh, the startup cost, fuel cost, emission cost all in the object functions.

Uh, this is dependent on the, uh, or the weight factors if we want. So, uh, as you see here, SSA, will optimize the value of swarms that swarms is as you see here, if you run the program, we will define like this. This is one, for 240 state, and this is, dependent on the number of generation because the number of generation is ten and then 24 hours.

So we have 240 state for each generation. And uh, for the first hour, as you, if you open, uh, the x, the first ten state is for the ten generation, for the first one and the second, uh, ten uh, for 20. This is the second hour for, uh, each generation, the state of each generation and so on for 24 hours.

So the SSA is optimized, the state of generation for each hours, I hope. Uh, and after that we calculated, as you see, calculated the, uh, emission cost and the fuel cost and economic dispatch Because when we defined the as you see here, we defined the, the value of X is the, uh, the generic unit generation is on.

So we calculate the emission and the fuel cost, if not, will be zero. Uh, and after that, this is the unit, the unit which on is included in the economic dispatch and the off is excluded from the economic dispatch. And after that we calculated the fuel cost and the emission cost for each hours and the summit, in the final of object function to calculate or find the total cost for 24 hours and the start up cost and the emission cost for 24 hours.

And dependent on this, the values, uh, the function, SSA will try to minimize this all the variables minimize the start up cost, to minimize the fuel cost and minimize the, uh, emission cost. This is will be the, uh, finally Dios. And I hope we understand us. So if you want to any of, if you have any question, we are happy to answer you.

Good By.


Comments

Popular posts from this blog

Grid New 33 Bus PV Wind - STATCOM MATLAB Simulation

UniRouter Airdrop: Bridging Bitcoin and EVM Assets