Commit 2b940459 authored by Nathan Bonnemberger's avatar Nathan Bonnemberger
Browse files

last commit before departing

parent 6beda736
This diff is collapsed.
......@@ -5,6 +5,14 @@ Created on 11 aout 2017
'''
import collections
def lookupIndexSql (p_BuildingIDs, buildingId):
sqlIndex = -1
for i in range (len( p_BuildingIDs)):
if p_BuildingIDs[i]==buildingId:
sqlIndex=i
return sqlIndex
def Mapping (p_BuildingIds, p_Building1, p_Building2, p_Building3, p_Building4, p_Building5, p_Building6, p_Building7, p_Building8, p_Building9, p_Building10, p_Building11, p_Building12, p_Building13, p_Building14, p_Building15, p_Building16, p_Building17, p_Building18, p_Building19, p_Building20, p_Building21, p_Building22, p_Building23, p_Building24, p_Building25, p_Building26, p_Building27, p_Building28, p_Building29, p_Building30, p_Building31, p_Building32, p_Building33, p_Building34, p_Building35, p_Building36, p_Building37):
Association = collections.namedtuple('Association', 'x,y,id')
......@@ -55,37 +63,43 @@ def Mapping (p_BuildingIds, p_Building1, p_Building2, p_Building3, p_Building4,
return l_BuildingAssociations
def ConstructionCosts (p_BuildingAssociations, p_BuildingCCs):
def ConstructionCosts (p_BuildingAssociations, p_BuildingCCs, p_BuildingIDs):
l_Index = -1
l_Costs = 0
l_Building = -1
l_SqlIndex = 0
for l_Index in range(len(p_BuildingAssociations)):
l_Building = p_BuildingAssociations[l_Index].id
if (p_BuildingAssociations[l_Index].x > 0) and (p_BuildingAssociations[l_Index].y > 0):
l_Costs += p_BuildingCCs[l_Building]
l_SqlIndex = lookupIndexSql(p_BuildingIDs, l_Building)
l_Costs += p_BuildingCCs[l_SqlIndex]
return l_Costs
def OccupiedSurface (p_BuildingAssociations, p_BuildingXsizes, p_BuildingYsizes):
def OccupiedSurface (p_BuildingAssociations, p_BuildingXsizes, p_BuildingYsizes, p_BuildingIDs):
l_Index = -1
l_Surface = 0
l_Building = -1
l_SqlIndex = 0
for l_Index in range(len(p_BuildingAssociations)):
l_Building = p_BuildingAssociations[l_Index].id
if (p_BuildingAssociations[l_Index].x > 0) and (p_BuildingAssociations[l_Index].y > 0):
l_Surface += p_BuildingXsizes[l_Building] * p_BuildingYsizes[l_Building]
l_SqlIndex = lookupIndexSql(p_BuildingIDs, l_Building)
l_Surface += p_BuildingXsizes[l_SqlIndex] * p_BuildingYsizes[l_SqlIndex]
return l_Surface
def LivingSpace (p_BuildingAssociations, p_BuildingXsizes, p_BuildingYsizes, p_BuildingFloors):
def LivingSpace (p_BuildingAssociations, p_BuildingXsizes, p_BuildingYsizes, p_BuildingFloors, p_BuildingIDs):
l_Index = -1
l_Space = 0
l_Building = -1
l_SqlIndex = 0
for l_Index in range(len(p_BuildingAssociations)):
l_Building = p_BuildingAssociations[l_Index].id
if (p_BuildingAssociations[l_Index].x > 0) and (p_BuildingAssociations[l_Index].y > 0):
l_Space += p_BuildingXsizes[l_Building] * p_BuildingYsizes[l_Building] * p_BuildingFloors[l_Building]
l_SqlIndex = lookupIndexSql(p_BuildingIDs, l_Building)
l_Space += p_BuildingXsizes[l_SqlIndex] * p_BuildingYsizes[l_SqlIndex] * p_BuildingFloors[l_SqlIndex]
return l_Space
......
......@@ -404,6 +404,23 @@
</position>
</variable>
<coronas>
<corona>
<type>ConditionalMqtt</type>
<handle>13</handle>
<drawPriority>278</drawPriority> <!-- needs to be different for each corona -->
<rotateWithHandle>false</rotateWithHandle> <!-- if true it rotates with the object -->
<mqtt>
<broker>tcp://localhost</broker>
<port>1883</port>
<userId>tui</userId>
<payload>wrong</payload>
<topic>/BaseNode/actuator/ring/fullring</topic>
</mqtt>
<triggers>
<trigger>mqtt14</trigger> <!-- insert each variable you use for the trigger condition -->
</triggers>
<triggerCondition>(mqtt14 &gt; 0)</triggerCondition> <!-- Condition: &gt; &lt; == != &amp;&amp; -->
</corona>
</coronas>
</object>
......@@ -974,6 +991,23 @@
</position>
</variable>
<coronas>
<corona>
<type>ConditionalMqtt</type>
<handle>94</handle>
<drawPriority>278</drawPriority> <!-- needs to be different for each corona -->
<rotateWithHandle>false</rotateWithHandle> <!-- if true it rotates with the object -->
<mqtt>
<broker>tcp://localhost</broker>
<port>1883</port>
<userId>strip</userId>
<payload>right</payload>
<topic>/BaseNode/actuator/strip/fullstrip</topic>
</mqtt>
<triggers>
<trigger>mqtt</trigger> <!-- insert each variable you use for the trigger condition -->
</triggers>
<triggerCondition>(mqtt &gt; 0)</triggerCondition> <!-- Condition: &gt; &lt; == != &amp;&amp; -->
</corona>
</coronas>
</object>
<!-- Building objects: Shops -->
......@@ -1249,6 +1283,9 @@
<output name="Building_Assoc" type="vector"/>
<output name="mqtt" type="numeric" unit="px" initial="0"/>
<output name="mqtt14" type="numeric" unit="px" initial="0"/>
</outputs>
<equations>
......@@ -1312,10 +1349,11 @@
<import function="ConstructionCosts" from="building"/>
</imports>
<parameters>
<parameter name="Building_ID"/>
<parameter name="Building_Assoc"/>
<parameter name="Building_CC"/>
</parameters>
<invoke>Costs = ConstructionCosts(Building_Assoc, Building_CC)</invoke>
<invoke>Costs = ConstructionCosts(Building_Assoc, Building_CC, Building_ID)</invoke>
<results>
<result name="Costs"/>
</results>
......@@ -1326,11 +1364,12 @@
<import function="OccupiedSurface" from="building"/>
</imports>
<parameters>
<parameter name="Building_ID"/>
<parameter name="Building_Assoc"/>
<parameter name="Building_X"/>
<parameter name="Building_Y"/>
</parameters>
<invoke>Surface = OccupiedSurface(Building_Assoc, Building_X, Building_Y)</invoke>
<invoke>Surface = OccupiedSurface(Building_Assoc, Building_X, Building_Y, Building_ID)</invoke>
<results>
<result name="Surface"/>
</results>
......@@ -1341,12 +1380,13 @@
<import function="LivingSpace" from="building"/>
</imports>
<parameters>
<parameter name="Building_ID"/>
<parameter name="Building_Assoc"/>
<parameter name="Building_X"/>
<parameter name="Building_Y"/>
<parameter name="Building_FL"/>
</parameters>
<invoke>totalLivingSpace = LivingSpace(Building_Assoc, Building_X, Building_Y, Building_FL)</invoke>
<invoke>totalLivingSpace = LivingSpace(Building_Assoc, Building_X, Building_Y, Building_FL, Building_ID)</invoke>
<results>
<result name="totalLivingSpace"/>
</results>
......@@ -1375,6 +1415,25 @@
<result name="Building_FL" equate="floors"/>
</results>
</equation>
<equation name="mqtt">
<parameters>
<parameter name="Building34"/>
</parameters>
<invoke executor="Javascript">Building34_x + Building34_y</invoke>
<results>
<result name="mqtt"/>
</results>
</equation>
<equation name="mqtt14">
<parameters>
<parameter name="Building14"/>
</parameters>
<invoke executor="Javascript">Building14_x + Building14_y</invoke>
<results>
<result name="mqtt14"/>
</results>
</equation>
</equations>
</system>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment