Initial commit

This commit is contained in:
ChuXun
2026-02-16 21:52:26 +08:00
commit 18ce59bec7
334 changed files with 35333 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
"""
Fig 1: Macro-Logic Flowchart
Shows the three-stage problem-solving approach
"""
import os
from graphviz import Digraph
from plot_style import save_figure
def make_figure(config):
"""Generate Fig 1: Macro-Logic Flowchart"""
dot = Digraph(comment='Macro Logic Flowchart')
dot.attr(rankdir='TB', size='8,10')
dot.attr('node', shape='box', style='rounded,filled', fillcolor='lightblue',
fontname='Times New Roman', fontsize='11')
dot.attr('edge', fontname='Times New Roman', fontsize='10')
# Stage 1: Data Processing
with dot.subgraph(name='cluster_0') as c:
c.attr(label='Stage 1: Data Processing', style='dashed')
c.node('A1', 'Battery Data\n(Voltage, Capacity)')
c.node('A2', 'OCV Curve Fitting\n(Modified Shepherd)')
c.node('A3', 'Parameter Extraction\n(R₀, E_a, thermal)')
c.edge('A1', 'A2')
c.edge('A2', 'A3')
# Stage 2: Core Modeling
with dot.subgraph(name='cluster_1') as c:
c.attr(label='Stage 2: Core Modeling', style='dashed', fillcolor='lightyellow')
c.node('B1', 'User Activity Inputs\n(L, C, N, G, T_a)', fillcolor='lightyellow')
c.node('B2', 'Power Mapping\n(P_total calculation)', fillcolor='lightyellow')
c.node('B3', 'CPL Feedback Loop\n(P = I × V_term)', fillcolor='lightyellow')
c.node('B4', 'Battery State Update\n(SOC, Voltage, Temp)', fillcolor='lightyellow')
c.edge('B1', 'B2')
c.edge('B2', 'B3')
c.edge('B3', 'B4')
c.edge('B4', 'B3', label='Feedback', style='dashed', color='red')
# Stage 3: Applications
with dot.subgraph(name='cluster_2') as c:
c.attr(label='Stage 3: Applications', style='dashed')
c.node('C1', 'TTE Prediction\n(Time to Empty)', fillcolor='lightgreen')
c.node('C2', 'Scenario Analysis\n(Video, Gaming, Nav)', fillcolor='lightgreen')
c.node('C3', 'Uncertainty Quantification\n(Monte Carlo)', fillcolor='lightgreen')
c.node('C4', 'Aging Forecast\n(Multi-cycle SOH)', fillcolor='lightgreen')
c.edge('C1', 'C2')
c.edge('C2', 'C3')
c.edge('C3', 'C4')
# Inter-stage connections
dot.edge('A3', 'B1', label='Parameters')
dot.edge('B4', 'C1', label='State Trajectory')
# Output directory
figure_dir = config.get('global', {}).get('figure_dir', 'figures')
os.makedirs(figure_dir, exist_ok=True)
# Render
output_base = os.path.join(figure_dir, 'Fig01_Macro_Logic')
dot.render(output_base, format='pdf', cleanup=True)
dot.render(output_base, format='png', cleanup=True)
return {
"output_files": [f"{output_base}.pdf", f"{output_base}.png"],
"computed_metrics": {},
"validation_flags": {},
"pass": True
}