feat: 添加海上风电场集电线路设计优化工具

This commit is contained in:
dmy
2025-12-31 19:21:25 +08:00
commit 2f70b2fc72
3 changed files with 810 additions and 0 deletions

43
generate_template.py Normal file
View File

@@ -0,0 +1,43 @@
import pandas as pd
import numpy as np
def create_template():
# Create sample data similar to the internal generator
data = []
# Add Substation
data.append({
'Type': 'Substation',
'ID': 'Sub1',
'X': 4000,
'Y': -800,
'Power': 0
})
# Add Turbines (Grid layout)
n_turbines = 30
spacing = 800
n_cols = 6
for i in range(n_turbines):
row = i // n_cols
col = i % n_cols
x = col * spacing
y = row * spacing
data.append({
'Type': 'Turbine',
'ID': i,
'X': x,
'Y': y,
'Power': np.random.uniform(6.0, 10.0)
})
df = pd.DataFrame(data)
# Save to Excel
output_file = 'coordinates.xlsx'
df.to_excel(output_file, index=False)
print(f"Created sample file: {output_file}")
if __name__ == "__main__":
create_template()