Memuat
Memuat
Want to go deeper?
Join one of our courses or ask us directly on WhatsApp.
Picked from the software, topic, and level of “Class Optimasi Distributed Generation PSO-GWO #3: Objective Function & Constraints: Power Loss, Voltage, and DG Capacity”.
Other ways we can help with Python.
Learn with a mentor
Scheduled Simulation & Engineering courses with live guidance and a certificate.

Course/Training Ansys ~ Heat Transfer and Heat Flux Analysis
★ 5.0 (10)

Course/Training MATLAB — MATLAB App Design: The Ultimate Guide to MATLAB Apps
★ 5.0 (10)

Course/Training Ansys — Airflow Simulation of a Car Radiator with ANSYS
★ 5.0 (9)
Have it built for you
No time to learn Python? Our team can do the project for you.

Matlab Development Service — Complete Neural Signal Processing and Analysis Zero to Hero
★ 5.0 (59)

Ansys Maxwell Development Service
★ 5.0 (50)

Petrel Development Service
★ 5.0 (14)
Get notified about new Python classes
At most one email a week. Unfollow anytime with one click.
The full narration of this video. The current sentence is highlighted while the video plays; click any sentence to jump there.
Here is the final result, the impact of location and size of 1 DG on power loss. The best location depends on its size, and a DG that is too large actually increases power loss again. We also formulated the objective function that will be optimized by PSO and Gray Wolf. Let's start. Hello, welcome to episode three of the Optimasi Distributed Generation series. Before using an optimization algorithm, we must clearly formulate the problem. What is being sought, what is to be minimized, and what constraints must be satisfied. Today we write the objective function for 3 DG and see directly why this problem cannot be solved by trial and error.
Create file objective.py We are looking for 3 DG, so the solution factors have 6 numbers, 3 bus numbers and 3 power values in megawatts. The constraints are, buses 2 to 33, each DG power 0 to 2 megawatts, total DG should not exceed total load, and voltage must be between 0.95 and 1.05 per unit. The function rounds the bus number because the algorithm works with continuous numbers. The objective function is power loss divided by base case loss, plus penalty if voltage is out of bounds, there are duplicate buses, or total DG is excessive.
Create file sensitivity.py First we place 1 DG 1 megawatt at each bus, then repeat with the best size at each bus. Run. With 1 megawatt, the best location is at bus 30. But if the size is also optimized, the best location moves to bus 6 with 2.6 megawatts, and loss drops to about 104 kilowatts. This means location and size are interdependent and must be optimized together. And a 5 megawatt DG at bus 6 actually increases loss again to 180 kilowatts, because power flows back to the substation.
Now we test the objective function on 3 solutions. A random solution gets a value of 4.1 because its voltage violates the limits. A manual solution at buses 14, 24, and 30 gets 0.35, meaning loss is reduced to 35 percent. A solution with duplicate buses gets a penalty of 1. The left graph compares power loss for each location, and the right graph shows a U-shaped curve between DG size and power loss. For 3 DGs, the search space consists of tens of thousands of bus combinations multiplied by continuous size. Therefore, we need a metaheuristic algorithm.
Done. We have formulated the solution factors for 3 DGs, the objective function with penalty constraints, and observed that the location and size of DGs are interdependent. In the next episode, we will write the Particle Swarm Optimization and Gray Wolf Optimizer from scratch. Currently working on a thesis, dissertation, or research in the field of power systems and renewable energy? Cerdas Inovasi Digital helps implement power system optimization, from backward forward sweep power flow, placement and capacity of distributed generation, PSO, Gray Wolf Optimizer, up to hybrid algorithms, and also opens Python programming courses for electrical engineering. Want to master the entire series, from IEEE 33 bus data to algorithm comparison analysis? All 6 episodes, complete with PDF step-by-step guides and source code, are available to premium tutorial subscribers. Subscribe starting at Rp69.000 per month, save 28% with the 12-month package, or pay once Rp999.000 for lifetime access. Want just one class? Buy a single class with lifetime access. Subscribe now on the premium page at cerdasinovasidigital.com. Contact us via WhatsApp, or visit cerdasinovasidigital.com. Thank you for watching, see you in the next episode.
Type a question or keyword; we find the part of this episode that explains it and jump the video there.
Notes are saved with the current video time and are only visible to you.
Stuck on a step? Ask here; the instructor and other learners can answer.
No questions yet.

Cerdas Inovasi Digital Team
Software developers, BIM & 3D engineers, and AI practitioners
We build software, BIM models, games and AI automations for clients every day, and turn that hands-on work into step-by-step classes: every step is shown on screen and comes with a PDF guide you can keep.
See our clients →