feat: 添加海上风电场集电线路设计优化工具
This commit is contained in:
43
generate_template.py
Normal file
43
generate_template.py
Normal 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()
|
||||
Reference in New Issue
Block a user