optivgi 0.1.0__tar.gz

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.
optivgi-0.1.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
optivgi-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,234 @@
1
+ Metadata-Version: 2.4
2
+ Name: optivgi
3
+ Version: 0.1.0
4
+ Summary: An EV smart charging management application designed to optimize electric vehicle charging based on power or pricing constraints.
5
+ Author-email: Nithin Manne <nmanne@anl.gov>, Jason Harper <jharper@anl.gov>
6
+ License: Apache License
7
+ Version 2.0, January 2004
8
+ http://www.apache.org/licenses/
9
+
10
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
11
+
12
+ 1. Definitions.
13
+
14
+ "License" shall mean the terms and conditions for use, reproduction,
15
+ and distribution as defined by Sections 1 through 9 of this document.
16
+
17
+ "Licensor" shall mean the copyright owner or entity authorized by
18
+ the copyright owner that is granting the License.
19
+
20
+ "Legal Entity" shall mean the union of the acting entity and all
21
+ other entities that control, are controlled by, or are under common
22
+ control with that entity. For the purposes of this definition,
23
+ "control" means (i) the power, direct or indirect, to cause the
24
+ direction or management of such entity, whether by contract or
25
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
26
+ outstanding shares, or (iii) beneficial ownership of such entity.
27
+
28
+ "You" (or "Your") shall mean an individual or Legal Entity
29
+ exercising permissions granted by this License.
30
+
31
+ "Source" form shall mean the preferred form for making modifications,
32
+ including but not limited to software source code, documentation
33
+ source, and configuration files.
34
+
35
+ "Object" form shall mean any form resulting from mechanical
36
+ transformation or translation of a Source form, including but
37
+ not limited to compiled object code, generated documentation,
38
+ and conversions to other media types.
39
+
40
+ "Work" shall mean the work of authorship, whether in Source or
41
+ Object form, made available under the License, as indicated by a
42
+ copyright notice that is included in or attached to the work
43
+ (an example is provided in the Appendix below).
44
+
45
+ "Derivative Works" shall mean any work, whether in Source or Object
46
+ form, that is based on (or derived from) the Work and for which the
47
+ editorial revisions, annotations, elaborations, or other modifications
48
+ represent, as a whole, an original work of authorship. For the purposes
49
+ of this License, Derivative Works shall not include works that remain
50
+ separable from, or merely link (or bind by name) to the interfaces of,
51
+ the Work and Derivative Works thereof.
52
+
53
+ "Contribution" shall mean any work of authorship, including
54
+ the original version of the Work and any modifications or additions
55
+ to that Work or Derivative Works thereof, that is intentionally
56
+ submitted to Licensor for inclusion in the Work by the copyright owner
57
+ or by an individual or Legal Entity authorized to submit on behalf of
58
+ the copyright owner. For the purposes of this definition, "submitted"
59
+ means any form of electronic, verbal, or written communication sent
60
+ to the Licensor or its representatives, including but not limited to
61
+ communication on electronic mailing lists, source code control systems,
62
+ and issue tracking systems that are managed by, or on behalf of, the
63
+ Licensor for the purpose of discussing and improving the Work, but
64
+ excluding communication that is conspicuously marked or otherwise
65
+ designated in writing by the copyright owner as "Not a Contribution."
66
+
67
+ "Contributor" shall mean Licensor and any individual or Legal Entity
68
+ on behalf of whom a Contribution has been received by Licensor and
69
+ subsequently incorporated within the Work.
70
+
71
+ 2. Grant of Copyright License. Subject to the terms and conditions of
72
+ this License, each Contributor hereby grants to You a perpetual,
73
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
74
+ copyright license to reproduce, prepare Derivative Works of,
75
+ publicly display, publicly perform, sublicense, and distribute the
76
+ Work and such Derivative Works in Source or Object form.
77
+
78
+ 3. Grant of Patent License. Subject to the terms and conditions of
79
+ this License, each Contributor hereby grants to You a perpetual,
80
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
81
+ (except as stated in this section) patent license to make, have made,
82
+ use, offer to sell, sell, import, and otherwise transfer the Work,
83
+ where such license applies only to those patent claims licensable
84
+ by such Contributor that are necessarily infringed by their
85
+ Contribution(s) alone or by combination of their Contribution(s)
86
+ with the Work to which such Contribution(s) was submitted. If You
87
+ institute patent litigation against any entity (including a
88
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
89
+ or a Contribution incorporated within the Work constitutes direct
90
+ or contributory patent infringement, then any patent licenses
91
+ granted to You under this License for that Work shall terminate
92
+ as of the date such litigation is filed.
93
+
94
+ 4. Redistribution. You may reproduce and distribute copies of the
95
+ Work or Derivative Works thereof in any medium, with or without
96
+ modifications, and in Source or Object form, provided that You
97
+ meet the following conditions:
98
+
99
+ (a) You must give any other recipients of the Work or
100
+ Derivative Works a copy of this License; and
101
+
102
+ (b) You must cause any modified files to carry prominent notices
103
+ stating that You changed the files; and
104
+
105
+ (c) You must retain, in the Source form of any Derivative Works
106
+ that You distribute, all copyright, patent, trademark, and
107
+ attribution notices from the Source form of the Work,
108
+ excluding those notices that do not pertain to any part of
109
+ the Derivative Works; and
110
+
111
+ (d) If the Work includes a "NOTICE" text file as part of its
112
+ distribution, then any Derivative Works that You distribute must
113
+ include a readable copy of the attribution notices contained
114
+ within such NOTICE file, excluding those notices that do not
115
+ pertain to any part of the Derivative Works, in at least one
116
+ of the following places: within a NOTICE text file distributed
117
+ as part of the Derivative Works; within the Source form or
118
+ documentation, if provided along with the Derivative Works; or,
119
+ within a display generated by the Derivative Works, if and
120
+ wherever such third-party notices normally appear. The contents
121
+ of the NOTICE file are for informational purposes only and
122
+ do not modify the License. You may add Your own attribution
123
+ notices within Derivative Works that You distribute, alongside
124
+ or as an addendum to the NOTICE text from the Work, provided
125
+ that such additional attribution notices cannot be construed
126
+ as modifying the License.
127
+
128
+ You may add Your own copyright statement to Your modifications and
129
+ may provide additional or different license terms and conditions
130
+ for use, reproduction, or distribution of Your modifications, or
131
+ for any such Derivative Works as a whole, provided Your use,
132
+ reproduction, and distribution of the Work otherwise complies with
133
+ the conditions stated in this License.
134
+
135
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
136
+ any Contribution intentionally submitted for inclusion in the Work
137
+ by You to the Licensor shall be under the terms and conditions of
138
+ this License, without any additional terms or conditions.
139
+ Notwithstanding the above, nothing herein shall supersede or modify
140
+ the terms of any separate license agreement you may have executed
141
+ with Licensor regarding such Contributions.
142
+
143
+ 6. Trademarks. This License does not grant permission to use the trade
144
+ names, trademarks, service marks, or product names of the Licensor,
145
+ except as required for reasonable and customary use in describing the
146
+ origin of the Work and reproducing the content of the NOTICE file.
147
+
148
+ 7. Disclaimer of Warranty. Unless required by applicable law or
149
+ agreed to in writing, Licensor provides the Work (and each
150
+ Contributor provides its Contributions) on an "AS IS" BASIS,
151
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
152
+ implied, including, without limitation, any warranties or conditions
153
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
154
+ PARTICULAR PURPOSE. You are solely responsible for determining the
155
+ appropriateness of using or redistributing the Work and assume any
156
+ risks associated with Your exercise of permissions under this License.
157
+
158
+ 8. Limitation of Liability. In no event and under no legal theory,
159
+ whether in tort (including negligence), contract, or otherwise,
160
+ unless required by applicable law (such as deliberate and grossly
161
+ negligent acts) or agreed to in writing, shall any Contributor be
162
+ liable to You for damages, including any direct, indirect, special,
163
+ incidental, or consequential damages of any character arising as a
164
+ result of this License or out of the use or inability to use the
165
+ Work (including but not limited to damages for loss of goodwill,
166
+ work stoppage, computer failure or malfunction, or any and all
167
+ other commercial damages or losses), even if such Contributor
168
+ has been advised of the possibility of such damages.
169
+
170
+ 9. Accepting Warranty or Additional Liability. While redistributing
171
+ the Work or Derivative Works thereof, You may choose to offer,
172
+ and charge a fee for, acceptance of support, warranty, indemnity,
173
+ or other liability obligations and/or rights consistent with this
174
+ License. However, in accepting such obligations, You may act only
175
+ on Your own behalf and on Your sole responsibility, not on behalf
176
+ of any other Contributor, and only if You agree to indemnify,
177
+ defend, and hold each Contributor harmless for any liability
178
+ incurred by, or claims asserted against, such Contributor by reason
179
+ of your accepting any such warranty or additional liability.
180
+
181
+ END OF TERMS AND CONDITIONS
182
+
183
+ APPENDIX: How to apply the Apache License to your work.
184
+
185
+ To apply the Apache License to your work, attach the following
186
+ boilerplate notice, with the fields enclosed by brackets "[]"
187
+ replaced with your own identifying information. (Don't include
188
+ the brackets!) The text should be enclosed in the appropriate
189
+ comment syntax for the file format. We also recommend that a
190
+ file or class name and description of purpose be included on the
191
+ same "printed page" as the copyright notice for easier
192
+ identification within third-party archives.
193
+
194
+ Copyright [yyyy] [name of copyright owner]
195
+
196
+ Licensed under the Apache License, Version 2.0 (the "License");
197
+ you may not use this file except in compliance with the License.
198
+ You may obtain a copy of the License at
199
+
200
+ http://www.apache.org/licenses/LICENSE-2.0
201
+
202
+ Unless required by applicable law or agreed to in writing, software
203
+ distributed under the License is distributed on an "AS IS" BASIS,
204
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
205
+ See the License for the specific language governing permissions and
206
+ limitations under the License.
207
+
208
+ Project-URL: Homepage, https://github.com/nmanne-anlgov/Opti-VGI
209
+ Project-URL: Issues, https://github.com/nmanne-anlgov/Opti-VGI/issues
210
+ Classifier: Programming Language :: Python :: 3
211
+ Classifier: License :: OSI Approved :: Apache Software License
212
+ Classifier: Operating System :: OS Independent
213
+ Requires-Python: >=3.11
214
+ Description-Content-Type: text/markdown
215
+ License-File: LICENSE
216
+ Requires-Dist: pulp
217
+ Dynamic: license-file
218
+
219
+ # Argonne Opti-VGI
220
+
221
+ ### Opti-VGI: EV Smart Charging Scheduler Application
222
+
223
+ ## Description
224
+
225
+ Opti-VGI is an EV smart charging management application designed to optimize electric vehicle charging based on power or pricing constraints. This application can integrate with any OCPP 2.X CSMS to accomplish ISO 15118 charge scheduling
226
+
227
+
228
+ ## Proposed System Architecture
229
+
230
+ ### Translation Layer
231
+ - An application that interfaces between the Charge Station Management System (CSMS) and the Charge Scheduling Management Algorithm (CSM)
232
+
233
+ ### Modular Charge Scheduling Management (SCM) Application
234
+ - A modular framework that allows using different algorithms
@@ -0,0 +1,16 @@
1
+ # Argonne Opti-VGI
2
+
3
+ ### Opti-VGI: EV Smart Charging Scheduler Application
4
+
5
+ ## Description
6
+
7
+ Opti-VGI is an EV smart charging management application designed to optimize electric vehicle charging based on power or pricing constraints. This application can integrate with any OCPP 2.X CSMS to accomplish ISO 15118 charge scheduling
8
+
9
+
10
+ ## Proposed System Architecture
11
+
12
+ ### Translation Layer
13
+ - An application that interfaces between the Charge Station Management System (CSMS) and the Charge Scheduling Management Algorithm (CSM)
14
+
15
+ ### Modular Charge Scheduling Management (SCM) Application
16
+ - A modular framework that allows using different algorithms
File without changes
@@ -0,0 +1,31 @@
1
+ from abc import ABC, abstractmethod
2
+ from datetime import datetime
3
+ from typing import Optional
4
+
5
+ from .ev import EV, ChargingRateUnit
6
+ from .constants import AlgorithmConstants
7
+
8
+ class Algorithm(ABC):
9
+ """Abstract class for SCM Algorithms"""
10
+ def __init__(self, evs: list[EV], peak_power_demand: list[float], now: datetime):
11
+ self.evs = evs
12
+ self.peak_power_demand = peak_power_demand
13
+ self.now = now
14
+
15
+ assert len(self.peak_power_demand) == AlgorithmConstants.TIMESTEPS, f'Peak power demand must be the same length as the number of timesteps ({AlgorithmConstants.TIMESTEPS})'
16
+
17
+ @abstractmethod
18
+ def calculate(self) -> None:
19
+ """Run the algorithm to calculate the power for each EV"""
20
+
21
+ def get_current_power(self, unit: Optional[ChargingRateUnit] = None) -> dict[EV, dict]:
22
+ """Helper function to get the current time charging profiles for each EV"""
23
+ return {ev: ev.current_charging_profile(self.now, unit) for ev in self.evs}
24
+
25
+ def get_charging_profiles(self, unit: Optional[ChargingRateUnit] = None) -> dict[EV, dict]:
26
+ """Helper function to get the full charging profiles for each EV"""
27
+ return {ev: ev.charging_profile(self.now, unit) for ev in self.evs}
28
+
29
+ def get_total_energy_charged(self) -> dict[EV, float]:
30
+ """Helper function to get the total energy charged for each EV"""
31
+ return {ev: ev.energy_charged() for ev in self.evs}
@@ -0,0 +1,22 @@
1
+ from datetime import timedelta
2
+
3
+
4
+ class AlgorithmConstants:
5
+ """Constants for the SCM algorithm"""
6
+ RESOLUTION = timedelta(minutes=1)
7
+
8
+ RUNTIME = timedelta(hours=8)
9
+
10
+ TIMESTEPS = int(RUNTIME.total_seconds() / RESOLUTION.total_seconds())
11
+
12
+ POWER_ENERGY_FACTOR = RESOLUTION.total_seconds() / timedelta(hours=1).total_seconds()
13
+
14
+
15
+ class EVConstants:
16
+ """Constants for the EV"""
17
+ CHARGING_PROFILE_ID = 1
18
+ CHARGING_PROFILE_PURPOSE = 'TxProfile'
19
+ CHARGING_PROFILE_STACK_LEVEL = 1
20
+ CHARGING_PROFILE_KIND = 'Absolute'
21
+
22
+ CHARGING_RATE_VOLTAGE = 240
@@ -0,0 +1,118 @@
1
+ from dataclasses import dataclass, field
2
+ from enum import Enum
3
+ from datetime import datetime
4
+ from typing import Optional, Self
5
+
6
+ from .constants import EVConstants, AlgorithmConstants
7
+
8
+
9
+
10
+ class ChargingRateUnit(Enum):
11
+ '''Enum for Charging Rate Unit'''
12
+ W = 'W'
13
+ A = 'A'
14
+
15
+ def convert(self, value: float, unit: Self, voltage: Optional[float] = None) -> float:
16
+ '''Convert the power in kW/A to the correct unit'''
17
+ match unit:
18
+ case ChargingRateUnit.W:
19
+ power_w = value * 1000
20
+ case ChargingRateUnit.A:
21
+ power_w = value * voltage if voltage else EVConstants.CHARGING_RATE_VOLTAGE
22
+
23
+ if self == ChargingRateUnit.A:
24
+ return power_w / voltage if voltage else EVConstants.CHARGING_RATE_VOLTAGE
25
+
26
+ return power_w
27
+
28
+ @dataclass
29
+ class EV:
30
+ """Class for Storing EV attributes"""
31
+ ev_id: int
32
+ active: bool
33
+ station_id: int
34
+ connector_id: int
35
+ min_power: float # kW / A
36
+ max_power: float # kW / A
37
+
38
+ arrival_time: datetime
39
+ departure_time: datetime
40
+ energy: float # kWh / Ah
41
+
42
+ unit: ChargingRateUnit = ChargingRateUnit.W
43
+ voltage: float = EVConstants.CHARGING_RATE_VOLTAGE
44
+
45
+ power: list[float] = field(default_factory=lambda: [0.] * AlgorithmConstants.TIMESTEPS, repr=False)
46
+
47
+ def __eq__(self, other):
48
+ if not isinstance(other, EV):
49
+ return NotImplemented
50
+ return self.ev_id == other.ev_id
51
+
52
+ def __hash__(self):
53
+ return hash(self.ev_id)
54
+
55
+ def departure_index(self, now: datetime) -> int:
56
+ """Get the index of the departure time based on the current time"""
57
+ departure_index = int((self.departure_time - now).total_seconds() / AlgorithmConstants.RESOLUTION.total_seconds())
58
+ return max(0, min(departure_index, AlgorithmConstants.TIMESTEPS - 1))
59
+
60
+ def arrival_index(self, now: datetime) -> int:
61
+ """Get the index of the arrival time based on the current time"""
62
+ arrival_index = int((self.arrival_time - now).total_seconds() / AlgorithmConstants.RESOLUTION.total_seconds())
63
+ return max(0, min(arrival_index, AlgorithmConstants.TIMESTEPS - 1))
64
+
65
+ def energy_charged(self) -> float:
66
+ """Get the total energy charged by the EV"""
67
+ return sum(self.power) * AlgorithmConstants.POWER_ENERGY_FACTOR
68
+
69
+ def current_charging_profile(self, now: datetime, unit: Optional[ChargingRateUnit] = None) -> dict:
70
+ """Get the current time charging profile for the EV"""
71
+ if unit is None:
72
+ unit = self.unit
73
+ return {
74
+ "chargingProfileId": EVConstants.CHARGING_PROFILE_ID,
75
+ "stackLevel": EVConstants.CHARGING_PROFILE_STACK_LEVEL,
76
+ "chargingProfilePurpose": EVConstants.CHARGING_PROFILE_PURPOSE,
77
+ "chargingProfileKind": EVConstants.CHARGING_PROFILE_KIND,
78
+ "chargingSchedule": {
79
+ "startSchedule": now.strftime('%Y-%m-%dT%H:%M:%SZ'),
80
+ "chargingRateUnit": unit.value,
81
+ "chargingSchedulePeriod":[{
82
+ "startPeriod": 0,
83
+ "limit": unit.convert(self.power[0], self.unit, self.voltage),
84
+ "numberPhases": 1
85
+ }]
86
+ }
87
+ }
88
+
89
+ def charging_profile(self, now: datetime, unit: Optional[ChargingRateUnit] = None) -> dict:
90
+ """Get the full charging profile for the EV"""
91
+ if unit is None:
92
+ unit = self.unit
93
+
94
+ charging_schedule_period = [
95
+ {
96
+ "startPeriod": i * AlgorithmConstants.RESOLUTION.total_seconds(),
97
+ "limit": unit.convert(power, self.unit, self.voltage),
98
+ "numberPhases": 1
99
+ }
100
+ for i, power in enumerate(self.power)
101
+ ]
102
+
103
+ charging_schedule_period_compressed = [charging_schedule_period[0]]
104
+ for period in charging_schedule_period[1:]:
105
+ if period['limit'] != charging_schedule_period_compressed[-1]['limit']:
106
+ charging_schedule_period_compressed.append(period)
107
+
108
+ return {
109
+ "chargingProfileId": EVConstants.CHARGING_PROFILE_ID,
110
+ "stackLevel": EVConstants.CHARGING_PROFILE_STACK_LEVEL,
111
+ "chargingProfilePurpose": EVConstants.CHARGING_PROFILE_PURPOSE,
112
+ "chargingProfileKind": EVConstants.CHARGING_PROFILE_KIND,
113
+ "chargingSchedule": {
114
+ "startSchedule": now.strftime('%Y-%m-%dT%H:%M:%SZ'),
115
+ "chargingRateUnit": unit.value,
116
+ "chargingSchedulePeriod": charging_schedule_period_compressed
117
+ }
118
+ }
@@ -0,0 +1,154 @@
1
+ # pylint: disable=missing-function-docstring
2
+ import math
3
+ import logging
4
+ from dataclasses import dataclass, field
5
+
6
+ from .algorithm import Algorithm
7
+ from .constants import AlgorithmConstants
8
+ from .ev import EV
9
+
10
+
11
+ # Debug Flag
12
+ DEBUG = False
13
+
14
+ # Configuration
15
+ FAIRNESS_FACTOR = 1.
16
+ SHIFT_FRONT = True
17
+ ALLOC_REMAINING_EXTRA = True
18
+
19
+
20
+ class GoAlgorithm(Algorithm):
21
+ """SCM Algorithm created for use with the GO EV Scheduler"""
22
+
23
+ @dataclass
24
+ class EVPower:
25
+ """Class for allocating EV power"""
26
+ ev: EV
27
+ energy_left: float = field(init=False)
28
+
29
+ def __post_init__(self):
30
+ self.energy_left = self.ev.energy
31
+
32
+ def power(self, time: int, max_available=float('inf'), ignore_energy=False):
33
+ return max(
34
+ self.ev.min_power - self.ev.power[time],
35
+ min(self.ev.max_power - self.ev.power[time],
36
+ self.energy_left / AlgorithmConstants.POWER_ENERGY_FACTOR if not ignore_energy else float('inf'),
37
+ max_available))
38
+
39
+ def accept_power(self, time: int, power: float, ignore_energy=False):
40
+ try:
41
+ assert power <= self.power(time, ignore_energy=ignore_energy)
42
+ except AssertionError as e:
43
+ logging.error('Assertion Error: %s', e.args[0] if e.args else repr(e))
44
+ logging.error('EV: %s', self.ev)
45
+ logging.error('Time: %s', time)
46
+ logging.error('Power: %s', power)
47
+ logging.error('Energy Left: %s', self.energy_left)
48
+ logging.error('Power at Time: %s', self.ev.power[time])
49
+ if DEBUG:
50
+ logging.info('%s accepted %s at %s', self.ev.ev_id, power, time)
51
+ self.energy_left -= power * AlgorithmConstants.POWER_ENERGY_FACTOR
52
+ self.ev.power[time] += power
53
+
54
+ def shift_power(self, time_from: int, time_to: int, power: float):
55
+ if time_from == time_to:
56
+ return
57
+ try:
58
+ assert power <= self.ev.power[time_from]
59
+ assert power <= self.ev.max_power - self.ev.power[time_to]
60
+ except AssertionError as e:
61
+ logging.error('Assertion Error: %s', e.args[0] if e.args else repr(e))
62
+ logging.error('EV: %s', self.ev)
63
+ logging.error('Time From: %s', time_from)
64
+ logging.error('Time To: %s', time_to)
65
+ logging.error('Power: %s', power)
66
+ logging.error('Energy Left: %s', self.energy_left)
67
+ logging.error('Power at Time From: %s', self.ev.power[time_from])
68
+ logging.error('Power at Time To: %s', self.ev.power[time_to])
69
+ if DEBUG:
70
+ logging.info('%s shifted {p} from %s to %s', self.ev.ev_id, time_from, time_to)
71
+ self.ev.power[time_from] -= power
72
+ self.ev.power[time_to] += power
73
+
74
+ def calculate(self) -> None:
75
+ evs = {ev.ev_id: self.EVPower(ev=ev) for ev in self.evs}
76
+
77
+ evs_present: list[set[int]] = [set() for _ in range(AlgorithmConstants.TIMESTEPS)]
78
+ for ev_id, ev in evs.items():
79
+ for time_index in range(ev.ev.arrival_index(self.now), ev.ev.departure_index(self.now)):
80
+ evs_present[time_index].add(ev_id)
81
+
82
+ available_peak_power = self.peak_power_demand.copy()
83
+ for time in range(AlgorithmConstants.TIMESTEPS - 1, -1, -1):
84
+ # Allocate Minimum Power first
85
+ for ev_id in evs_present[time]:
86
+ ev = evs[ev_id]
87
+ ev.accept_power(time, ev.ev.min_power)
88
+ available_peak_power[time] -= ev.ev.min_power
89
+
90
+ while available_peak_power[time] > 0:
91
+ evs_to_allocate = [(ev_id, evs[ev_id].power(time))
92
+ for ev_id in evs_present[time]
93
+ if evs[ev_id].power(time) != 0]
94
+ if not evs_to_allocate:
95
+ break
96
+
97
+ total_power_required = sum(p**FAIRNESS_FACTOR for _, p in evs_to_allocate)
98
+ power_allocation = [(ev_id, power**FAIRNESS_FACTOR / total_power_required * available_peak_power[time])
99
+ for ev_id, power in evs_to_allocate]
100
+ if sum(allocated_power for _, allocated_power in power_allocation) == 0:
101
+ break
102
+
103
+ if DEBUG:
104
+ logging.info('Splitting %s -> %s into %s', time, available_peak_power[time], power_allocation)
105
+ for ev_id, allocated_power in power_allocation:
106
+ ev = evs[ev_id]
107
+ power = ev.power(time, allocated_power)
108
+ ev.accept_power(time, power)
109
+ available_peak_power[time] -= power
110
+
111
+ if SHIFT_FRONT:
112
+ for time_from in range(AlgorithmConstants.TIMESTEPS - 1, -1, -1):
113
+ for ev_id, ev in evs.items():
114
+ time_to = time_from - 1
115
+ while time_to >= 0 and ev.ev.power[time_from] > ev.ev.min_power and ev_id in evs_present[time_to] and available_peak_power[time_to] > 0:
116
+ power = min(available_peak_power[time_to], ev.ev.power[time_from] - ev.ev.min_power, ev.ev.max_power - ev.ev.power[time_to])
117
+ ev.shift_power(time_from, time_to, power)
118
+ available_peak_power[time_to] -= power
119
+ available_peak_power[time_from] += power
120
+ time_to -= 1
121
+
122
+ if ALLOC_REMAINING_EXTRA:
123
+ for time in range(AlgorithmConstants.TIMESTEPS):
124
+ available_extra_power = available_peak_power[time]
125
+
126
+ evs_to_allocate = [(ev_id, evs[ev_id].power(time, available_extra_power, True))
127
+ for ev_id in evs_present[time]
128
+ if evs[ev_id].power(time, available_extra_power, True) != 0]
129
+
130
+ total_power_required = sum(p**FAIRNESS_FACTOR for _, p in evs_to_allocate)
131
+ power_allocation = [(ev_id, power**FAIRNESS_FACTOR / total_power_required * available_extra_power)
132
+ for ev_id, power in evs_to_allocate]
133
+ if sum(allocated_power for _, allocated_power in power_allocation) == 0:
134
+ continue
135
+
136
+ for ev_id, allocation in power_allocation:
137
+ ev = evs[ev_id]
138
+ power = ev.power(time, allocation, True)
139
+ ev.accept_power(time, power, True)
140
+ available_peak_power[time] -= power
141
+
142
+ try:
143
+ for ev in evs.values():
144
+ assert all(y == 0. or y <= ev.ev.max_power or math.isclose(y, ev.ev.max_power) for y in ev.ev.power), 'EV Max Power'
145
+ assert all(y == 0. or y >= ev.ev.min_power for y in ev.ev.power), 'EV Min Power'
146
+ for i in range(AlgorithmConstants.TIMESTEPS):
147
+ assert available_peak_power[i] >= -1, f'{available_peak_power[i]} not greater than or equal to zero'
148
+ y_pm_i = sum(ev.ev.power[i] for ev in evs.values())
149
+ assert self.peak_power_demand[i] >= y_pm_i or math.isclose(self.peak_power_demand[i], y_pm_i), 'Total Power'
150
+ except AssertionError as e:
151
+ logging.error('Assertion Error: %s', e.args[0] if e.args else repr(e))
152
+ logging.error('EVs: %s', self.evs)
153
+ logging.error('peak_power_demand: %s', self.peak_power_demand)
154
+ logging.error('available_peak_power: %s', available_peak_power)
@@ -0,0 +1,85 @@
1
+ import logging
2
+
3
+ from pulp import LpVariable, LpProblem, LpMaximize, PULP_CBC_CMD
4
+
5
+ from .algorithm import Algorithm
6
+ from .constants import AlgorithmConstants
7
+
8
+ class PulpNumericalAlgorithm(Algorithm):
9
+ """Pulp Numerical SCM Algorithm"""
10
+
11
+ def calculate(self) -> None:
12
+ logging.info('Number of Connected EVs: %s', len(self.evs))
13
+
14
+ # Create a linear programming problem
15
+ model = LpProblem(name='charging_schedule', sense=LpMaximize)
16
+
17
+ # Decision variables
18
+ ev_vars = {
19
+ (ev.ev_id, time): LpVariable(name=f'X_{ev.ev_id}_{time}', lowBound=0)
20
+ for ev in self.evs
21
+ for time in range(AlgorithmConstants.TIMESTEPS)
22
+ }
23
+ ev_vars_diff = {
24
+ (ev.ev_id, time): LpVariable(name=f'X_diff_{ev.ev_id}_{time}', lowBound=0)
25
+ for ev in self.evs
26
+ for time in range(AlgorithmConstants.TIMESTEPS - 1)
27
+ }
28
+ percentage = LpVariable(name='percentage_charge', lowBound=0)
29
+
30
+ ev_max_demand = sum(ev.max_power for ev in self.evs) if self.evs else float('inf')
31
+ max_power_demand = [min(ev_max_demand, self.peak_power_demand[time]) for time in range(AlgorithmConstants.TIMESTEPS)]
32
+
33
+ # Objective function - maximize the percentage of energy charged and peak power utilization and minimize the change in power
34
+ model += percentage * 100 * AlgorithmConstants.TIMESTEPS * len(self.evs) + sum(
35
+ sum(ev_vars[ev.ev_id, time] for ev in self.evs) / max_power_demand[time] # type: ignore
36
+ for time in range(AlgorithmConstants.TIMESTEPS)
37
+ ) - sum(sum(ev_vars_diff[ev.ev_id, time] for time in range(AlgorithmConstants.TIMESTEPS - 1)) for ev in self.evs) # type: ignore
38
+
39
+ # Constraints
40
+ for ev in self.evs:
41
+ # Power Difference Constraints - absolute value
42
+ for time in range(AlgorithmConstants.TIMESTEPS - 1):
43
+ model += ev_vars_diff[ev.ev_id, time] >= ev_vars[ev.ev_id, time + 1] - ev_vars[ev.ev_id, time]
44
+ model += ev_vars_diff[ev.ev_id, time] >= -ev_vars[ev.ev_id, time + 1] + ev_vars[ev.ev_id, time]
45
+
46
+ # Percentage of energy charged >= maximised percentage
47
+ model += (
48
+ (sum(ev_vars[ev.ev_id, time] for time in range(AlgorithmConstants.TIMESTEPS)) * AlgorithmConstants.POWER_ENERGY_FACTOR) / ev.energy
49
+ ) >= percentage
50
+
51
+ # Calculate the index of the arrival and departure times
52
+ arrival_index = ev.arrival_index(self.now)
53
+ departure_index = ev.departure_index(self.now)
54
+
55
+ # Power constraints after arrival before departure
56
+ for time in range(arrival_index, departure_index):
57
+ model += ev_vars[ev.ev_id, time] >= ev.min_power
58
+
59
+ model += ev_vars[ev.ev_id, time] <= ev.max_power
60
+
61
+ # No charging before arrival
62
+ for time in range(arrival_index):
63
+ model += ev_vars[ev.ev_id, time] == 0
64
+
65
+ # No charging after departure
66
+ for time in range(departure_index, AlgorithmConstants.TIMESTEPS):
67
+ model += ev_vars[ev.ev_id, time] == 0
68
+
69
+ # Peak power demand constraint
70
+ for time in range(AlgorithmConstants.TIMESTEPS):
71
+ model += sum(ev_vars[ev.ev_id, time] for ev in self.evs) <= self.peak_power_demand[time]
72
+
73
+
74
+ # Solve the problem
75
+ model.solve(PULP_CBC_CMD(msg=False))
76
+
77
+ # Total percentage of requested energy charged
78
+ total_percentage = model.objective.value()
79
+ logging.info('Maximized Percentage of Charging: %s', total_percentage)
80
+
81
+ for ev in self.evs:
82
+ for time in range(AlgorithmConstants.TIMESTEPS):
83
+ ev.power[time] = ev_vars[ev.ev_id, time].varValue # type: ignore
84
+
85
+ logging.info('EV %s: Max Power: %s / %s, Energy Charged: %s / %s', ev.ev_id, max(ev.power), ev.max_power, ev.energy_charged(), ev.energy)
@@ -0,0 +1,28 @@
1
+ import os
2
+ import logging
3
+ from typing import Type
4
+ from datetime import datetime, UTC
5
+
6
+ from .translation import Translation
7
+ from .scm.algorithm import Algorithm
8
+ from .scm.constants import AlgorithmConstants
9
+ from .utils import round_down_datetime
10
+
11
+ def scm_runner(translation: Translation, algorithm_cls: Type[Algorithm]):
12
+ """Main OptiVGI function that uses the translation and algorithm to run the SCM logic"""
13
+ groups = filter(bool, map(str.strip, os.getenv('STATION_GROUPS', '').split(',')))
14
+
15
+ now = round_down_datetime(datetime.now(UTC), int(AlgorithmConstants.RESOLUTION.total_seconds() / 60))
16
+
17
+ logging.info('Running SCM for groups: %s at time: %s', os.getenv('STATION_GROUPS'), now)
18
+
19
+ for group in groups:
20
+ logging.info('Running SCM for group: %s', group)
21
+ evs, voltage = translation.get_evs(group)
22
+ peak_power_demand = translation.get_peak_power_demand(group, now, voltage)
23
+
24
+ algorithm = algorithm_cls(evs, peak_power_demand, now)
25
+ algorithm.calculate()
26
+
27
+ powers = algorithm.get_charging_profiles()
28
+ translation.send_power_to_evs(powers)
@@ -0,0 +1,36 @@
1
+ import time
2
+ import logging
3
+ import traceback
4
+ from queue import Queue
5
+ from datetime import datetime
6
+ from typing import Type
7
+
8
+ from .scm_runner import scm_runner
9
+ from .translation import Translation
10
+ from .scm.algorithm import Algorithm
11
+
12
+
13
+ def timer_thread_worker(event_queue: Queue):
14
+ """Thread that sends a timer event every minute"""
15
+ while True:
16
+ current_time = time.time()
17
+ delay = 60 - (current_time % 60)
18
+ time.sleep(delay) # Sleep until the top of the next minute
19
+ event_queue.put("Timer Event")
20
+
21
+
22
+ # SCM worker thread function
23
+ def scm_worker(event_queue: Queue, translation_cls: Type[Translation], algorithm_cls: Type[Algorithm]):
24
+ """Thread that processes events from the event queue and runs the SCM worker"""
25
+ with translation_cls() as translation:
26
+ while True:
27
+ event = event_queue.get()
28
+ if event is None:
29
+ break # Allows the thread to be stopped.
30
+ logging.info("Processing event %s at %s", event, datetime.now())
31
+ try:
32
+ scm_runner(translation, algorithm_cls)
33
+ except Exception as e: # pylint: disable=broad-except
34
+ logging.error("Error processing event %s: %s", event, repr(e))
35
+ logging.error(traceback.format_exc())
36
+ event_queue.task_done()
@@ -0,0 +1,25 @@
1
+ from abc import abstractmethod
2
+ from contextlib import AbstractContextManager
3
+ from datetime import datetime
4
+ from typing import Optional
5
+
6
+ from .scm.ev import EV, ChargingRateUnit
7
+
8
+ class Translation(AbstractContextManager):
9
+ """
10
+ Translation Layer Abstract Class
11
+ This class is used to define the interface for the translation layer.
12
+ The translation layer is used to interact with the external EV Management System (CSMS).
13
+ The abstract methods defined in this class must be implemented by the concrete translation layer.
14
+ """
15
+ @abstractmethod
16
+ def get_peak_power_demand(self, group_name: str, now: datetime, voltage: Optional[float] = None) -> list[float]:
17
+ """Get the peak power demand of a group"""
18
+
19
+ @abstractmethod
20
+ def get_evs(self, group_name: str) -> tuple[list[EV], Optional[float]]:
21
+ """Get all EVs in a group and optional voltage if available"""
22
+
23
+ @abstractmethod
24
+ def send_power_to_evs(self, powers: dict[EV, dict], unit: Optional[ChargingRateUnit] = None):
25
+ """Send power to EVs"""
@@ -0,0 +1,5 @@
1
+ from datetime import datetime, timedelta
2
+
3
+ def round_down_datetime(dt: datetime, minute: int) -> datetime:
4
+ """Round a timedelta to the nearest minute"""
5
+ return dt - timedelta(minutes=dt.minute % minute, seconds=dt.second, microseconds=dt.microsecond)
@@ -0,0 +1,234 @@
1
+ Metadata-Version: 2.4
2
+ Name: optivgi
3
+ Version: 0.1.0
4
+ Summary: An EV smart charging management application designed to optimize electric vehicle charging based on power or pricing constraints.
5
+ Author-email: Nithin Manne <nmanne@anl.gov>, Jason Harper <jharper@anl.gov>
6
+ License: Apache License
7
+ Version 2.0, January 2004
8
+ http://www.apache.org/licenses/
9
+
10
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
11
+
12
+ 1. Definitions.
13
+
14
+ "License" shall mean the terms and conditions for use, reproduction,
15
+ and distribution as defined by Sections 1 through 9 of this document.
16
+
17
+ "Licensor" shall mean the copyright owner or entity authorized by
18
+ the copyright owner that is granting the License.
19
+
20
+ "Legal Entity" shall mean the union of the acting entity and all
21
+ other entities that control, are controlled by, or are under common
22
+ control with that entity. For the purposes of this definition,
23
+ "control" means (i) the power, direct or indirect, to cause the
24
+ direction or management of such entity, whether by contract or
25
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
26
+ outstanding shares, or (iii) beneficial ownership of such entity.
27
+
28
+ "You" (or "Your") shall mean an individual or Legal Entity
29
+ exercising permissions granted by this License.
30
+
31
+ "Source" form shall mean the preferred form for making modifications,
32
+ including but not limited to software source code, documentation
33
+ source, and configuration files.
34
+
35
+ "Object" form shall mean any form resulting from mechanical
36
+ transformation or translation of a Source form, including but
37
+ not limited to compiled object code, generated documentation,
38
+ and conversions to other media types.
39
+
40
+ "Work" shall mean the work of authorship, whether in Source or
41
+ Object form, made available under the License, as indicated by a
42
+ copyright notice that is included in or attached to the work
43
+ (an example is provided in the Appendix below).
44
+
45
+ "Derivative Works" shall mean any work, whether in Source or Object
46
+ form, that is based on (or derived from) the Work and for which the
47
+ editorial revisions, annotations, elaborations, or other modifications
48
+ represent, as a whole, an original work of authorship. For the purposes
49
+ of this License, Derivative Works shall not include works that remain
50
+ separable from, or merely link (or bind by name) to the interfaces of,
51
+ the Work and Derivative Works thereof.
52
+
53
+ "Contribution" shall mean any work of authorship, including
54
+ the original version of the Work and any modifications or additions
55
+ to that Work or Derivative Works thereof, that is intentionally
56
+ submitted to Licensor for inclusion in the Work by the copyright owner
57
+ or by an individual or Legal Entity authorized to submit on behalf of
58
+ the copyright owner. For the purposes of this definition, "submitted"
59
+ means any form of electronic, verbal, or written communication sent
60
+ to the Licensor or its representatives, including but not limited to
61
+ communication on electronic mailing lists, source code control systems,
62
+ and issue tracking systems that are managed by, or on behalf of, the
63
+ Licensor for the purpose of discussing and improving the Work, but
64
+ excluding communication that is conspicuously marked or otherwise
65
+ designated in writing by the copyright owner as "Not a Contribution."
66
+
67
+ "Contributor" shall mean Licensor and any individual or Legal Entity
68
+ on behalf of whom a Contribution has been received by Licensor and
69
+ subsequently incorporated within the Work.
70
+
71
+ 2. Grant of Copyright License. Subject to the terms and conditions of
72
+ this License, each Contributor hereby grants to You a perpetual,
73
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
74
+ copyright license to reproduce, prepare Derivative Works of,
75
+ publicly display, publicly perform, sublicense, and distribute the
76
+ Work and such Derivative Works in Source or Object form.
77
+
78
+ 3. Grant of Patent License. Subject to the terms and conditions of
79
+ this License, each Contributor hereby grants to You a perpetual,
80
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
81
+ (except as stated in this section) patent license to make, have made,
82
+ use, offer to sell, sell, import, and otherwise transfer the Work,
83
+ where such license applies only to those patent claims licensable
84
+ by such Contributor that are necessarily infringed by their
85
+ Contribution(s) alone or by combination of their Contribution(s)
86
+ with the Work to which such Contribution(s) was submitted. If You
87
+ institute patent litigation against any entity (including a
88
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
89
+ or a Contribution incorporated within the Work constitutes direct
90
+ or contributory patent infringement, then any patent licenses
91
+ granted to You under this License for that Work shall terminate
92
+ as of the date such litigation is filed.
93
+
94
+ 4. Redistribution. You may reproduce and distribute copies of the
95
+ Work or Derivative Works thereof in any medium, with or without
96
+ modifications, and in Source or Object form, provided that You
97
+ meet the following conditions:
98
+
99
+ (a) You must give any other recipients of the Work or
100
+ Derivative Works a copy of this License; and
101
+
102
+ (b) You must cause any modified files to carry prominent notices
103
+ stating that You changed the files; and
104
+
105
+ (c) You must retain, in the Source form of any Derivative Works
106
+ that You distribute, all copyright, patent, trademark, and
107
+ attribution notices from the Source form of the Work,
108
+ excluding those notices that do not pertain to any part of
109
+ the Derivative Works; and
110
+
111
+ (d) If the Work includes a "NOTICE" text file as part of its
112
+ distribution, then any Derivative Works that You distribute must
113
+ include a readable copy of the attribution notices contained
114
+ within such NOTICE file, excluding those notices that do not
115
+ pertain to any part of the Derivative Works, in at least one
116
+ of the following places: within a NOTICE text file distributed
117
+ as part of the Derivative Works; within the Source form or
118
+ documentation, if provided along with the Derivative Works; or,
119
+ within a display generated by the Derivative Works, if and
120
+ wherever such third-party notices normally appear. The contents
121
+ of the NOTICE file are for informational purposes only and
122
+ do not modify the License. You may add Your own attribution
123
+ notices within Derivative Works that You distribute, alongside
124
+ or as an addendum to the NOTICE text from the Work, provided
125
+ that such additional attribution notices cannot be construed
126
+ as modifying the License.
127
+
128
+ You may add Your own copyright statement to Your modifications and
129
+ may provide additional or different license terms and conditions
130
+ for use, reproduction, or distribution of Your modifications, or
131
+ for any such Derivative Works as a whole, provided Your use,
132
+ reproduction, and distribution of the Work otherwise complies with
133
+ the conditions stated in this License.
134
+
135
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
136
+ any Contribution intentionally submitted for inclusion in the Work
137
+ by You to the Licensor shall be under the terms and conditions of
138
+ this License, without any additional terms or conditions.
139
+ Notwithstanding the above, nothing herein shall supersede or modify
140
+ the terms of any separate license agreement you may have executed
141
+ with Licensor regarding such Contributions.
142
+
143
+ 6. Trademarks. This License does not grant permission to use the trade
144
+ names, trademarks, service marks, or product names of the Licensor,
145
+ except as required for reasonable and customary use in describing the
146
+ origin of the Work and reproducing the content of the NOTICE file.
147
+
148
+ 7. Disclaimer of Warranty. Unless required by applicable law or
149
+ agreed to in writing, Licensor provides the Work (and each
150
+ Contributor provides its Contributions) on an "AS IS" BASIS,
151
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
152
+ implied, including, without limitation, any warranties or conditions
153
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
154
+ PARTICULAR PURPOSE. You are solely responsible for determining the
155
+ appropriateness of using or redistributing the Work and assume any
156
+ risks associated with Your exercise of permissions under this License.
157
+
158
+ 8. Limitation of Liability. In no event and under no legal theory,
159
+ whether in tort (including negligence), contract, or otherwise,
160
+ unless required by applicable law (such as deliberate and grossly
161
+ negligent acts) or agreed to in writing, shall any Contributor be
162
+ liable to You for damages, including any direct, indirect, special,
163
+ incidental, or consequential damages of any character arising as a
164
+ result of this License or out of the use or inability to use the
165
+ Work (including but not limited to damages for loss of goodwill,
166
+ work stoppage, computer failure or malfunction, or any and all
167
+ other commercial damages or losses), even if such Contributor
168
+ has been advised of the possibility of such damages.
169
+
170
+ 9. Accepting Warranty or Additional Liability. While redistributing
171
+ the Work or Derivative Works thereof, You may choose to offer,
172
+ and charge a fee for, acceptance of support, warranty, indemnity,
173
+ or other liability obligations and/or rights consistent with this
174
+ License. However, in accepting such obligations, You may act only
175
+ on Your own behalf and on Your sole responsibility, not on behalf
176
+ of any other Contributor, and only if You agree to indemnify,
177
+ defend, and hold each Contributor harmless for any liability
178
+ incurred by, or claims asserted against, such Contributor by reason
179
+ of your accepting any such warranty or additional liability.
180
+
181
+ END OF TERMS AND CONDITIONS
182
+
183
+ APPENDIX: How to apply the Apache License to your work.
184
+
185
+ To apply the Apache License to your work, attach the following
186
+ boilerplate notice, with the fields enclosed by brackets "[]"
187
+ replaced with your own identifying information. (Don't include
188
+ the brackets!) The text should be enclosed in the appropriate
189
+ comment syntax for the file format. We also recommend that a
190
+ file or class name and description of purpose be included on the
191
+ same "printed page" as the copyright notice for easier
192
+ identification within third-party archives.
193
+
194
+ Copyright [yyyy] [name of copyright owner]
195
+
196
+ Licensed under the Apache License, Version 2.0 (the "License");
197
+ you may not use this file except in compliance with the License.
198
+ You may obtain a copy of the License at
199
+
200
+ http://www.apache.org/licenses/LICENSE-2.0
201
+
202
+ Unless required by applicable law or agreed to in writing, software
203
+ distributed under the License is distributed on an "AS IS" BASIS,
204
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
205
+ See the License for the specific language governing permissions and
206
+ limitations under the License.
207
+
208
+ Project-URL: Homepage, https://github.com/nmanne-anlgov/Opti-VGI
209
+ Project-URL: Issues, https://github.com/nmanne-anlgov/Opti-VGI/issues
210
+ Classifier: Programming Language :: Python :: 3
211
+ Classifier: License :: OSI Approved :: Apache Software License
212
+ Classifier: Operating System :: OS Independent
213
+ Requires-Python: >=3.11
214
+ Description-Content-Type: text/markdown
215
+ License-File: LICENSE
216
+ Requires-Dist: pulp
217
+ Dynamic: license-file
218
+
219
+ # Argonne Opti-VGI
220
+
221
+ ### Opti-VGI: EV Smart Charging Scheduler Application
222
+
223
+ ## Description
224
+
225
+ Opti-VGI is an EV smart charging management application designed to optimize electric vehicle charging based on power or pricing constraints. This application can integrate with any OCPP 2.X CSMS to accomplish ISO 15118 charge scheduling
226
+
227
+
228
+ ## Proposed System Architecture
229
+
230
+ ### Translation Layer
231
+ - An application that interfaces between the Charge Station Management System (CSMS) and the Charge Scheduling Management Algorithm (CSM)
232
+
233
+ ### Modular Charge Scheduling Management (SCM) Application
234
+ - A modular framework that allows using different algorithms
@@ -0,0 +1,19 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ requirements.txt
5
+ optivgi/__init__.py
6
+ optivgi/scm_runner.py
7
+ optivgi/threads.py
8
+ optivgi/translation.py
9
+ optivgi/utils.py
10
+ optivgi.egg-info/PKG-INFO
11
+ optivgi.egg-info/SOURCES.txt
12
+ optivgi.egg-info/dependency_links.txt
13
+ optivgi.egg-info/requires.txt
14
+ optivgi.egg-info/top_level.txt
15
+ optivgi/scm/algorithm.py
16
+ optivgi/scm/constants.py
17
+ optivgi/scm/ev.py
18
+ optivgi/scm/go_algorithm.py
19
+ optivgi/scm/pulp_numerical_algorithm.py
@@ -0,0 +1 @@
1
+ pulp
@@ -0,0 +1 @@
1
+ optivgi
@@ -0,0 +1,29 @@
1
+ [build-system]
2
+ requires = ["setuptools>=70.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "optivgi"
7
+ version = "0.1.0"
8
+ authors = [
9
+ { name="Nithin Manne", email="nmanne@anl.gov" },
10
+ { name="Jason Harper", email="jharper@anl.gov" },
11
+ ]
12
+ description = "An EV smart charging management application designed to optimize electric vehicle charging based on power or pricing constraints."
13
+ readme = "README.md"
14
+ license = {file = "LICENSE"}
15
+ requires-python = ">=3.11"
16
+ classifiers = [
17
+ "Programming Language :: Python :: 3",
18
+ "License :: OSI Approved :: Apache Software License",
19
+ "Operating System :: OS Independent",
20
+ ]
21
+ dynamic = ["dependencies"]
22
+
23
+ [tool.setuptools.dynamic]
24
+ dependencies = {file = ["requirements.txt"]}
25
+ optional-dependencies = { dev = { file = ["dev-requirements.txt"] }}
26
+
27
+ [project.urls]
28
+ Homepage = "https://github.com/nmanne-anlgov/Opti-VGI"
29
+ Issues = "https://github.com/nmanne-anlgov/Opti-VGI/issues"
@@ -0,0 +1 @@
1
+ pulp
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+