| name | automotive-charging |
| description | Expert skill in 800V EV platform architecture design, covering SiC power electronics, ultra-fast charging (250-350 kW), backward compatibility with 400V infrastructure, and efficiency advantages. Covers 20 topics across charging-infrastructure domain. Includes 20 skill files covering ANSI C84.1 Voltage ratings for electric power systems, CHAdeMO 1.0/1.2 (up to 62.5 kW), CHAdeMO 2.0 (up to 400 kW), CHAdeMO 2.0/3.0 CAN-based protocol, CHAdeMO 3.0 (up to 900 kW with ChaoJi), CISPR 11 EMC limits for wireless charging systems, CISPR 25 Limits for conducted/radiated EMI in vehicles, CharIN MCS specification and more.
|
| tags | ["800v-platform","adapter","automotive","automotive-charging-infrastructure","backup-power","billing","cable-cooling","camping","can-bus","ccs","chademo","charging-infrastructure","china","contactors","control-systems","dc-fast-charging","demand-response","depot-charging","derating","emc","emsp","evse","exi","firmware","gb-t","gfci","grid-impact","hardware-design","harmonics","heavy-duty","high-voltage","iec-61851","inductive-coupling","insulation-monitoring","inverter","islanding","iso-15118","liquid-cooling","llc","load-balancing","load-management","mcs","megawatt-charging","metering","nacs","ocpi","onboard-charger","optimization","payment-processing","pfc","pi-controller","pki","plc","plug-and-charge","portable-power","power-electronics","power-quality","renewable-energy","roaming","sae-j2954","sae-j3400","safety","safety-standards","sic-mosfet","smart-charging","tesla","thermal-management","tls","transformer-loading","ul-2594","ultra-fast-charging","v2g","v2h","v2l","vehicle-to-home","vehicle-to-load","voltage-drop","wireless-charging","wpt"] |
Automotive Charging Infrastructure
20 skill files covering charging-infrastructure domain for automotive software engineering.
Applicable Standards
- ANSI C84.1 Voltage ratings for electric power systems
- CHAdeMO 1.0/1.2 (up to 62.5 kW)
- CHAdeMO 2.0 (up to 400 kW)
- CHAdeMO 2.0/3.0 CAN-based protocol
- CHAdeMO 3.0 (up to 900 kW with ChaoJi)
- CISPR 11 EMC limits for wireless charging systems
- CISPR 25 Limits for conducted/radiated EMI in vehicles
- CharIN MCS specification
- GB/T 18487.1 Safety requirements for conductive charging
- GB/T 20234.1 General requirements for EV conductive charging
- GB/T 20234.2 AC charging connector (similar to IEC 62196-2)
- GB/T 20234.3 DC charging connector
- GB/T 27930 Communication protocol between EV and off-board charger
- GDPR for user data privacy (EU)
- IEC 60352-2 Solderless connections (for cooled pins)
- IEC 60364-7-722 Low-voltage installations for EV charging
- IEC 60664-1 Insulation coordination for 800V systems
- IEC 60884-1 Plugs and socket-outlets for household use
- IEC 61000-3-2 Harmonic current emission limits
- IEC 61000-6-2 Immunity for industrial environments
- IEC 61850 Power utility automation
- IEC 61851-1 AC charging requirements
- IEC 61851-1 EV conductive charging (AC)
- IEC 61851-1 EV conductive charging (safety requirements)
- IEC 61851-1 EV conductive charging systems (general requirements)
- IEC 61851-1 Load management for EV charging
- IEC 61851-21/22/23 Electric vehicle on-board charger and charging station requirements
- IEC 61851-21/22/23/24 AC and DC charging safety specifications
- IEC 61851-23 DC EV charging
- IEC 61851-23 DC EV charging (high-power extension)
- IEC 61851-23 DC EV charging station
- IEC 61851-23 DC EV charging station requirements
- IEC 61851-23 DC charging requirements
- IEC 61851-23 DC charging up to 1000V
- IEC 61851-24 Digital communication
- IEC 61851-24 Digital communication between EV and EVSE
- IEC 61980-1 Wireless Power Transfer (WPT) systems for EVs
- IEC 62052 Electricity metering equipment
- IEC 62196-3 Type 2 connector (CCS Type 2 base)
- IEC 62893 Charging cables for EVs (liquid cooling)
- IEC 62893 Charging cables for bidirectional power
- IEC 62893 Charging cables for electric vehicles
- IEEE 1547 Distributed energy resources interconnection
- IEEE 1547 Interconnection of distributed energy resources
- IEEE 2030 Smart grid interoperability
- IEEE 2030.1.1 Smart grid integration for EV fleets
- IEEE 2030.1.1 Smart grid integration for EVs
- IEEE 2030.1.1 V2G communication protocols
- IEEE 519 Harmonic limits for electrical power systems
- ISO 15118 Communication for 800V charging
- ISO 15118 Plug & Charge (future NACS support)
- ISO 15118 Plug & Charge for certificate-based billing
- ISO 15118 Smart charging profiles and schedules
- ISO 15118-1 General information and requirements
- ISO 15118-2 Communication protocol (V2G)
- ISO 15118-2 Network and application protocol (EV-EVSE)
- ISO 15118-2 V2G communication protocol
- ISO 15118-20 AC/DC charging with bidirectional power transfer
- ISO 15118-20 Bidirectional power transfer
- ISO 15118-20 Vehicle-to-Grid (V2G) for MCS
- ISO 15118-20 Vehicle-to-Grid for fleet applications
- ISO 15118-3 Physical and data link layer (PLC)
- ISO 17409 EV conductive charging safety requirements
- ISO 19363 Magnetic field wireless power transfer (safety)
- ISO 7637-2 Electrical disturbances by conduction
- JIS D 4001 Japanese automotive standards
- NFPA 70 (NEC) Article 551 Recreational vehicles
- NFPA 70 (NEC) Article 702 Optional standby systems
- OCPI 2.2.1 (Open Charge Point Interface) for roaming
- OCPP 2.0.1 Smart charging and load management
- OCPP 2.0.1 for EVSE to central system communication
- OpenADR 2.0b Automated demand response
- OpenADR 2.0b Demand response for fleet depots
- PCI DSS for payment card data security
- RFC 5246 TLS 1.2 (minimum version for Plug & Charge)
- RFC 5280 X.509 certificates for PKI
- SAE J1772 AC Level 1/Level 2 charging
- SAE J1772 AC charging connector and control pilot
- SAE J1772 AC connector (CCS Type 1 base)
- SAE J1772 Connector temperature limits
- SAE J1772 Control pilot signaling
- SAE J1772 Safety requirements for AC charging
- SAE J2954 Wireless Power Transfer for Light-Duty EVs
- SAE J2954 Wireless charging for autonomous fleets
- SAE J3068 High-power conductive charging (350 kW+)
- SAE J3072 V2L communication and control
- SAE J3271 Megawatt Charging System (MCS)
- SAE J3400 NACS connector specification (2024)
- UL 1008 Automatic transfer switches
- UL 1741 SA Inverters for distributed generation
- UL 1741 SA Inverters for grid support
- UL 2089 Vehicle battery adapters
- UL 2202 / UL 2594 EV charging system safety
- UL 2202 EV charging system safety
- UL 2202 Safety for high-voltage EV charging systems
- UL 2251 Plugs, receptacles, and couplers for EV charging
- UL 2594 / UL 2202 Electric vehicle charging system equipment
- UL 2750 Wireless charging equipment safety
Use Cases
- 800V platform EV design (Porsche Taycan, Hyundai Ioniq 5, Kia EV6)
- SiC (Silicon Carbide) inverter and OBC design for 800V
- 250-350 kW ultra-fast charging implementation
- 400V to 800V boost converter for backward compatibility
- High-efficiency powertrain (motor inverter, DC-DC, OBC)
- Onboard charger design for EVs (3.3 kW to 22 kW)
- Power factor correction (PFC) topology selection and design
- LLC resonant converter for high-efficiency DC-DC conversion
- EMC compliance (conducted and radiated emissions)
- Bidirectional OBC for V2G capability
- eMSP platform development (mobile app, billing backend)
- CPO (Charge Point Operator) network management
- OCPI roaming implementation for cross-network charging
- Tariff and pricing strategy design
- Payment gateway integration (Stripe, PayPal, credit cards)
- DC fast charging station development
- CCS controller firmware implementation
- PLC-HPGP (HomePlug Green PHY) communication stack
- Power delivery control and safety monitoring
- ISO 15118 high-level communication integration
Topics Covered
Bidirectional Charging
- v2g-vehicle-to-grid
- v2h-vehicle-to-home
- v2l-vehicle-to-load
Business Operations
Communication Protocol
- iso-15118-plug-and-charge
Dc Fast Charging
- ccs-combo-charging
- chademo-protocol
- gb-t-charging
- nacs-tesla-standard
Energy Management
- smart-charging-algorithms
Grid Integration
Hardware Design
- charging-station-architecture
Heavy Duty Charging
Power Electronics
Safety Compliance
- charging-safety-standards
Thermal Systems
- charging-thermal-management
Wireless Power Transfer
Constraints
- $30K-150K depending on power level)
- 5-10 kg, 5-10 liters)
- ADC noise and offset (require filtering and calibration)
- Adapter complexity for ISO 15118 to Tesla CAN translation
- Alignment sensitivity (user frustration if hard to position)
- Automotive temperature range (-40°C to +105°C ambient)
- Battery degradation from aggressive V2G cycling
- Battery degradation from cycling (need compensation or battery warranty)
- Battery degradation from cycling (though minimal for occasional V2L use)
- CAN-based protocol slower than PLC-based ISO 15118 (100 ms vs 10 ms latency)
- Cable resistance voltage drop at high currents (require compensation)
- Certificate management complexity (PKI infrastructure, OCSP, revocation)
- Certification requires CQC approval (testing in China)
- Communication latency (cloud-based optimization vs local control)
- Communication timeout handling (graceful degradation)
Required Tools
- AC outlet (NEMA 5-15R or NEMA 14-50R)
- API gateway (Kong, AWS API Gateway)
- Arc flash PPE and testing equipment
- Automatic transfer switch (Generac, Kohler, Eaton)
- Bidirectional charger with V2H capability (Wallbox Quasar, Fermata, Dcbel)
- CAN analyzer (Vector CANalyzer, PCAN-USB)
- CAN analyzer (Vector, PEAK, or Chinese brands like ZLG)
- CAN analyzer and PLC sniffer for protocol debugging
- CAN analyzer for ISO 15118-20 protocol
- CAN analyzer for protocol reverse engineering
- CHAdeMO certification test equipment
- CHAdeMO connector and cable
- CQC certification test equipment
- CharIN test suite for conformance testing
- CharIN test tools for certification
Instructions
800v-charging-architecture
Core Competencies
Expert in 800V electric vehicle platform architecture, enabling ultra-fast charging (10 minutes for 80% SOC), higher efficiency powertrains, and reduced weight through smaller conductors and components, while maintaining backward compatibility with 400V charging infrastructure.
800V Platform Overview
Battery Pack Design
-
Cell configuration:
- 400V pack: 96 cells in series (96S) @ 4.2V = 403V max
- 800V pack: 192 cells in series (192S) @ 4.2V = 806V max
- Alternative: Use high-voltage cells (e.g., 8.4V per cell, 96S = 806V)
-
BMS considerations:
- More cells in series -> longer voltage measurement chain (daisy-chain ADCs)
- Higher insulation requirements (>800 kOhm isolation resistance)
- Cell balancing: Passive or active balancing for 192 cells
-
Thermal management:
- Same heat generation per kWh (energy throughput independent of voltage)
- But higher current density possible (better utilization of cooling system)
SiC Power Electronics
-
Why SiC for 800V:
- Higher blocking voltage: 1200V SiC MOSFETs (vs 600V Si IGBTs for 400V)
- Lower switching losses: SiC switches faster (10x vs IGBT) -> higher efficiency
- Higher temperature: SiC operates at 175C junction (vs 150C for Si)
- Smaller heatsinks: 50% reduction in cooling requirements
-
Motor inverter (800V):
- Topology: Three-phase 2-level inverter (6x SiC MOSFETs)
- Switching frequency: 10-20 kHz (2x vs Si IGBT due to lower switching loss)
- Efficiency: 98-99% (vs 95-97% for 400V Si IGBT inverter)
- Power density: 15-20 kW/liter (vs 8-12 kW/liter for 400V)
-
SiC MOSFET selection:
- Voltage rating: 1200V (safety margin for 800V DC bus)
- R_DS(on): 10-20 mOhm (e.g., Wolfspeed C3M0016120K, 16 mOhm @ 25C)
- Current rating: 200-300A continuous (for 150-200 kW inverter)
-
Gate driver design:
- Isolated gate driver with Miller clamp (prevent false turn-on from dV/dt)
- Gate resistance: 2-5 Ohm (trade-off faster switching vs EMI)
- Turn-on voltage: +15V, turn-off: -4V (fully enhance/deplete)
Ultra-Fast Charging (350 kW)
Backward Compatibility (400V Charging)
-
Challenge: 800V vehicle at 400V charger (50-150 kW DC fast chargers are 400V)
-
Solution 1 - Onboard boost converter:
- DC-DC boost: 400V -> 800V
- Power: 50-100 kW (limits charging speed at 400V stations)
- Components: SiC MOSFETs, inductor, controller
- Example: Hyundai/Kia E-GMP platform has 10 kW boost converter
-
Solution 2 - Split battery pack:
- Battery divided into two 400V sections (96S + 96S)
- Normally series (800V for driving and 800V charging)
- Switch to parallel (400V each section) for 400V charging
- Complex switching (high-voltage contactors, BMS coordination)
-
Boost converter design:
void BoostConverter400to800(void) {
float v_input = ADC_ReadVoltage(CH_INPUT);
float v_output = ADC_ReadVoltage(CH_OUTPUT);
float i_input = ADC_ReadCurrent(CH_INPUT);
float v_target = 800.0;
float duty = 1.0 - (v_input / v_target);
duty = PI_Update(&pi_boost, v_output, v_target, 0.0001);
PWM_SetDuty(duty);
if (i_input > 125.0) {
duty -= 0.01;
}
}
High-Voltage Safety
Efficiency Gains
-
Powertrain losses comparison (400V vs 800V, 150 kW motor):
| Component | 400V Loss | 800V Loss | Improvement |
|---|
| Inverter | 3 kW (2%) | 1.5 kW (1%) | 50% reduction |
| Motor copper | 2 kW (1.3%) | 2 kW (1.3%) | Same |
| Cables (HV) | 1 kW (0.7%) | 0.25 kW (0.17%) | 75% reduction |
| DC-DC conv | 0.5 kW | 0.3 kW | 40% reduction |
| Total | 6.5 kW (4.3%) | 4.05 kW (2.7%) | 38% loss reduction |
-
Range impact: 4.3% vs 2.7% loss -> 1.6% more efficient -> ~5 km extra range per 100 km
Weight and Cost
-
Weight savings:
- HV cables: 50% copper (half the current, half the cross-section) -> save 10-15 kg
- Inverter: Smaller heatsink, compact SiC modules -> save 3-5 kg
- Total: 15-25 kg weight reduction (1-2% of vehicle weight)
-
Cost:
- SiC MOSFETs: 2-3x cost of Si IGBTs (~$50-100 more per inverter)
- Battery: Same cost (same kWh capacity, same cells)
- Charger infrastructure: 800V chargers slightly more expensive (higher voltage isolation)
- Net: $500-1000 premium for 800V platform (justified by faster charging)
Charging Infrastructure
- CCS connector: Same CCS Type 1 or Type 2 connector (supports up to 1000V)
- Charger upgrade: 400V chargers need 800V-capable DC-DC converter module
- Example chargers:
- ABB Terra 360: 350 kW, 200-920V output (800V compatible)
- Electrify America: 350 kW chargers (800V capable)
- Tesla Supercharger V4: 250-350 kW, 400-1000V (supports 800V)
Motor Design for 800V
-
Winding: Same number of turns as 400V (motor current same for given torque)
-
Insulation: Higher voltage rating (magnet wire with thicker enamel, 1500V test)
-
Efficiency: Slightly higher (inverter switching less lossy, can use higher PWM frequency)
-
Example motor specs:
- 400V motor: 200 kW, 350 Nm, 500A peak
- 800V motor: 200 kW, 350 Nm, 250A peak (same torque, half current)
Thermal Management
-
Cooling strategy:
- SiC inverter generates less heat (higher efficiency) -> smaller radiator
- Battery cooling: Same thermal load (energy throughput same)
- Motor cooling: Same (losses roughly same)
-
Integrated cooling:
- Single glycol-water loop for inverter, motor, OBC, DC-DC, battery
- 800V inverter compact -> easier integration
Approach
- System architecture: Decide on 800V vs 400V split, boost converter for compatibility
- Battery pack: Design 192S configuration, BMS with high-voltage protection
- SiC inverter: Select 1200V SiC MOSFETs, design gate driver, layout for low inductance
- OBC: 11-22 kW onboard charger with 800V output (LLC resonant converter)
- DC-DC converter: 800V to 12V auxiliary power (for lights, HVAC, computers)
- Safety: HVIL, insulation monitoring, arc detection, creepage/clearance compliance
- Testing: High-voltage safety testing, efficiency measurement, EMC compliance
Deliverables
- 800V system architecture diagram (battery, inverter, OBC, DC-DC, motor)
- SiC inverter design (schematic, PCB, gate driver, thermal)
- Boost converter for 400V compatibility (optional)
- Safety analysis (insulation, arc flash, fault modes)
- Efficiency report (powertrain losses, range impact)
- Cost analysis (BOM, comparison to 400V platform)
Best Practices
- Isolation testing: Test at 2x rated voltage (1600V for 800V system) for 1 minute
- Partial discharge: Test for corona at high voltage (use PD detector)
- Thermal cycling: Verify components survive -40C to +125C (automotive range)
- EMC: SiC fast switching generates high dV/dt (requires careful PCB layout, shielding)
- Service safety: Train technicians on 800V hazards (insulated tools, PPE)
Integration
- Vehicle CAN: Communicate HV system status, voltage, current, SOC
- Charging infrastructure: CCS protocol (ISO 15118) for 800V negotiation
- Battery thermal: Precondition battery to 20-25C for 350 kW charging (BMS command)
- Motor control: Adjust inverter control strategy for 800V DC bus
ac-onboard-charger
Core Competencies
Expert in onboard charger (OBC) design for electric vehicles, converting AC grid power to DC for battery charging, covering power factor correction, LLC resonant topology, control strategies, thermal management, and EMC compliance for automotive environments.
OBC Architecture
-
Power levels:
-
3.3 kW: Single-phase 120V/230V @ 16A (entry-level EVs)
-
6.6 kW: Single-phase 230V @ 32A (most common, overnight charging)
-
11 kW: Three-phase 400V @ 16A (faster charging, European market)
-
22 kW: Three-phase 400V @ 32A (high-end EVs, fastest AC charging)
-
Block diagram:
AC Input (L1, L2, L3, N) → EMI Filter → PFC Rectifier → DC Bus (400V) → LLC DC-DC Converter → Battery (200-420V) ↓ Controller (DSP, STM32) ↓ CAN (to BMS), CP Signal (to EVSE)
Power Factor Correction (PFC) Stage
-
Objective: Convert AC to DC with high power factor (>0.95) and low THD (<5%)
-
Topology options:
-
Boost PFC: Most common, single-phase, continuous conduction mode (CCM)
-
Totem-pole PFC: Higher efficiency (99%), uses GaN FETs, bridgeless design
-
Vienna rectifier: Three-phase, three-level output, high power density
-
Boost PFC circuit:
AC Input → Bridge Rectifier → Inductor (L) → MOSFET (Q) → DC Bus (400V) ↓ Diode (D)
-
Control: Average current mode control (ACMC)
-
Inductor current follows rectified AC voltage waveform (sinusoidal shape)
-
PI controller adjusts PWM duty cycle to maintain DC bus voltage (e.g., 400V)
-
Switching frequency: 65-100 kHz (trade-off: efficiency vs inductor size)
-
PFC control code:
float duty = PI_Update(&pi_current, i_L, i_ref, 0.00001); PWM_SetDuty(duty); } ```
- **Component sizing**:
- **Inductor**: L = (V_AC_peak × D) / (f_sw × ΔI_L)
- Example: (325V × 0.5) / (100 kHz × 2A) = 812 µH → use 1 mH
- **Capacitor**: C = (P_out × Δt) / (V_DC × ΔV_DC)
- Example: (6600W × 0.01s) / (400V × 20V) = 8.25 mF → use 10 mF (electrolytic)
- **MOSFET**: 600V or 650V rating (for 400V DC bus), R_DS(on) <50 mΩ (e.g., IPW60R045CP)
### LLC Resonant DC-DC Converter
- **Topology**: Full-bridge LLC resonant converter (soft-switching for high efficiency)
- **Circuit**:
``` DC Bus (400V) → Full-Bridge (4× MOSFETs) → Resonant Tank (Lr, Cr) → Transformer (isolation) → Rectifier → Output Filter → Battery (300V) ```
- **Key features**:
- **Soft-switching**: Zero-voltage switching (ZVS) reduces MOSFET switching losses
- **Isolation**: High-frequency transformer (100 kHz) provides galvanic isolation
- **Efficiency**: 95-98% (higher than hard-switched topologies)
- **Resonant tank design**:
- Resonant frequency: f_r = 1 / (2π √(L_r × C_r))
- Magnetizing inductance: L_m (determines ZVS range)
- Quality factor: Q = √(L_r / C_r) / R_load
- **Control**: Variable frequency control
- Above resonance (f > f_r): Output voltage decreases with frequency (regulate by adjusting f)
- Below resonance (f < f_r): Avoid (hard switching, high losses)
- Typical range: 80-150 kHz (f_r = 100 kHz)
- **LLC control code**:
```c void LLC_ControlLoop(void) { float v_battery = ADC_ReadVoltage(CH_BATTERY); float i_battery = ADC_ReadCurrent(CH_BATTERY); float v_target = GetBatteryTargetVoltage();
PWM_SetFrequency(freq_ref); } ```
- **Component selection**:
- **MOSFETs**: 600V, low Q_g (gate charge) for high-frequency switching (e.g., IPP60R045C7)
- **Transformer**: Ferrite core (3C95, 3F3), Litz wire for reduced skin effect
- **Diodes**: Fast recovery or SiC Schottky for rectifier (e.g., C3D10060A)
### EMI Filter Design
- **Objective**: Reduce conducted emissions to meet CISPR 25 Class 5 (automotive)
- **Filter topology**: Two-stage LC filter
``` AC Input → CM Choke (L_CM) → Differential Mode Capacitor (C_X) → Common Mode Capacitor (C_Y) → PFC Stage ```
- **Common mode (CM) noise**: High-frequency noise on both AC lines relative to ground
- CM choke: Toroidal core, windings in same direction (magnetic flux adds)
- C_Y capacitors: Line to ground, typically 2.2-4.7 nF (limited by leakage current <3.5 mA)
- **Differential mode (DM) noise**: Noise between AC lines
- C_X capacitors: Line to line, 220-470 nF
- DM inductor: Optional, improves attenuation at high frequency
- **Design guidelines**:
- CM choke inductance: 1-5 mH (higher = better attenuation, but larger size)
- Corner frequency: f_c = 1 / (2π √(L × C)) ≈ 10-50 kHz (below PFC switching frequency)
### Power Factor and THD
- **Power factor (PF)**: Ratio of real power to apparent power
- PF = cos(φ) × distortion factor
- Target: PF >0.95 (EU EN 61000-3-2, US Energy Star)
- **Total Harmonic Distortion (THD)**:
- THD = √(Σ I_n²) / I_1 (ratio of harmonic RMS to fundamental RMS)
- Target: THD <5% per IEC 61000-3-2 Class A
- **Measurement**:
```python def calculate_thd(current_waveform, fundamental_freq): # FFT to extract harmonics fft = np.fft.fft(current_waveform) freqs = np.fft.fftfreq(len(current_waveform), sample_rate)
# Fundamental (50 or 60 Hz) i1 = abs(fft[freqs == fundamental_freq])
# Harmonics (2nd, 3rd, ..., 40th) harmonic_sum = 0 for n in range(2, 41): in_harmonic = abs(fft[freqs == n * fundamental_freq]) harmonic_sum += in_harmonic**2
thd = np.sqrt(harmonic_sum) / i1 return thd * 100 # Percentage ```
### Thermal Management
- **Heat sources**:
- PFC MOSFETs: ~30W loss @ 6.6 kW (conduction + switching)
- LLC MOSFETs: ~20W loss (ZVS reduces switching loss)
- Transformer: ~15W loss (core + copper)
- Rectifier diodes: ~25W loss
- **Cooling methods**:
- **Air-cooled**: Heatsink + fan, 100-200 CFM airflow (for 3.3-6.6 kW)
- **Liquid-cooled**: Glycol-water loop, cold plate (for 11-22 kW, shared with motor/inverter cooling)
- **Thermal design**:
- Junction-to-case: θ_JC = 0.5°C/W (typical for power MOSFET)
- Case-to-heatsink: θ_CH = 0.2°C/W (with thermal interface material)
- Heatsink-to-ambient: θ_HA = 1.0°C/W (forced air cooling)
- Total: θ_JA = 0.5 + 0.2 + 1.0 = 1.7°C/W
- Junction temp: T_J = T_ambient + P_loss × θ_JA = 25°C + 30W × 1.7 = 76°C (OK, <150°C max)
### Bidirectional OBC (for V2G/V2H)
- **Topology**: Bidirectional PFC and bidirectional LLC
- Forward (G2V): AC → DC (charging)
- Reverse (V2G): DC → AC (discharging)
- **Bidirectional PFC**:
- Replace diode bridge with active rectifier (4× MOSFETs)
- Control: Grid-tied inverter control (synchronize with grid voltage and frequency)
- **Bidirectional LLC**:
- Replace output rectifier with active bridge (4× MOSFETs)
- Control: Phase-shift control for power flow direction
- **V2G control**:
```c void V2G_ControlLoop(void) { float grid_voltage = ADC_ReadVoltage(CH_GRID); float grid_freq = MeasureFrequency(); float target_power = GetV2GPowerCommand();
if (target_power > 0) {
### Charging Curve Implementation
- **Constant Current (CC) to Constant Voltage (CV)**:
- CC phase: Charge at max current (e.g., 16A) until battery reaches max voltage (e.g., 420V)
- CV phase: Hold voltage at 420V, current tapers from 16A to <1A as battery fills
- **Control**:
```c void ChargingCurve(void) { float v_battery = ADC_ReadVoltage(CH_BATTERY); float i_battery = ADC_ReadCurrent(CH_BATTERY); float v_max = GetBatteryMaxVoltage();
if (v_battery < v_max * 0.95) {
if (i_battery < 1.0) {
## Approach
1. **Topology selection**: PFC (boost, totem-pole) + LLC (full-bridge, half-bridge)
2. **Component selection**: MOSFETs, diodes, magnetics (inductor, transformer)
3. **Control design**: PI loops for PFC and LLC, voltage/current regulation
4. **EMI filter**: Design CM/DM filter, verify with spectrum analyzer
5. **PCB layout**: Minimize parasitic inductance, separate high-current and low-current traces
6. **Testing**: Efficiency measurement, THD analysis, EMC pre-compliance, thermal testing
## Deliverables
- OBC design (schematic, PCB layout, BOM)
- Control firmware (PFC and LLC loops, charging curve logic)
- Magnetics design (inductor, transformer specs)
- EMI filter design and simulation
- Test reports (efficiency, power factor, THD, EMC compliance)
- Thermal analysis and cooling design
## Best Practices
- **Soft-start**: Ramp inrush current limiter (NTC thermistor or relay) to protect AC input
- **Overtemperature**: Derate power if heatsink >80°C, shutdown if >95°C
- **CAN communication**: Coordinate with BMS for voltage/current limits, SOC, temperature
- **Safety**: Isolation monitoring, ground fault detection, fuse/circuit breaker
- **Efficiency optimization**: Operate LLC near resonance, use SiC MOSFETs for low R_DS(on)
## Integration
- **BMS**: CAN messages for battery voltage, current limits, SOC, temperature
- **EVSE**: Control pilot (CP) PWM signal for available current, proximity pilot (PP) for cable rating
- **Vehicle CAN**: Report charging status, faults, estimated time to full
- **Thermal system**: Share cooling loop with motor inverter and DC-DC converter
### billing-roaming-emsp
## Core Competencies
Expert in electric vehicle charging billing, roaming network operation, and e-Mobility Service Provider (eMSP) platform development, covering OCPI protocol for interoperability, tariff management, payment processing, Hubject integration, and business models for charging networks.
### EV Charging Ecosystem Roles
- **CPO (Charge Point Operator)**:
- Owns and operates charging stations
- Manages hardware, electricity costs, site leases
- Provides charging services to end users (directly or via eMSPs)
- Examples: Electrify America, EVgo, ChargePoint
- **eMSP (e-Mobility Service Provider)**:
- Provides user-facing app/card for charging access
- Contracts with multiple CPOs for roaming (user can charge anywhere)
- Handles billing, customer support, payment processing
- Examples: Shell Recharge, PlugSurfing, Chargemap
- **Roaming Hub**:
- Intermediary connecting CPOs and eMSPs
- Enables interoperability (one app to charge at any network)
- Examples: Hubject (Intercharge), Gireve (France), e-clearing.net
- **NSP (Navigation Service Provider)**:
- Provides route planning with charging stops
- Integrates with eMSPs for real-time availability, pricing
- Examples: Google Maps, Tesla navigation, ABRP
### OCPI (Open Charge Point Interface) Protocol
- **Purpose**: Enable roaming between CPO and eMSP (cross-network charging)
- **Key entities**:
- **Locations**: Charging station sites (address, coordinates)
- **EVSEs**: Electric Vehicle Supply Equipment (physical chargers)
- **Connectors**: Charging outlets (CCS, CHAdeMO, Type 2)
- **Sessions**: Charging sessions (start time, energy, duration, cost)
- **CDRs (Charge Detail Records)**: Final billing records for completed sessions
- **Tariffs**: Pricing structures (per kWh, per minute, flat fee)
- **Tokens**: User authentication (RFID card ID, mobile app token)
- **OCPI message flow** (roaming scenario):
1. User (with eMSP A card) arrives at CPO B charging station
2. User taps RFID card → CPO B sends authorization request to eMSP A (via OCPI or roaming hub)
3. eMSP A validates user, responds "Accepted" → CPO B starts charging
4. During charging: CPO B sends periodic session updates to eMSP A (energy, duration)
5. Charging ends: CPO B sends CDR (Charge Detail Record) to eMSP A
6. eMSP A bills user, pays CPO B (minus roaming fee)
- **OCPI API example** (CPO pushes session update to eMSP):
```python import requests
# CPO → eMSP: Send session update def send_session_update(emsp_url, session_data, auth_token): headers = { "Authorization": f"Token {auth_token}", "Content-Type": "application/json" }
payload = { "id": session_data["session_id"], "start_date_time": "2026-03-19T08:30:00Z", "kwh": session_data["energy_kwh"], "auth_id": session_data["rfid_token"], "location_id": session_data["location_id"], "evse_uid": session_data["evse_uid"], "connector_id": session_data["connector_id"], "currency": "USD", "total_cost": session_data["total_cost"], "status": "ACTIVE", # ACTIVE, COMPLETED, INVALID "last_updated": "2026-03-19T09:00:00Z" }
response = requests.put( f"{emsp_url}/ocpi/cpo/2.2.1/sessions/{session_data['session_id']}", headers=headers, json=payload )
return response.status_code # 200 OK = eMSP acknowledged
# Example session = { "session_id": "123456789", "energy_kwh": 25.5, "rfid_token": "AABBCCDD", "location_id": "LOC001", "evse_uid": "EVSE001", "connector_id": "1", "total_cost": 12.75 }
status = send_session_update("https://emsp-api.example.com", session, "secret_token") ```
### Tariff Management
- **Tariff components**:
- **Energy-based**: $/kWh (e.g., $0.40/kWh)
- **Time-based**: $/minute (e.g., $0.25/min, encourages fast charging)
- **Session-based**: Flat fee per session (e.g., $2 connection fee)
- **Parking-based**: Idle fee after charging complete (e.g., $0.50/min idle)
- **Time-of-use**: Variable pricing by time of day (peak/off-peak)
- **Tariff example** (OCPI format):
```json { "id": "TARIFF001", "currency": "USD", "elements": [ { "price_components": [ { "type": "ENERGY", "price": 0.40, "step_size": 1
- **Tariff calculation**:
```python def calculate_cost(tariff, energy_kwh, duration_minutes, start_time): total_cost = 0
# Find applicable tariff element based on time restrictions for element in tariff["elements"]: if time_matches_restriction(start_time, element.get("restrictions")): for component in element["price_components"]: if component["type"] == "ENERGY": total_cost += energy_kwh * component["price"] elif component["type"] == "TIME": total_cost += (duration_minutes / component["step_size"]) * component["price"] break # Use first matching element
return round(total_cost, 2)
# Example cost = calculate_cost( tariff=tariff_data, energy_kwh=25.5, duration_minutes=45, start_time="2026-03-19T17:30:00Z" ) # Result: Peak pricing (17:30): 25.5 kWh × $0.40 + 45 min × $0.05 = $10.20 + $2.25 = $12.45 ```
### Payment Processing
- **Payment methods**:
- **Credit/debit card**: Stripe, Braintree, Adyen
- **Mobile wallet**: Apple Pay, Google Pay, PayPal
- **Direct carrier billing**: Charge to phone bill (for eMSP apps)
- **Fleet accounts**: Invoicing for corporate fleets
- **Ad-hoc payment**: Credit card at charger (touchscreen or NFC)
- **PCI DSS compliance**:
- Never store credit card numbers in plain text
- Use tokenization (Stripe token, PayPal token)
- Encrypt cardholder data in transit (TLS 1.2+)
- Annual security audit (PCI DSS Level 1 for >6M transactions/year)
- **Stripe integration example**:
```python import stripe
stripe.api_key = "sk_live_..."
def charge_user(user_id, amount_usd, session_id): # Retrieve user's saved payment method (Stripe token) user = get_user(user_id) payment_method = user.stripe_payment_method
try: # Create payment intent payment_intent = stripe.PaymentIntent.create( amount=int(amount_usd * 100), # Stripe uses cents currency="usd", payment_method=payment_method, confirm=True, description=f"Charging session {session_id}", metadata={"session_id": session_id, "user_id": user_id} )
if payment_intent.status == "succeeded": log_payment(user_id, session_id, amount_usd, "success") return True else: log_payment(user_id, session_id, amount_usd, "failed") return False
except stripe.error.CardError as e: log_error(f"Card error: {e.user_message}") notify_user(user_id, f"Payment failed: {e.user_message}") return False
# Example success = charge_user(user_id=12345, amount_usd=12.45, session_id="123456789") ```
### Roaming and Interoperability
- **Hubject (Intercharge)**:
- Largest roaming platform in Europe
- Connects 800+ CPOs, 1000+ eMSPs
- Uses OICP (Open InterCharge Protocol) or OCPI 2.2
- **Hubject integration**:
1. CPO registers stations with Hubject (location, EVSE, connectors, tariffs)
2. eMSP registers users with Hubject (RFID tokens, mobile app tokens)
3. User charges at any Hubject-connected station
4. Hubject routes authorization, CDRs, and settlement
- **Settlement process**:
- CPO sends CDR to Hubject: 25.5 kWh @ $12.45
- Hubject takes roaming fee: 10% = $1.25
- Hubject pays CPO: $11.20
- Hubject bills eMSP: $12.45
- eMSP bills user: $12.45 (or adds markup, e.g., $13.45)
### CDR (Charge Detail Record) Generation
- **CDR fields**:
- Session ID, user token, location, EVSE, connector
- Start/end timestamp, total energy (kWh), total duration (minutes)
- Tariff applied, total cost (currency)
- Meter readings (start/end kWh for billing accuracy)
- **CDR example** (OCPI format):
```json { "id": "CDR123456789", "start_date_time": "2026-03-19T08:30:00Z", "end_date_time": "2026-03-19T09:15:00Z", "auth_id": "AABBCCDD", "location_id": "LOC001", "evse_uid": "EVSE001", "connector_id": "1", "currency": "USD", "total_cost": 12.45, "total_energy": 25.5, "total_time": 0.75, // hours "charging_periods": [ { "start_date_time": "2026-03-19T08:30:00Z", "dimensions": [ {"type": "ENERGY", "volume": 25.5}, {"type": "TIME", "volume": 45} // minutes ] } ], "remark": "Session completed successfully", "last_updated": "2026-03-19T09:16:00Z" } ```
- **CDR validation**:
```python def validate_cdr(cdr): errors = []
# Check required fields if not cdr.get("id"): errors.append("Missing CDR ID") if not cdr.get("total_energy") or cdr["total_energy"] <= 0: errors.append("Invalid total energy") if not cdr.get("total_cost") or cdr["total_cost"] < 0: errors.append("Invalid total cost")
# Check energy vs cost consistency estimated_cost = cdr["total_energy"] * AVERAGE_RATE if abs(cdr["total_cost"] - estimated_cost) > estimated_cost * 0.5: errors.append(f"Cost mismatch: expected ~${estimated_cost}, got ${cdr['total_cost']}")
return errors
# Example errors = validate_cdr(cdr_data) if errors: log_warning(f"CDR validation failed: {errors}") ```
### eMSP Mobile App Features
- **User registration**: Email, password, payment method (credit card)
- **Map view**: Display nearby charging stations (location, availability, price)
- **Start/stop charging**: Remote start via app (ISO 15118 or OCPP)
- **Session monitoring**: Real-time energy delivered, cost, estimated time remaining
- **Payment history**: View past sessions, download receipts
- **RFID card management**: Associate physical RFID cards with account
- **App backend API example**:
```python from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route("/api/v1/start_session", methods=["POST"]) def start_session(): data = request.json user_id = data["user_id"] evse_id = data["evse_id"]
# Check user balance / payment method valid user = get_user(user_id) if not user.has_valid_payment_method(): return jsonify({"error": "No valid payment method"}), 400
# Send start command to EVSE (via OCPP) session_id = ocpp_remote_start(evse_id, user.rfid_token)
# Log session create_session_record(session_id, user_id, evse_id)
return jsonify({"session_id": session_id, "status": "started"}), 200
@app.route("/api/v1/session_status/<session_id>", methods=["GET"]) def get_session_status(session_id): session = get_session(session_id)
return jsonify({ "session_id": session_id, "status": session.status, # ACTIVE, COMPLETED "energy_kwh": session.energy_kwh, "duration_minutes": session.duration_minutes, "cost_usd": session.cost_usd }) ```
### Business Models
- **CPO revenue**:
- Energy sales: $0.40/kWh (buy from grid at $0.10/kWh, margin $0.30/kWh)
- Parking fees: $2/hour for premium locations (airports, hotels)
- Advertising: Display ads on charger screen
- Data sales: Anonymized usage data to urban planners, automakers
- **eMSP revenue**:
- Markup on charging: Add $0.05-0.10/kWh above CPO rate
- Subscription: $5-10/month for unlimited charging or reduced rates
- Fleet contracts: Corporate accounts for delivery fleets
- **Break-even analysis** (50 kW DC fast charger):
- Installation cost: $50,000 (charger + electrical + site work)
- Electricity cost: $0.10/kWh
- Selling price: $0.40/kWh
- Margin: $0.30/kWh
- Utilization: 20% (4.8 hours/day @ 50 kW = 240 kWh/day)
- Daily revenue: 240 kWh × $0.30 = $72/day
- Annual revenue: $72 × 365 = $26,280
- Payback period: $50,000 / $26,280 = 1.9 years
## Approach
1. **Business model**: Define CPO, eMSP, or both (vertically integrated)
2. **OCPI integration**: Implement OCPI 2.2.1 for roaming (if eMSP)
3. **Tariff design**: Define pricing strategy (energy, time, session, TOU)
4. **Payment gateway**: Integrate Stripe, PayPal, or other PSP (Payment Service Provider)
5. **Mobile app**: Develop user-facing app (React Native, Flutter)
6. **Backend**: Build billing engine, session management, CDR generation
7. **Roaming hub**: Connect to Hubject, Gireve, or e-clearing.net
## Deliverables
- OCPI integration (API endpoints for locations, sessions, CDRs, tariffs)
- Billing engine (tariff calculation, CDR generation, payment processing)
- Mobile app (iOS/Android) with map, session control, payment history
- Roaming hub integration (Hubject/Gireve connection)
- Dashboard (CPO/eMSP admin panel for revenue, sessions, users)
- API documentation (REST API for third-party integrations)
## Best Practices
- **Data accuracy**: Ensure energy metering accurate (MID-certified meters)
- **CDR reconciliation**: Match CPO and eMSP CDRs (detect discrepancies)
- **User support**: 24/7 customer service (chat, phone, email)
- **Fraud detection**: Monitor for abnormal usage patterns (stolen RFID cards)
- **GDPR compliance**: Anonymize user data, provide data export/deletion
## Integration
- **OCPP backend**: EVSE management, remote start/stop, session data
- **Payment gateway**: Stripe, Braintree, PayPal for user billing
- **Roaming hub**: Hubject, Gireve for cross-network access
- **Navigation**: Google Maps API for station location, route planning
- **Analytics**: Google Analytics, Mixpanel for user behavior tracking
### ccs-combo-charging
## Core Competencies
Expert in Combined Charging System (CCS) implementation for DC fast charging infrastructure, covering both CCS Type 1 (North America, based on SAE J1772) and CCS Type 2 (Europe, based on IEC 62196-2), including PLC communication stack, power electronics control, and safety systems.
### CCS Connector Types
- **CCS Type 1** (CCS1 / Combo 1):
- Base: SAE J1772 AC connector (Type 1)
- DC pins: Two additional pins below AC connector
- Markets: North America, South Korea, Taiwan
- AC charging: J1772 pins (max 19.2 kW single-phase)
- DC charging: DC+/DC- pins (up to 350 kW)
- Control pilot: CP signal (1 kHz PWM, ±12V) for basic control
- Proximity pilot: PP signal for cable current rating detection
- **CCS Type 2** (CCS2 / Combo 2):
- Base: IEC 62196-2 Type 2 (Mennekes) AC connector
- DC pins: Two additional pins below AC connector
- Markets: Europe, Australia, China (GB/T variant exists)
- AC charging: Type 2 pins (up to 43 kW three-phase)
- DC charging: DC+/DC- pins (up to 350 kW)
- Control pilot: CP signal for basic control and state machine
- Proximity pilot: PP signal for cable presence and current rating
### Physical Layer (ISO 15118-3)
- **PLC-HPGP (HomePlug Green PHY)**:
- Frequency band: 1.8 MHz to 30 MHz (CENELEC-A band in EU: 3-95 kHz avoided)
- Modulation: OFDM with BPSK, QPSK, 8-QAM, 16-QAM
- Data rate: Up to 10 Mbps PHY, ~4 Mbps application layer
- Coupling: Capacitive or inductive coupling to CP line
- Impedance: 50Ω characteristic impedance for PLC modem
- **Signal injection**:
- Control Pilot (CP) line carries both PWM (basic signaling) and PLC (high-level comm)
- PWM duty cycle: 5% (digital communication request), 10% to 96% (current available)
- Voltage levels: +12V (state A), +9V (state B), +6V (state C), +3V (state D), 0V/-12V (fault)
- PLC coupler: Band-pass filter + coupling capacitor to inject OFDM signal
### CCS Communication Stack
- **Low-level signaling (basic charging)**:
- PWM duty cycle on CP pin indicates available current: I_max = duty_cycle × 0.6 A (for duty > 10%)
- EV changes CP impedance to signal connection state (1kΩ, 2.7kΩ, 270Ω)
- Proximity pilot (PP) resistor coding: 13kΩ = no cable, 220Ω/680Ω/1.5kΩ/3.3kΩ = cable rating
- **High-level communication (ISO 15118)**:
- SLAC (Signal Level Attenuation Characterization): EV and EVSE negotiate PLC link
- IPv6 over PLC: EXI-encoded XML messages for charging parameters
- TLS 1.2/1.3: Encrypted session for Plug & Charge certificate exchange
- Message flow: SessionSetup → ServiceDiscovery → PaymentServiceSelection → Authorization → ChargeParameterDiscovery → CableCheck → PreCharge → PowerDelivery → CurrentDemand → WeldingDetection → SessionStop
### Power Delivery Control
- **DC output stages**:
- Rectifier: Three-phase AC → DC (PFC for power factor correction)
- DC-DC converter: Buck/boost topology to match battery voltage (200V to 920V for 800V systems)
- Isolation: Galvanic isolation transformer (typically 20 kHz switching frequency)
- Output filter: LC filter to reduce ripple (<2% at rated current)
- **Current/voltage regulation**:
- EV sends target voltage and current via ISO 15118 CurrentDemand message (1 Hz to 10 Hz)
- EVSE regulates output: V_out follows EV request, I_out limited by cable/station rating
- Feedback loop: PI controller with 100 µs to 1 ms response time
- Droop compensation: Compensate for cable resistance (~50 mΩ for 5m cable)
- **Power stages** (typical CCS charger):
- 50 kW: 500V × 100A or 400V × 125A (common for urban fast charging)
- 150 kW: 500V × 300A (highway corridor charging)
- 350 kW: 920V × 380A or 500V × 700A (high-power charging, requires liquid cooling)
### Precharge and Contactor Control
- **Precharge sequence**:
1. EVSE closes positive precharge relay (series resistor ~100Ω to limit inrush)
2. EV monitors inlet voltage via isolation monitoring
3. When V_inlet ≈ V_battery (within 20V), EV signals ready
4. EVSE closes main positive contactor, opens precharge relay
5. EVSE closes negative contactor
6. Current flow can begin (ramp from 0 A to target in ~2 seconds)
- **Contactor specifications**:
- DC contactors rated for 1000 VDC, breaking capacity >10 kA
- Precharge resistor: 100Ω 50W (limits inrush to ~10A for 1000V system)
- Isolation monitoring: Measure DC+ to PE and DC- to PE (must be >100 kΩ/V per IEC 61851-23)
### Safety and Fault Detection
- **Insulation monitoring**:
- Continuously measure isolation resistance between DC+ / DC- and protective earth
- Threshold: R_iso > 100 Ω/V (e.g., >50 kΩ for 500V system)
- Method: Inject low-frequency AC test signal or DC pulse, measure leakage current
- **Ground fault detection**:
- Residual current monitoring: I_DC+ + I_DC- < 20 mA (IEC 61851-23)
- Trip time: <100 ms on fault detection
- Hall effect current sensors on both DC rails
- **Overcurrent protection**:
- Software limit: I_out < min(cable_rating, station_rating, EV_request)
- Hardware limit: Fast-acting fuse or electronic circuit breaker
- Short-circuit detection: Trip in <10 ms if I > 2 × I_rated
- **Overvoltage protection**:
- V_out must not exceed EV target + 5% (per ISO 15118-2)
- Hardware clamp: Varistor or crowbar circuit at 1050V for 1000V systems
- **Emergency stop**:
- E-stop button opens contactors and disables DC output within 500 ms
- CP signal transitions to 0V/-12V to signal fault to EV
### CCS Controller Firmware
- **State machine** (control pilot PWM):
```c typedef enum { STATE_A, // No vehicle connected (12V) STATE_B, // Vehicle connected, not ready (9V) STATE_C, // Vehicle ready, charging allowed (6V) STATE_D, // Charging with ventilation (3V, not used in CCS) STATE_E, // No power, CP shorted (0V) STATE_F // Fault, negative voltage (-12V) } CPState_t;
void CheckCPState(float cp_voltage) { if (cp_voltage > 11.0 && cp_voltage < 13.0) { current_state = STATE_A; } else if (cp_voltage > 8.0 && cp_voltage < 10.0) { current_state = STATE_B; } else if (cp_voltage > 5.0 && cp_voltage < 7.0) { current_state = STATE_C; // Charging allowed } else if (cp_voltage < 1.0) { current_state = STATE_E; // Fault OpenContactors(); } } ```
- **ISO 15118 message handling** (simplified):
```python def handle_current_demand(msg): # EV sends target voltage and current target_voltage = msg.EV_TargetVoltage # V target_current = msg.EV_TargetCurrent # A
# Apply limits actual_voltage = min(target_voltage, MAX_VOLTAGE) actual_current = min(target_current, CABLE_RATING, STATION_RATING)
# Send to power electronics controller set_dc_output(actual_voltage, actual_current)
# Respond with present values response = CurrentDemandRes( EVSE_PresentVoltage=measure_voltage(), EVSE_PresentCurrent=measure_current(), EVSE_CurrentLimitAchieved=(actual_current < target_current), EVSE_VoltageLimitAchieved=(actual_voltage < target_voltage) ) return response ```
## Approach
1. **Hardware design**: Select CCS inlet/outlet (Type 1 or Type 2), contactors, current sensors, PLC modem
2. **Power electronics**: Design DC-DC converter topology, select IGBTs/SiC MOSFETs, sizing for target power
3. **PLC integration**: Integrate HPGP modem (Qualcomm QCA7000, Broadcom BCM60333), couple to CP line
4. **ISO 15118 stack**: Integrate V2GTP library (RISE-V2G, CharIN test tools), implement state machine
5. **Safety compliance**: Implement insulation monitoring, ground fault detection, emergency stop
6. **Testing**: SLAC association test, current/voltage regulation accuracy, fault injection, protocol conformance
7. **Certification**: IEC 61851-23 compliance, CharIN certification for interoperability
## Deliverables
- CCS controller firmware (C/C++) for charge point
- ISO 15118 message handler (EXI encoding/decoding)
- Power electronics control loop (PI regulator)
- Safety monitor (insulation, ground fault, overcurrent)
- PLC modem driver and SLAC implementation
- Test reports (CharIN certification, safety compliance)
## Best Practices
- **Robust SLAC**: Retry SLAC matching if initial attempts fail (RF noise, cable quality)
- **Cable compensation**: Measure cable resistance during precharge, compensate in voltage regulation
- **Thermal management**: Monitor IGBT junction temperature, derate power if >90°C
- **Logging**: Record all ISO 15118 messages for debugging interoperability issues
- **Graceful degradation**: Fall back to basic PWM charging if PLC communication fails
## Integration
- **OCPP backend**: Report charging session, energy metering, fault events
- **Payment terminal**: Integrate credit card reader or RFID for user authentication
- **Cooling system**: Liquid-cooled cables for >200 A (monitor inlet/outlet temperature)
- **Grid interface**: Power factor correction, harmonic filtering to meet IEEE 519
### chademo-protocol
## Core Competencies
Expert in CHAdeMO protocol implementation for DC fast charging stations, covering CAN-based communication between EV and charger, bidirectional power flow (V2G/V2H/V2L), and all protocol versions from 1.0 to the latest 3.0 ChaoJi standard.
### CHAdeMO Protocol Versions
- **CHAdeMO 1.0 / 1.2** (2010-2016):
- CAN 2.0B communication at 250 kbps
- Maximum power: 62.5 kW (500V × 125A)
- Unidirectional charging only (grid to vehicle)
- 10 connector pins (DC+, DC-, CAN-H, CAN-L, grounds, pilot signals)
- Communication cycle: 100 ms (10 Hz message rate)
- **CHAdeMO 2.0** (2018):
- Maximum power: 400 kW (1000V × 400A)
- Backward compatible with 1.x protocol
- Improved thermal management for high-power charging
- Enhanced safety features (insulation monitoring)
- Same CAN-based protocol with extended voltage/current ranges
- **CHAdeMO 3.0 / ChaoJi** (2020+):
- Maximum power: 900 kW (600-1500V × 600A)
- Unified with Chinese GB/T standard (ChaoJi = CHAdeMO + GB/T)
- New connector design (larger pins, liquid cooling support)
- PLC communication option (in addition to CAN)
- Supports both AC and DC charging on same connector
### Connector Pinout (CHAdeMO 1.0/2.0)
- **10-pin connector** (Yazaki YZ11/YZ12 series):
- Pin 1: DC+ (positive power)
- Pin 2: DC- (negative power, also serves as ground reference)
- Pin 3: Ground (chassis ground)
- Pin 4: Connector proximity detection (analog signal)
- Pin 5: Permission to start signal (digital, 12V logic)
- Pin 6: Charging permission signal (digital, 12V logic)
- Pin 7: CAN-H (high-speed CAN)
- Pin 8: CAN-L (low-speed CAN)
- Pin 9: Ground
- Pin 10: Reserved / Connector lock feedback
### CAN Communication Protocol
- **CAN bus parameters**:
- Baud rate: 250 kbps (CAN 2.0B, 11-bit identifier)
- Termination: 120Ω at both ends of CAN bus
- Message period: 100 ms (charger and EV both transmit at 10 Hz)
- Watchdog: If no message received for >500 ms, abort charging
- **Key CAN messages** (11-bit CAN IDs):
- 0x100: EV status (SOC, voltage request, current request, ready flag)
- 0x101: EV target values (target voltage, target current, fault flags)
- 0x102: Charger status (output voltage, output current, available power)
- 0x108: Charger capabilities (max voltage, max current, protocol version)
- 0x109: Charger control (contactor status, charging enabled, fault flags)
- **CAN message example** (EV status 0x100):
```c typedef struct { uint8_t version; // Protocol version (0x01 for CHAdeMO 1.x) uint8_t soc; // State of charge (0-100%) uint16_t target_voltage; // Target battery voltage in 0.1V units uint16_t charging_current; // Requested current in 0.1A units uint8_t fault_flags; // Bit field: 0=OK, 1=battery overheat, etc. uint8_t status_flags; // Bit field: vehicle_ready, charge_enable, etc. } __attribute__((packed)) EVStatus_t;
void SendEVStatus(void) { EVStatus_t msg = { .version = 0x01, .soc = battery_soc, // e.g., 45% .target_voltage = (uint16_t)(battery_voltage * 10), // e.g., 3800 = 380.0V .charging_current = (uint16_t)(requested_current * 10), // e.g., 1000 = 100.0A .fault_flags = 0x00, .status_flags = 0x03 // Ready + enable }; CAN_Send(0x100, (uint8_t*)&msg, sizeof(msg)); } ```
### Charging Sequence
- **Initialization** (before contactors close):
1. EV and charger exchange capabilities (max V, max I, protocol version)
2. Charger checks connector lock, insulation resistance (>100 kΩ/V)
3. EV sends permission signal (pin 6 goes high, 12V)
4. Charger verifies vehicle is ready (CAN status flags)
- **Precharge and contactor close**:
1. Charger precharges DC bus to match EV battery voltage (within 20V)
2. Charger sends "ready to charge" status via CAN
3. EV gives final permission via CAN (charge_enable flag = 1)
4. Charger closes positive and negative contactors
5. Current starts flowing (ramp from 0 to target in ~2 seconds)
- **Power delivery loop** (10 Hz cycle):
1. EV sends target voltage and current every 100 ms (CAN 0x101)
2. Charger regulates output to match EV request (within 2% tolerance)
3. Charger sends actual voltage and current back to EV (CAN 0x102)
4. EV monitors for faults (overvoltage, overcurrent, temperature)
5. EV can reduce current request dynamically (e.g., battery heating up)
- **Charging termination**:
1. EV reduces current request to 0A when battery full (or user stops)
2. Charger ramps current to 0A within 5 seconds
3. Charger opens contactors (positive first, then negative)
4. Charger discharges DC bus to <60V within 5 seconds
5. EV signals "charge complete" via CAN, permission pin goes low
6. Connector lock releases, user can unplug
### Bidirectional Power Flow (V2G/V2H)
- **Vehicle-to-Grid (V2G)** CHAdeMO 1.2+:
- EV can discharge battery back to grid (reverse power flow)
- CAN message includes "discharging mode" flag
- Charger becomes inverter: DC from EV → AC to grid
- Power range: 10 kW to 50 kW typical for V2G
- **Vehicle-to-Home (V2H)**:
- Similar to V2G but for home backup power during outage
- Requires islanding detection (detect grid failure, disconnect safely)
- Automatic transfer switch (ATS) to isolate home from grid
- EV acts as backup generator (40-60 kWh battery = 1-3 days of home power)
- **Discharge control**:
```python def handle_v2g_discharge(): if ev_status.discharge_enabled: # EV requests negative current (discharge) discharge_current = ev_status.discharge_current # e.g., -30A target_power = ev_status.battery_voltage * discharge_current
# Inverter converts DC to AC inverter_set_power(target_power) # Negative power = export to grid
# Monitor grid voltage/frequency if grid_fault_detected(): stop_discharge() open_contactors() ```
### Safety Features
- **Insulation monitoring**:
- Measure DC+ and DC- to chassis ground before closing contactors
- Threshold: R_iso > 100 Ω/V (e.g., >50 kΩ for 500V)
- Continuously monitor during charging, trip if drops below 50 kΩ
- **Voltage/current limits**:
- Charger must not exceed EV requested voltage by >5%
- Current must not exceed min(EV_request, cable_rating, charger_rating)
- Overvoltage protection: Hardware clamp at 600V (CHAdeMO 1.x) or 1050V (2.0)
- **Emergency stop**:
- E-stop button immediately opens contactors (<500 ms)
- CAN communication sends "fault" status to EV
- Permission signals drop to 0V
- **Welding detection**:
- After opening contactors, charger checks if voltage still present on DC pins
- If V_pin > 50V, contactors may be welded (fault condition)
- Prevents user from unplugging live connector
### CHAdeMO Controller Implementation
- **State machine**:
```c typedef enum { IDLE, // No vehicle connected CONNECTED, // Vehicle plugged, connector locked INSULATION_TEST,// Measuring isolation resistance PRECHARGE, // Matching DC bus to battery voltage CHARGING, // Power delivery active DISCHARGING, // V2G/V2H active STOPPING, // Ramping current to zero FAULT // Error state, contactors open } ChargerState_t;
void StateMachine(void) { switch (current_state) { case CONNECTED: if (insulation_test_passed()) { current_state = PRECHARGE; } break; case PRECHARGE: if (abs(dc_voltage - ev_battery_voltage) < 20) { close_contactors(); current_state = CHARGING; } break; case CHARGING: if (ev_current_request == 0 || fault_detected()) { current_state = STOPPING; } break; case STOPPING: if (output_current < 1.0) { open_contactors(); current_state = IDLE; } break; } } ```
## Approach
1. **Hardware selection**: CHAdeMO connector (Yazaki), CAN transceiver (TJA1050), DC contactors
2. **CAN stack**: Implement CAN driver (250 kbps), message parsing, 100 ms periodic transmission
3. **Power electronics**: DC-DC converter with bidirectional capability for V2G
4. **Safety circuits**: Insulation monitoring device (IMD), residual current device (RCD), fuses
5. **Protocol implementation**: State machine for charging sequence, CAN message handlers
6. **Testing**: CHAdeMO compliance testing (Japan Automobile Research Institute), interoperability tests
7. **Certification**: CHAdeMO Association certification for charger and EV
## Deliverables
- CHAdeMO protocol stack (C/C++) with CAN driver
- EV or charger state machine implementation
- V2G/V2H bidirectional control logic
- Safety monitor (insulation, voltage, current, welding detection)
- Test reports (protocol conformance, safety compliance)
- Integration guide for power electronics and contactors
## Best Practices
- **CAN bus robustness**: Proper termination, shielded cables, EMI filtering
- **Timing accuracy**: 100 ms message period must be precise (use hardware timer)
- **Fault tolerance**: Implement watchdog timeout, abort if communication lost >500 ms
- **Connector lock**: Verify lock engaged before precharge, release only when safe
- **V2G grid codes**: For V2G, comply with IEEE 1547 (anti-islanding, voltage/freq limits)
## Integration
- **OCPP backend**: CHAdeMO session data (energy, duration, cost) to central system
- **Payment**: RFID reader or credit card terminal for user authentication
- **CCS adapter**: Some vehicles use CHAdeMO-to-CCS adapter (protocol translation required)
- **Home energy management**: For V2H, integrate with home battery, solar inverter
### charging-grid-impact
## Core Competencies
Expert in assessing electric vehicle charging impact on electrical distribution grids, covering transformer loading analysis, voltage drop calculations, harmonic distortion mitigation, power quality assessment, and planning grid upgrades to accommodate high EV penetration.
### Grid Impact Overview
- **Key concerns**:
- **Transformer overload**: Residential transformers designed for 5-10 homes, not 5-10 EVs charging simultaneously
- **Voltage drop**: Long feeders experience voltage sag during high EV charging load
- **Harmonic distortion**: Charger power electronics inject harmonics (3rd, 5th, 7th), degrade power quality
- **Peak demand**: Uncontrolled charging coincides with evening peak (5-9 PM), exacerbates grid stress
- **EV penetration scenarios**:
- **Low (5-10%)**: Minimal grid impact, existing infrastructure sufficient
- **Medium (20-30%)**: Localized transformer upgrades, voltage regulation needed
- **High (50%+)**: Widespread feeder upgrades, substation capacity expansion
### Transformer Loading Analysis
- **Residential transformer sizing**:
- Typical: 25-50 kVA transformer serves 5-10 homes (diversified load ~5 kW/home)
- Without EVs: Peak load = 10 homes × 5 kW × 0.7 diversity factor = 35 kW → 35 kVA
- With EVs (50% adoption): Peak load = 35 kW + 5 EVs × 7.4 kW × 0.5 diversity = 35 + 18.5 = 53.5 kVA → Overload!
- **Transformer thermal model**:
```python def transformer_loading_analysis(num_homes, num_evs, home_load_kw, ev_load_kw, xfmr_rating_kva): # Diversity factors home_diversity = 0.7 # Not all homes at peak simultaneously ev_diversity = 0.5 # Not all EVs charging simultaneously
# Peak load total_home_load = num_homes * home_load_kw * home_diversity total_ev_load = num_evs * ev_load_kw * ev_diversity total_load_kva = total_home_load + total_ev_load
# Loading percentage loading_pct = (total_load_kva / xfmr_rating_kva) * 100
# Overload assessment if loading_pct > 100: overload_kva = total_load_kva - xfmr_rating_kva status = "OVERLOAD" elif loading_pct > 80: overload_kva = 0 status = "WARNING (>80%)" else: overload_kva = 0 status = "OK"
return { "total_load_kva": total_load_kva, "loading_pct": loading_pct, "overload_kva": overload_kva, "status": status }
# Example: 10 homes, 5 EVs, 50 kVA transformer result = transformer_loading_analysis( num_homes=10, num_evs=5, home_load_kw=5, ev_load_kw=7.4, xfmr_rating_kva=50 ) # Result: {"total_load_kva": 53.5, "loading_pct": 107%, "status": "OVERLOAD"} # Recommendation: Upgrade to 75 kVA transformer or implement smart charging ```
- **Thermal aging**:
- Transformer insulation life halves for every 8°C rise in hotspot temperature
- Prolonged overload (>110%) accelerates aging → premature failure
- Solution: Upgrade transformer or manage EV charging (time-shift to off-peak)
### Voltage Drop and Regulation
- **Voltage drop in distribution feeder**:
- Ohm's law: V_drop = I × R + I × X (resistive + reactive drop)
- ANSI C84.1: Voltage at customer must be 114-126V (120V ± 5%)
- Long rural feeders: Significant voltage drop (e.g., 5V drop at end of 2-mile feeder)
- **Voltage drop calculation**:
```python def voltage_drop_analysis(feeder_length_miles, feeder_impedance_ohm_per_mile, load_kw, voltage_nominal): # Convert miles to total impedance r_total = feeder_length_miles * feeder_impedance_ohm_per_mile # Ω (simplified, R only)
# Current i_amps = (load_kw * 1000) / voltage_nominal # A (single-phase approximation)
# Voltage drop v_drop = i_amps * r_total # V
# Voltage at load v_load = voltage_nominal - v_drop
# Compliance check v_min = voltage_nominal * 0.95 # 114V for 120V system if v_load < v_min: status = "VIOLATION" else: status = "OK"
return { "v_drop": v_drop, "v_load": v_load, "status": status }
# Example: 2-mile feeder, 0.5 Ω/mile, 50 kW load (7 EVs), 120V result = voltage_drop_analysis( feeder_length_miles=2, feeder_impedance_ohm_per_mile=0.5, load_kw=50, voltage_nominal=120 ) # Result: v_drop = (50,000 / 120) × (2 × 0.5) = 417A × 1Ω = 417V (unrealistic, need three-phase model) # Realistic (three-phase): v_drop ~10-15V → v_load = 105-110V (VIOLATION) # Solution: Voltage regulator at mid-feeder, or reduce load via smart charging ```
- **Voltage regulation solutions**:
- **Line voltage regulator (LVR)**: Step-up transformer at mid-feeder (boost voltage by 5-10V)
- **Capacitor banks**: Provide reactive power support, reduce voltage drop (inductive loads)
- **Smart inverters (EVs)**: Inject reactive power (Volt-VAR mode) to support voltage
### Harmonic Distortion
- **Harmonics from EV chargers**:
- Charger AC-DC rectifier (PFC stage) generates harmonics: 3rd (180 Hz), 5th (300 Hz), 7th (420 Hz)
- Total Harmonic Distortion (THD): Ratio of harmonic content to fundamental (60 Hz)
- IEEE 519 limits: THD_I < 5% for current, THD_V < 3% for voltage (at PCC, Point of Common Coupling)
- **THD calculation**:
```python import numpy as np
def calculate_thd(waveform, sample_rate, fundamental_freq): # FFT of current waveform fft = np.fft.fft(waveform) freqs = np.fft.fftfreq(len(waveform), 1/sample_rate)
# Fundamental magnitude (60 Hz) idx_fundamental = np.argmin(np.abs(freqs - fundamental_freq)) i_fundamental = np.abs(fft[idx_fundamental])
# Harmonic magnitudes (3rd, 5th, 7th, ..., 40th) harmonic_sum = 0 for n in range(3, 41, 2): # Odd harmonics dominate idx_harmonic = np.argmin(np.abs(freqs - n * fundamental_freq)) i_harmonic = np.abs(fft[idx_harmonic]) harmonic_sum += i_harmonic**2
# THD thd = np.sqrt(harmonic_sum) / i_fundamental return thd * 100 # Percentage
# Example: Measure current waveform from EV charger waveform = measure_current_waveform() # From oscilloscope or power analyzer thd = calculate_thd(waveform, sample_rate=10000, fundamental_freq=60) # Result: THD = 8% (exceeds IEEE 519 limit of 5%) # Solution: Add harmonic filter or use charger with better PFC ```
- **Harmonic mitigation**:
- **Passive filter**: LC filter tuned to attenuate specific harmonics (5th, 7th)
- **Active filter**: Inject counter-harmonics to cancel distortion
- **Better PFC chargers**: High-quality boost PFC (THD <3%), totem-pole PFC (THD <2%)
### Power Quality Metrics
- **Voltage flicker**: Rapid voltage fluctuations (e.g., EV charger ramping up/down)
- Metric: P_st (short-term flicker severity), P_lt (long-term)
- Limit: P_st < 1.0 (IEC 61000-4-15)
- Mitigation: Slow ramp rates (1 kW/s instead of instantaneous), energy storage buffer
- **Power factor**: Ratio of real power to apparent power
- Poor PF: Higher current for same real power → increased losses, voltage drop
- Target: PF > 0.95 (utility requirement)
- EV chargers: PFC stage maintains PF >0.95
### Grid Upgrade Planning
- **Capacity planning for EV depots**:
- Scenario: 50-bus electric depot, 200 kWh per bus, 50 kW chargers
- Total energy: 50 buses × 200 kWh = 10,000 kWh/night
- Charging window: 8 hours (10 PM - 6 AM)
- Power required: 10,000 kWh / 8 hours = 1,250 kW average
- Peak demand (all chargers on): 50 buses × 50 kW = 2,500 kW
- Smart charging: Spread load → 1,500 kW peak (avoid demand charge spike)
- **Grid upgrade cost analysis**:
```python def grid_upgrade_cost(current_capacity_kw, required_capacity_kw): upgrade_needed_kw = max(0, required_capacity_kw - current_capacity_kw)
if upgrade_needed_kw == 0: return {"upgrade_needed": False, "cost": 0}
# Cost factors transformer_cost_per_kw = 150 # $/kW (new transformer) feeder_cost_per_kw = 50 # $/kW (upgrade conductor) substation_cost_per_kw = 300 # $/kW (substation expansion, if needed)
# Check if substation upgrade needed if required_capacity_kw > 5000: # >5 MW → substation upgrade total_cost = upgrade_needed_kw * substation_cost_per_kw upgrade_type = "Substation expansion" elif upgrade_needed_kw > 500: # >500 kW → feeder upgrade total_cost = upgrade_needed_kw * feeder_cost_per_kw upgrade_type = "Feeder upgrade" else: # <500 kW → transformer upgrade total_cost = upgrade_needed_kw * transformer_cost_per_kw upgrade_type = "Transformer upgrade"
return { "upgrade_needed": True, "upgrade_kw": upgrade_needed_kw, "upgrade_type": upgrade_type, "cost_usd": total_cost }
# Example: Depot needs 1,500 kW, current capacity 500 kW result = grid_upgrade_cost(current_capacity_kw=500, required_capacity_kw=1500) # Result: {"upgrade_needed": True, "upgrade_kw": 1000, "upgrade_type": "Feeder upgrade", "cost_usd": $50,000} ```
- **Utility interconnection process**:
1. Submit interconnection application (utility form, site plan, load estimate)
2. Utility conducts impact study (transformer loading, voltage drop, protection coordination)
3. Utility determines upgrade requirements (transformer, feeder, substation)
4. Developer pays impact fee (proportional to load added, e.g., $100-500/kW)
5. Utility performs upgrades (3-12 months timeline)
6. Interconnection approved, charger installation proceeds
### Load Diversity and Coincidence
- **Coincidence factor**: Probability of multiple EVs charging simultaneously
- Residential: Low (0.3-0.5) — people arrive home at different times
- Workplace: Medium (0.5-0.7) — arrive in morning, plug in
- Depot: High (0.8-1.0) — all vehicles return at same time, charge overnight
- **Diversity factor**: Inverse of coincidence (1 / coincidence_factor)
- Used to reduce oversizing of transformers
### Grid Simulation and Modeling
- **Software tools**:
- **OpenDSS**: Open-source distribution system simulator (EPRI)
- **GridLAB-D**: Agent-based grid simulation (PNNL)
- **PowerWorld**: Commercial power flow analysis
- **MATLAB/Simulink**: Custom grid models
- **Simulation workflow**:
1. Model distribution feeder (transformers, lines, loads)
2. Add EV charging loads (time-series data, charging profiles)
3. Run power flow analysis (voltage, current, losses at each node)
4. Identify violations (overvoltage, undervoltage, overload)
5. Test mitigation strategies (smart charging, voltage regulators, energy storage)
## Approach
1. **Data collection**: Gather feeder data (conductor size, transformer ratings, historical load)
2. **EV adoption forecast**: Estimate EV penetration over time (5%, 20%, 50%)
3. **Load modeling**: Create EV charging profiles (uncontrolled vs smart charging)
4. **Power flow simulation**: Run grid simulation with EV loads (OpenDSS, GridLAB-D)
5. **Impact assessment**: Identify overloaded transformers, voltage violations, harmonic issues
6. **Mitigation planning**: Design upgrades (transformer, feeder, voltage regulators)
7. **Cost-benefit analysis**: Compare grid upgrade cost vs smart charging benefits
## Deliverables
- Grid impact study report (transformer loading, voltage drop, harmonics)
- Load flow simulation results (voltage profiles, equipment loading)
- Upgrade recommendations (transformer sizing, feeder conductor, voltage regulators)
- Cost estimate for grid upgrades (equipment, installation, utility fees)
- Smart charging strategy (time-shift charging to off-peak, reduce peak demand)
## Best Practices
- **Conservative assumptions**: Use 1.0 coincidence factor for worst-case analysis
- **Validation**: Compare simulation results to field measurements (voltage, current)
- **Utility coordination**: Engage utility early (avoid delays, surprises)
- **Phased approach**: Start with pilot (10-20% EVs), monitor, expand gradually
- **Data-driven**: Use actual charging data (not assumptions) for load profiles
## Integration
- **SCADA**: Real-time monitoring of transformer loading, feeder voltage
- **Smart meters**: AMI data for EV charging detection, load profiling
- **OpenADR**: Demand response signals to reduce charging during peak
- **DER management**: Coordinate with solar, battery storage for grid support
### charging-safety-standards
## Core Competencies
Expert in electric vehicle charging safety standards, regulations, and certification processes, covering ground fault protection, insulation monitoring, emergency stop systems, electrical safety interlock, arc flash protection, and comprehensive hazard analysis for charging infrastructure.
### Key Safety Standards
- **IEC 61851-1**: General requirements for EV conductive charging
- Safety classification, protection against electric shock
- Control pilot function (PWM signaling for current limit)
- Ground fault protection (RCD) requirements
- Connector safety interlock
- **IEC 61851-21/22/23/24**: Specific requirements
- 61851-21: On-board charger requirements
- 61851-22: AC charging station requirements
- 61851-23: DC charging station requirements (high power)
- 61851-24: Digital communication for control (ISO 15118 integration)
- **UL 2594 / UL 2202** (North America):
- UL 2594: EV charging system equipment (US/Canada)
- UL 2202: EV charging system equipment (older standard)
- Fire safety, overcurrent protection, grounding
- Environmental testing (temperature, humidity, vibration)
- **SAE J1772**: AC connector and control pilot safety
- Mechanical interlock (cannot unplug while energized)
- Control pilot states (A, B, C, D, E, F)
- Proximity pilot (cable current rating detection)
### Ground Fault Protection
- **AC ground fault (GFCI)**:
- Detects leakage current: I_hot + I_neutral ≠ 0 (>20 mA for EV, vs 5 mA for household)
- Trip time: <25 ms per IEC 61851-1
- Self-test: Monthly automatic test (inject fault signal, verify trip)
- **DC ground fault (RCD)**:
- Residual current device: Monitors I_DC+ + I_DC- (should be zero if no leakage)
- Threshold: >20 mA (IEC 61851-23)
- Sensor: Hall effect current sensors on both DC rails
- Trip time: <100 ms
- **GFCI implementation**:
```c #define GFCI_THRESHOLD_MA 20.0 #define GFCI_TRIP_TIME_MS 25
typedef struct { float i_hot; float i_neutral; uint32_t fault_start_time; bool fault_active; } GFCI_t;
void GFCI_Monitor(GFCI_t* gfci) { gfci->i_hot = ADC_ReadCurrent(CH_HOT); gfci->i_neutral = ADC_ReadCurrent(CH_NEUTRAL);
float residual_current = fabs(gfci->i_hot + gfci->i_neutral) * 1000.0;
if (residual_current > GFCI_THRESHOLD_MA) { if (!gfci->fault_active) { gfci->fault_active = true; gfci->fault_start_time = GetTickCount(); }
if (GetTickCount() - gfci->fault_start_time > GFCI_TRIP_TIME_MS) {
### Insulation Monitoring
- **Purpose**: Detect insulation breakdown between HV (DC+, DC-) and chassis ground
- **Method**:
- Inject low-frequency AC or DC test signal between HV and ground
- Measure leakage current
- Calculate insulation resistance: R_iso = V_test / I_leakage
- **Threshold**: Per IEC 61851-23
- R_iso > 100 Ω/V (e.g., >40 kΩ for 400V system, >80 kΩ for 800V)
- Test before charging (pre-charge check)
- Continuous monitoring during charging
- **Insulation test circuit**:
``` HV+ ───┬─── 100kΩ test resistor ───┬─── Ground │ │ IMD Current sensor HV- ───┴─────────────────────────┘ ```
- **IMD (Insulation Monitoring Device) code**:
```c #define R_ISO_MIN_OHM_PER_V 100.0
float MeasureInsulationResistance(float v_hv) {
RemoveTestVoltage();
return r_iso; }
bool CheckInsulationIntegrity(float v_hv) { float r_iso = MeasureInsulationResistance(v_hv); float r_iso_min = R_ISO_MIN_OHM_PER_V * v_hv;
if (r_iso < r_iso_min) { LogError("Insulation fault: R_iso=%.0f Ω (min=%.0f Ω)", r_iso, r_iso_min); return false; }
return true; } ```
### Emergency Stop (E-Stop) System
- **Requirements** (IEC 60204-1):
- Hardwired: E-stop button directly interrupts contactor coil (not software)
- Latching: Requires manual reset (twist or pull button to reset)
- Response time: <500 ms from button press to contactors open
- Red button with yellow background (universally recognized)
- **E-stop circuit**:
``` 24V DC ───┬─── E-stop Button (NC contact) ───┬─── Contactor Coil ───┬─── Ground │ │ │ │ Safety Relay Circuit Breaker ```
- **E-stop firmware**:
```c void CheckEmergencyStop(void) { bool e_stop_pressed = !GPIO_Read(PIN_EMERGENCY_STOP);
if (e_stop_pressed) {
LogInfo("Emergency stop reset"); } } ```
### Control Pilot Safety (SAE J1772)
- **Control Pilot (CP) states**:
- State A: +12V (no vehicle connected)
- State B: +9V (vehicle connected, not ready to charge)
- State C: +6V (vehicle ready, charging allowed)
- State D: +3V (vehicle ready with ventilation required, not used in modern EVs)
- State E: 0V (short circuit, fault)
- State F: -12V (EVSE fault, no power available)
- **Safety interlock**:
- EVSE monitors CP voltage to detect vehicle connection state
- Charging only allowed in State C (vehicle ready)
- If CP transitions to State A (unplugged) while charging → immediate shutoff
- **CP monitoring code**:
```c typedef enum { CP_STATE_A,
CPState_t ReadCPState(void) { float v_cp = ADC_ReadVoltage(CH_CONTROL_PILOT);
if (v_cp > 11.0 && v_cp < 13.0) return CP_STATE_A; if (v_cp > 8.0 && v_cp < 10.0) return CP_STATE_B; if (v_cp > 5.0 && v_cp < 7.0) return CP_STATE_C; if (v_cp < 1.0) return CP_STATE_E; if (v_cp < -10.0) return CP_STATE_F;
return CP_STATE_E;
void CPSafetyMonitor(void) { static CPState_t prev_state = CP_STATE_A; CPState_t current_state = ReadCPState();
if (current_state == CP_STATE_C) {
prev_state = current_state; } ```
### Overcurrent and Overvoltage Protection
- **Overcurrent**:
- Hardware: Circuit breaker or fuse (40A for Level 2, 500A+ for DC fast)
- Software: Monitor current via hall effect sensor, trip if >120% of rated for >1 second
- **Overvoltage**:
- Hardware: Varistor (MOV) for transient spikes (e.g., lightning)
- Software: Monitor voltage, trip if >110% of rated for >100 ms
- **Short circuit**:
- Hardware: Fast-acting fuse or electronic circuit breaker
- Software: Detect current spike (>200% rated), trip within 10 ms
### Arc Flash Protection
- **Hazard**: High-voltage DC arcs difficult to extinguish (no zero-crossing like AC)
- **Detection**:
- Optical sensor: UV photodetector senses arc flash (bright UV signature)
- Current sensor: Detect sudden surge (arc creates low-impedance path)
- **Mitigation**:
- Fast disconnect: Open contactors within 5 ms of arc detection
- Arc-resistant contactors: Magnetic blowout coil to extinguish arc
- Energy limitation: Limit stored energy in DC bus capacitors (<40 cal/cm² per NFPA 70E)
### Welding Detection
- **Scenario**: Contactor contacts weld closed (high inrush current causes welding)
- **Detection**: After opening contactor, measure voltage across contactor
- If V_across_contactor = 0V → contactor welded (still conducting)
- If V_across_contactor = V_bus → contactor open correctly
- **Response**: If welded, abort session, display error, require service
### Hazard Analysis (FMEA / FTA)
- **FMEA (Failure Modes and Effects Analysis)**:
- Identify failure modes (e.g., contactor fails closed)
- Assess severity (1-10), occurrence (1-10), detection (1-10)
- Calculate RPN (Risk Priority Number) = S × O × D
- Prioritize mitigation for high RPN items
- **Example FMEA entry**:
| Component | Failure Mode | Effect | Severity | Occurrence | Detection | RPN | Mitigation | |-----------|--------------|--------|----------|------------|-----------|-----|------------| | Contactor | Fails closed (welded) | Cannot de-energize, user shock hazard | 9 | 3 | 5 | 135 | Add welding detection, redundant contactor |
- **FTA (Fault Tree Analysis)**:
- Top event: "User receives electric shock"