1 # Copyright (C) 2010-2011 Richard Lincoln
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to
5 # deal in the Software without restriction, including without limitation the
6 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 # sell copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 from CIM14
.Element
import Element
23 class OperatingShare(Element
):
24 """Specifies the contract relationship between a PowerSystemResource and a contract participant.
27 def __init__(self
, percentage
=0.0, PowerSystemResource
=None, OperatingParticipant
=None, *args
, **kw_args
):
28 """Initialises a new 'OperatingShare' instance.
30 @param percentage: Percentage ownership for this device. The percentage indicates the percentage ownership of the PSROwner for the PowerSystemResource. The total percentage ownership for a PowerSystemResource should add to 100%.
31 @param PowerSystemResource: The PowerSystemResource to which the attribues apply. The percentage ownership of all owners of a PowerSystemResource should add to 100%.
32 @param OperatingParticipant: The linkage to a owners and its linkage attributes like percentage ownership. The ownership percentage should add to 100% for all owners of a PowerSystemResource, but a PSROwner may own any percentage of any number of PowerSystemResource objects.
34 #: Percentage ownership for this device. The percentage indicates the percentage ownership of the PSROwner for the PowerSystemResource. The total percentage ownership for a PowerSystemResource should add to 100%.
35 self
.percentage
= percentage
37 self
._PowerSystemResource
= None
38 self
.PowerSystemResource
= PowerSystemResource
40 self
._OperatingParticipant
= None
41 self
.OperatingParticipant
= OperatingParticipant
43 super(OperatingShare
, self
).__init
__(*args
, **kw_args
)
45 _attrs
= ["percentage"]
46 _attr_types
= {"percentage": float}
47 _defaults
= {"percentage": 0.0}
49 _refs
= ["PowerSystemResource", "OperatingParticipant"]
52 def getPowerSystemResource(self
):
53 """The PowerSystemResource to which the attribues apply. The percentage ownership of all owners of a PowerSystemResource should add to 100%.
55 return self
._PowerSystemResource
57 def setPowerSystemResource(self
, value
):
58 if self
._PowerSystemResource
is not None:
59 filtered
= [x
for x
in self
.PowerSystemResource
.OperatingShare
if x
!= self
]
60 self
._PowerSystemResource
._OperatingShare
= filtered
62 self
._PowerSystemResource
= value
63 if self
._PowerSystemResource
is not None:
64 if self
not in self
._PowerSystemResource
._OperatingShare
:
65 self
._PowerSystemResource
._OperatingShare
.append(self
)
67 PowerSystemResource
= property(getPowerSystemResource
, setPowerSystemResource
)
69 def getOperatingParticipant(self
):
70 """The linkage to a owners and its linkage attributes like percentage ownership. The ownership percentage should add to 100% for all owners of a PowerSystemResource, but a PSROwner may own any percentage of any number of PowerSystemResource objects.
72 return self
._OperatingParticipant
74 def setOperatingParticipant(self
, value
):
75 if self
._OperatingParticipant
is not None:
76 filtered
= [x
for x
in self
.OperatingParticipant
.OperatingShare
if x
!= self
]
77 self
._OperatingParticipant
._OperatingShare
= filtered
79 self
._OperatingParticipant
= value
80 if self
._OperatingParticipant
is not None:
81 if self
not in self
._OperatingParticipant
._OperatingShare
:
82 self
._OperatingParticipant
._OperatingShare
.append(self
)
84 OperatingParticipant
= property(getOperatingParticipant
, setOperatingParticipant
)