Adding CIM15 package.
[PyCIM.git] / CIM15 / IEC62325 / MarketRole.py
blob3d09c69d31a9dd049db3d2e7c230e9baeca1f929
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
19 # IN THE SOFTWARE.
21 from CIM15.IEC61970.Core.IdentifiedObject import IdentifiedObject
23 class MarketRole(IdentifiedObject):
24 """Role of a market player.Role of a market player.
25 """
27 def __init__(self, kind="transmissionOperator", status=None, MarketParticipants=None, *args, **kw_args):
28 """Initialises a new 'MarketRole' instance.
30 @param kind: Kind of role an organisation plays in a market. Values are: "transmissionOperator", "complianceMonitor", "standardsDeveloper", "interchangeAuthority", "energyServiceConsumer", "planningAuthority", "other", "purchasingSellingEntity", "competitiveRetailer", "transmissionOwner", "transmissionServiceProvider", "generatorOperator", "balancingAuthority", "loadServingEntity", "transmissionPlanner", "distributionProvider", "reliabilityAuthority", "resourcePlanner", "generatorOwner"
31 @param status:
32 @param MarketParticipants: All market participants with this role.
33 """
34 #: Kind of role an organisation plays in a market. Values are: "transmissionOperator", "complianceMonitor", "standardsDeveloper", "interchangeAuthority", "energyServiceConsumer", "planningAuthority", "other", "purchasingSellingEntity", "competitiveRetailer", "transmissionOwner", "transmissionServiceProvider", "generatorOperator", "balancingAuthority", "loadServingEntity", "transmissionPlanner", "distributionProvider", "reliabilityAuthority", "resourcePlanner", "generatorOwner"
35 self.kind = kind
37 self.status = status
39 self._MarketParticipants = []
40 self.MarketParticipants = [] if MarketParticipants is None else MarketParticipants
42 super(MarketRole, self).__init__(*args, **kw_args)
44 _attrs = ["kind"]
45 _attr_types = {"kind": str}
46 _defaults = {"kind": "transmissionOperator"}
47 _enums = {"kind": "MarketRoleKind"}
48 _refs = ["status", "MarketParticipants"]
49 _many_refs = ["MarketParticipants"]
51 status = None
53 def getMarketParticipants(self):
54 """All market participants with this role.
55 """
56 return self._MarketParticipants
58 def setMarketParticipants(self, value):
59 for p in self._MarketParticipants:
60 filtered = [q for q in p.MarketRoles if q != self]
61 self._MarketParticipants._MarketRoles = filtered
62 for r in value:
63 if self not in r._MarketRoles:
64 r._MarketRoles.append(self)
65 self._MarketParticipants = value
67 MarketParticipants = property(getMarketParticipants, setMarketParticipants)
69 def addMarketParticipants(self, *MarketParticipants):
70 for obj in MarketParticipants:
71 if self not in obj._MarketRoles:
72 obj._MarketRoles.append(self)
73 self._MarketParticipants.append(obj)
75 def removeMarketParticipants(self, *MarketParticipants):
76 for obj in MarketParticipants:
77 if self in obj._MarketRoles:
78 obj._MarketRoles.remove(self)
79 self._MarketParticipants.remove(obj)