site-calc-investment 1.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- site_calc_investment/__init__.py +100 -0
- site_calc_investment/analysis/__init__.py +17 -0
- site_calc_investment/analysis/comparison.py +121 -0
- site_calc_investment/analysis/financial.py +202 -0
- site_calc_investment/api/__init__.py +5 -0
- site_calc_investment/api/client.py +442 -0
- site_calc_investment/exceptions.py +91 -0
- site_calc_investment/models/__init__.py +84 -0
- site_calc_investment/models/common.py +174 -0
- site_calc_investment/models/devices.py +263 -0
- site_calc_investment/models/requests.py +133 -0
- site_calc_investment/models/responses.py +105 -0
- site_calc_investment-1.2.0.dist-info/METADATA +256 -0
- site_calc_investment-1.2.0.dist-info/RECORD +16 -0
- site_calc_investment-1.2.0.dist-info/WHEEL +4 -0
- site_calc_investment-1.2.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: site-calc-investment
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: Python client for Site-Calc investment planning (capacity sizing, ROI analysis)
|
|
5
|
+
Project-URL: Homepage, https://github.com/stranma/site-calc-investment
|
|
6
|
+
Project-URL: Documentation, https://github.com/stranma/site-calc-investment#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/stranma/site-calc-investment
|
|
8
|
+
Project-URL: Issues, https://github.com/stranma/site-calc-investment/issues
|
|
9
|
+
Author-email: Site-Calc Team <info@site-calc.example.com>
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: capacity-planning,energy,investment,npv,roi
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: httpx>=0.24
|
|
24
|
+
Requires-Dist: numpy>=1.24
|
|
25
|
+
Requires-Dist: pydantic>=2.0
|
|
26
|
+
Requires-Dist: python-dateutil>=2.8
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: mypy>=1.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: pandas>=2.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest-timeout>=2.2; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: ruff>=0.1; extra == 'dev'
|
|
35
|
+
Requires-Dist: tzdata>=2024.1; extra == 'dev'
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
|
|
38
|
+
# Site-Calc Investment Client
|
|
39
|
+
|
|
40
|
+
Python client for Site-Calc investment planning API - long-term capacity planning and ROI analysis.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install site-calc-investment
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from datetime import datetime
|
|
52
|
+
from zoneinfo import ZoneInfo
|
|
53
|
+
from site_calc_investment import InvestmentClient
|
|
54
|
+
from site_calc_investment.models import (
|
|
55
|
+
TimeSpan, Resolution, Site, Battery, ElectricityImport,
|
|
56
|
+
InvestmentPlanningRequest, InvestmentParameters, OptimizationConfig
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# Initialize client
|
|
60
|
+
client = InvestmentClient(
|
|
61
|
+
base_url="https://api.site-calc.example.com",
|
|
62
|
+
api_key="inv_your_api_key_here"
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
# Create 10-year planning horizon (1-hour resolution)
|
|
66
|
+
timespan = TimeSpan(
|
|
67
|
+
start=datetime(2025, 1, 1, tzinfo=ZoneInfo("Europe/Prague")),
|
|
68
|
+
intervals=87600, # 10 years × 8760 hours/year
|
|
69
|
+
resolution=Resolution.HOUR_1
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
# Define devices (NO ancillary_services field)
|
|
73
|
+
battery = Battery(
|
|
74
|
+
name="Battery1",
|
|
75
|
+
properties={
|
|
76
|
+
"capacity": 10.0,
|
|
77
|
+
"max_power": 5.0,
|
|
78
|
+
"efficiency": 0.90,
|
|
79
|
+
"initial_soc": 0.5
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
grid_import = ElectricityImport(
|
|
84
|
+
name="GridImport",
|
|
85
|
+
properties={"price": prices_10y, "max_import": 8.0}
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
site = Site(site_id="investment_site", devices=[battery, grid_import])
|
|
89
|
+
|
|
90
|
+
# Investment parameters
|
|
91
|
+
inv_params = InvestmentParameters(
|
|
92
|
+
discount_rate=0.05,
|
|
93
|
+
device_capital_costs={"Battery1": 500000}, # €500k CAPEX
|
|
94
|
+
device_annual_opex={"Battery1": 5000} # €5k/year O&M
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
# Create and submit optimization request
|
|
98
|
+
request = InvestmentPlanningRequest(
|
|
99
|
+
sites=[site],
|
|
100
|
+
timespan=timespan,
|
|
101
|
+
investment_parameters=inv_params,
|
|
102
|
+
optimization_config=OptimizationConfig(
|
|
103
|
+
objective="maximize_npv",
|
|
104
|
+
time_limit_seconds=3600
|
|
105
|
+
)
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
job = client.create_planning_job(request)
|
|
109
|
+
result = client.wait_for_completion(job.job_id, poll_interval=30, timeout=7200)
|
|
110
|
+
|
|
111
|
+
# Display investment metrics
|
|
112
|
+
metrics = result.summary.investment_metrics
|
|
113
|
+
print(f"NPV: €{metrics.npv:,.0f}")
|
|
114
|
+
print(f"IRR: {metrics.irr*100:.2f}%")
|
|
115
|
+
print(f"Payback: {metrics.payback_period_years:.1f} years")
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Features
|
|
119
|
+
|
|
120
|
+
- ✅ Long-term capacity planning (1-10 years)
|
|
121
|
+
- ✅ Investment ROI analysis (NPV, IRR, payback)
|
|
122
|
+
- ✅ Scenario comparison utilities
|
|
123
|
+
- ✅ Financial analysis helpers
|
|
124
|
+
- ✅ 1-hour resolution optimization
|
|
125
|
+
- ✅ Multi-site optimization
|
|
126
|
+
- ✅ Type-safe Pydantic models
|
|
127
|
+
- ✅ Automatic retry and error handling
|
|
128
|
+
- ✅ Job management (cancel single or all jobs)
|
|
129
|
+
|
|
130
|
+
## Capabilities
|
|
131
|
+
|
|
132
|
+
| Feature | Value |
|
|
133
|
+
|---------|-------|
|
|
134
|
+
| Max Horizon | 100,000 intervals (~11 years at 1-hour) |
|
|
135
|
+
| Resolution | 1-hour only |
|
|
136
|
+
| ANS Support | No |
|
|
137
|
+
| Binary Variables | Relaxed to continuous |
|
|
138
|
+
| Timeout | 3600 seconds (1 hour) |
|
|
139
|
+
|
|
140
|
+
## Supported Devices
|
|
141
|
+
|
|
142
|
+
- Battery (NO ANS)
|
|
143
|
+
- CHP - Combined Heat and Power (continuous operation)
|
|
144
|
+
- Heat Accumulator
|
|
145
|
+
- Photovoltaic
|
|
146
|
+
- Heat Demand
|
|
147
|
+
- Electricity Demand
|
|
148
|
+
- Electricity Import/Export (market interface)
|
|
149
|
+
- Gas Import (market interface)
|
|
150
|
+
- Heat Export (market interface)
|
|
151
|
+
|
|
152
|
+
## Job Management
|
|
153
|
+
|
|
154
|
+
The client provides methods for managing optimization jobs:
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
# Create a job
|
|
158
|
+
job = client.create_planning_job(request)
|
|
159
|
+
print(f"Job ID: {job.job_id}")
|
|
160
|
+
|
|
161
|
+
# Check job status
|
|
162
|
+
status = client.get_job_status(job.job_id)
|
|
163
|
+
print(f"Status: {status.status}, Progress: {status.progress}%")
|
|
164
|
+
|
|
165
|
+
# Wait for completion
|
|
166
|
+
result = client.wait_for_completion(job.job_id, poll_interval=30, timeout=7200)
|
|
167
|
+
|
|
168
|
+
# Cancel a single job
|
|
169
|
+
cancelled = client.cancel_job(job.job_id)
|
|
170
|
+
|
|
171
|
+
# Cancel all pending/running jobs (bulk cancel)
|
|
172
|
+
result = client.cancel_all_jobs()
|
|
173
|
+
print(f"Cancelled {result['cancelled_count']} jobs")
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Financial Analysis
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
from site_calc_investment.analysis import (
|
|
180
|
+
calculate_npv,
|
|
181
|
+
calculate_irr,
|
|
182
|
+
calculate_payback_period,
|
|
183
|
+
compare_scenarios
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
# NPV calculation
|
|
187
|
+
npv = calculate_npv(
|
|
188
|
+
cash_flows=annual_revenues,
|
|
189
|
+
discount_rate=0.05,
|
|
190
|
+
initial_investment=-1500000
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
# IRR calculation
|
|
194
|
+
irr = calculate_irr([-1500000] + annual_revenues)
|
|
195
|
+
|
|
196
|
+
# Scenario comparison
|
|
197
|
+
comparison = compare_scenarios(
|
|
198
|
+
[result_5mw, result_10mw, result_15mw],
|
|
199
|
+
names=["5 MW", "10 MW", "15 MW"]
|
|
200
|
+
)
|
|
201
|
+
print(comparison) # DataFrame with NPV, IRR, costs, revenues
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Documentation
|
|
205
|
+
|
|
206
|
+
Full documentation available at: https://docs.site-calc.example.com/investment-client
|
|
207
|
+
|
|
208
|
+
## Examples
|
|
209
|
+
|
|
210
|
+
See `examples/` directory for complete examples:
|
|
211
|
+
- `capacity_planning.py` - 10-year capacity planning workflow
|
|
212
|
+
- `roi_analysis.py` - Investment ROI calculation
|
|
213
|
+
- `scenario_comparison.py` - Compare device configurations
|
|
214
|
+
|
|
215
|
+
## Requirements
|
|
216
|
+
|
|
217
|
+
- Python ≥ 3.10
|
|
218
|
+
- API key with `inv_` prefix (investment client)
|
|
219
|
+
|
|
220
|
+
## Key Differences from Operational Client
|
|
221
|
+
|
|
222
|
+
- ❌ No `/optimal-bidding` endpoint
|
|
223
|
+
- ❌ No `ancillary_services` on devices
|
|
224
|
+
- ❌ No 15-minute resolution (1-hour only)
|
|
225
|
+
- ✅ Up to 100,000 intervals (vs. 296)
|
|
226
|
+
- ✅ Investment metrics (NPV, IRR, payback)
|
|
227
|
+
- ✅ Financial analysis helpers
|
|
228
|
+
|
|
229
|
+
## Development
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
# Install with dev dependencies
|
|
233
|
+
pip install -e ".[dev]"
|
|
234
|
+
|
|
235
|
+
# Run tests
|
|
236
|
+
pytest
|
|
237
|
+
|
|
238
|
+
# Format code
|
|
239
|
+
ruff format .
|
|
240
|
+
|
|
241
|
+
# Type check
|
|
242
|
+
mypy site_calc_investment
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## License
|
|
246
|
+
|
|
247
|
+
MIT License
|
|
248
|
+
|
|
249
|
+
## Support
|
|
250
|
+
|
|
251
|
+
- Issues: https://github.com/stranma/site-calc-investment/issues
|
|
252
|
+
- Documentation: https://github.com/stranma/site-calc-investment#readme
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
Part of the [Site-Calc](https://github.com/stranma/site-calc) platform.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
site_calc_investment/__init__.py,sha256=V7A9Rf_xLhkx2jqzxcrowiI6n8nsEAmUXFknYVXjvZ4,2084
|
|
2
|
+
site_calc_investment/exceptions.py,sha256=dz1wXM3Y4hHzK-PaQPY7sFPgLwUd6bZyWfJDVH9aBZk,2108
|
|
3
|
+
site_calc_investment/analysis/__init__.py,sha256=u6nwlhY3gQnxn-nkUGc68ynmoBU7NUt3uoUuM9AfQIs,414
|
|
4
|
+
site_calc_investment/analysis/comparison.py,sha256=3aqKpVcGy-2YfQZjS6qAzN12vuzvwDmE1JgZn6fuuIE,4487
|
|
5
|
+
site_calc_investment/analysis/financial.py,sha256=gzKYmylGDKZDqx1ZBefZwJMS9NuflH5NYjnFm6Tyw0g,6361
|
|
6
|
+
site_calc_investment/api/__init__.py,sha256=LmrMw5jO24beExGtcau7B34NnMkJUmDsHngEdzuCans,140
|
|
7
|
+
site_calc_investment/api/client.py,sha256=Uh4yYPIC9oL1uiaaTe36xFeb5yfOsxkMetZojxRZoJs,15064
|
|
8
|
+
site_calc_investment/models/__init__.py,sha256=aJsKxZGYe8AwsB7ZVrjRJs961iCd6KNKN5fpeYe52FY,1779
|
|
9
|
+
site_calc_investment/models/common.py,sha256=r6Acg8uICJTETQ1FoVuBEdM8ThLQqwCVhclYO3kmCAY,5817
|
|
10
|
+
site_calc_investment/models/devices.py,sha256=RmlbcxjavC3nFRyCJ6n8aUp2ZosVTpszmMmJfqpgd9c,9895
|
|
11
|
+
site_calc_investment/models/requests.py,sha256=K3ESSgh3Qkq26jIL3TLTD6TRGmttVSiUUPTdbCmwRiw,5089
|
|
12
|
+
site_calc_investment/models/responses.py,sha256=pmFfhSCAlCUZTxRDh0IdBn5znJiiFjF7U3LHZON_yQY,5482
|
|
13
|
+
site_calc_investment-1.2.0.dist-info/METADATA,sha256=-HNe_BKFtvJ98IlTsXgZvGsCvLwR0RpIxycwe9n6a0w,6949
|
|
14
|
+
site_calc_investment-1.2.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
15
|
+
site_calc_investment-1.2.0.dist-info/licenses/LICENSE,sha256=tmWogc4edAjn_ccDCKSLvMGW7asakJnAlQWuNqgApIs,1071
|
|
16
|
+
site_calc_investment-1.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Site-Calc Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|