$30
I want this!

EV Fleet Charging Management and V2G Planning (MATLAB, IEEE-33 Bus)

$30

A complete, ready-to-run MATLAB project that optimizes EV fleet smart charging and Vehicle-to-Grid (V2G) dispatch on the IEEE-33 Bus radial distribution network. The scheduler uses linear programming (linprog) with LinDistFlow voltage constraints built from BIBC/BCBV matrices and validates results using a backward/forward sweep (BFS) load flow. No genetic algorithms are used.

Highlights

  • Network-aware EV scheduling with voltage limits (0.95–1.05 pu)
  • V2G-enabled: buy low/sell high under TOU pricing
  • Soft voltage slacks to avoid infeasibility, with penalties in the objective
  • Full feeder validation via BFS load flow (voltages and losses)
  • Clear plots and command-window tables for quick interpretation


What’s included

  • EV_V2G_IEEE33_main.m
    • Main driver script
    • Builds network and load profiles, defines EV fleet and availability (home/work), TOU price
    • Calls the LP optimizer, runs BFS validation, prints summaries, and generates figures
    • Outputs: energy bought/sold, net energy cost, EV SoC compliance, per-bus energy, worst-bus voltage/time, losses
  • build_ieee33_data.m
    • Provides IEEE-33 bus (Baran–Wu) feeder data
    • Line parameters in ohms, static P/Q loads per bus, bases (Vbase=12.66 kV, Sbase=100 MVA)
    • Returns clean, ready-to-use arrays for the rest of the scripts
    • make_BIBC_BCBV.m
      • Constructs BIBC (branch current mapping) and BCBV (bus voltage from branch currents) matrices for radial feeders
      • Computes per-unit branch impedances from ohmic data and base values
      • Handles parent/child relationships along the feeder to assemble path matrices
    • bfs_loadflow.m
      • Backward/Forward Sweep load flow for radial distribution systems
      • Computes complex bus voltages and total real power loss
      • Used hourly to validate the optimization results (voltages and losses)
    • schedule_ev_lp.m
      • Builds and solves the linear program with linprog (dual-simplex)
      • Decision variables: EV charge pch(i,t), discharge pdch(i,t), and optional voltage slack variables
      • Enforces:
        • Availability and power limits per EV (e.g., 7.2 kW L2, symmetric V2G)
        • SoC dynamics with efficiencies, capacity bounds, and target at last-available time
        • LinDistFlow voltage constraints via BIBC/BCBV sensitivities (soft bounds with penalties)
      • Returns schedules, voltage slack usage, and energy cost
      • System requirements
        • MATLAB R2020a or newer
        • Optimization Toolbox (linprog)
        • Windows/macOS/Linux, 8 GB RAM recommended
        How to run
        1. Place all .m files in one folder
        2. Open EV_V2G_IEEE33_main.m
        3. Press Run (reproducible via rng(42))
        4. View results in the command window and figures pop-up
        Key features and modeling choices
        • Network: IEEE-33 Bus radial feeder, per-unit conversion from 12.66 kV, 100 MVA base
        • Voltage model: LinDistFlow using S_P and S_Q sensitivities from BIBC/BCBV
        • EV fleet: Bus mapping to selected PQ buses; availability patterns (70% home nights, 30% workdays)
        • Power/energy: 7.2 kW charge/discharge per EV; ηch=ηdch=0.92; Ecap 50–70 kWh; target SoC = 80%
        • Pricing: 24-hour TOU tariff; easily editable
        • V2G: Discharging earns revenue (negative cost in objective)
        • Validation: BFS load flow per hour for voltages and feeder losses
        • No genetic algorithms: deterministic convex optimization with linprog
        Customization points
        • N_EV (number of EVs) and candidate_buses (connection buses)
        • Charging power limits, efficiencies, capacities, initial SoC ranges
        • Availability windows (home/work or custom patterns)
        • Voltage limits (Vmin/Vmax), soft slack penalty (lambda_v) and cap (vslack_max)
        • TOU price vector, time step dt, horizon T, and load shape loadMult
        • Replace IEEE-33 with your own feeder by editing build_ieee33_data.m
        Outputs and visuals
        • Command-window tables:
          • Energy bought/sold, net energy, total cost
          • EV SoC target compliance
          • Per-bus EV charge/discharge energy
          • Worst bus voltage and hour; losses summary
        • Figures:
          • TOU price vs. net EV power (charge/V2G)
          • Voltage profile at worst hour with Vmin line
          • Minimum bus voltage over time
          • Stacked bar of EV energy by bus
        Who is this for?
        • Researchers and students studying smart charging, V2G, and distribution networks
        • Utilities and aggregators exploring feeder-aware EV scheduling
        • Educators looking for a clean LP-based case study with power-flow validation
        Keywords
        MATLAB, EV charging, V2G, Vehicle-to-Grid, IEEE-33 bus, Baran–Wu, radial distribution network, LinDistFlow, BIBC, BCBV, linear programming, linprog, Optimization Toolbox, BFS load flow, TOU pricing, SoC management, distribution planning, smart grid, power systems, feeder constraints
I want this!
Size
32.6 KB
Powered by