diff --git a/app/components/line-chart.js b/app/components/line-chart.js index de62be7..e22491e 100644 --- a/app/components/line-chart.js +++ b/app/components/line-chart.js @@ -1,11 +1,11 @@ import Ember from 'ember'; +import ENV from '../config/environment'; export default Ember.Component.extend({ tagName: 'div', classNames: ['line-chart'], attributeBindings: ['style'], - xaxisLength: 300, - updateTime: 100, + xaxisLength: 120, height: '100%', useLabel: true, @@ -19,7 +19,7 @@ export default Ember.Component.extend({ Ember.run.later(this, function() { this._drawPlot(); - }, this.updateTime); + }, ENV.APP.UPDATE_RATE); }, dataDidChange: function() { @@ -108,6 +108,6 @@ export default Ember.Component.extend({ // try again Ember.run.later(this, function() { this._drawPlot(); - }, this.updateTime); + }, ENV.APP.UPDATE_RATE); } }); diff --git a/app/controllers/lab-mashup.js b/app/controllers/lab-mashup.js index f453715..1ac95b6 100644 --- a/app/controllers/lab-mashup.js +++ b/app/controllers/lab-mashup.js @@ -9,24 +9,38 @@ export default Ember.Controller.extend({ return this.model.findBy('id', 'S2_ElectricalGrid'); }.property('model.[]'), - S1Freq575: function() { - var entity = this.model.findBy('id', 'S1_ElectricalGrid'); - if (entity) { - return entity.get('properties').findBy('name', 'Freq_575'); - } - }.property('model.[]'), - - S2Voltage203937: function() { - var entity = this.model.findBy('id', 'S2_ElectricalGrid'); - if (entity) { - return entity.get('properties').findBy('name', 'Voltage203937'); - } - }.property('model.[]'), - - S2Flow1551412_204871: function() { - var entity = this.model.findBy('id', 'S2_ElectricalGrid'); - if (entity) { - return entity.get('properties').findBy('name', 'Flow1551412_204871'); - } - }.property('model.[]') + S1Freq575: function() { + var entity = this.model.findBy('id', 'S1_ElectricalGrid'); + if (entity) { + return entity.get('properties').findBy('name', 'Freq_575'); + } + }.property('model.[]'), + + S2Voltage203937: function() { + var entity = this.model.findBy('id', 'S2_ElectricalGrid'); + if (entity) { + return entity.get('properties').findBy('name', 'Voltage203937'); + } + }.property('model.[]'), + + S2Flow1551412_204871: function() { + var entity = this.model.findBy('id', 'S2_ElectricalGrid'); + if (entity) { + return entity.get('properties').findBy('name', 'Flow1551412_204871'); + } + }.property('model.[]'), + + S3LoadProfile: function() { + var entity = this.model.findBy('id', 'S3_ElectricalGrid'); + if (entity) { + return entity.get('properties').findBy('name', 'LoadProfile'); + } + }.property('model.[]'), + + S3GenProfile: function() { + var entity = this.model.findBy('id', 'S3_ElectricalGrid'); + if (entity) { + return entity.get('properties').findBy('name', 'GenProfile'); + } + }.property('model.[]') }); diff --git a/app/routes/lab-mashup.js b/app/routes/lab-mashup.js index 13de805..f988428 100644 --- a/app/routes/lab-mashup.js +++ b/app/routes/lab-mashup.js @@ -1,4 +1,5 @@ import Ember from 'ember'; +import ENV from '../config/environment'; export default Ember.Route.extend({ model() { @@ -12,6 +13,11 @@ export default Ember.Route.extend({ id: 'S2_ElectricalGrid', isPattern: false, type: 'ElectricalGridMonitoring' + }, + { + id: 'S3_ElectricalGrid', + isPattern: false, + type: 'ElectricalGridMonitoring' } ]}); //return this.store.findAll('entity'); @@ -21,7 +27,7 @@ export default Ember.Route.extend({ // first time call poll Ember.run.later(this, function() { this.refreshEntities(); - }, 100); + }, ENV.APP.UPDATE_RATE); }, refreshEntities: function() { @@ -36,6 +42,11 @@ export default Ember.Route.extend({ id: 'S2_ElectricalGrid', isPattern: false, type: 'ElectricalGridMonitoring' + }, + { + id: 'S3_ElectricalGrid', + isPattern: false, + type: 'ElectricalGridMonitoring' } ]}); //this.store.findAll('entity'); @@ -43,6 +54,6 @@ export default Ember.Route.extend({ // reschedule refresh Ember.run.later(this, function() { this.refreshEntities(); - }, 100); + }, ENV.APP.UPDATE_RATE); } }); diff --git a/app/serializers/application.js b/app/serializers/application.js index bff92af..3eb233f 100644 --- a/app/serializers/application.js +++ b/app/serializers/application.js @@ -78,33 +78,35 @@ export default DS.RESTSerializer.extend({ } if (item.contextElement.attributes) { - item.contextElement.attributes.forEach(function(attribute) { + var timestamp = 0; + + item.contextElement.attributes.forEach(function(attribute) { + if (attribute.name === 'timestamp') { + timestamp = attribute.value; + } + }); + + item.contextElement.attributes.forEach(function(attribute) { if (attribute.type !== 'category' && attribute.name !== 'timestamp') { // find metadata - var timestamp = 0; - var source = ""; - var minValue; - var maxValue; + var source = ""; + var minValue; + var maxValue; if (attribute.metadatas) { attribute.metadatas.forEach(function(metadata) { if (metadata.name === 'timestamp') { timestamp = Date.parse(metadata.value); } else if (metadata.name === 'source') { - source = metadata.value; + source = metadata.value; } else if (metadata.name === 'min') { - minValue = metadata.value; + minValue = metadata.value; } else if (metadata.name === 'max') { - maxValue = metadata.value; + maxValue = metadata.value; } }); } - if (timestamp === 0) { - timestamp = (new Date()).getTime(); - } - - // create property var property = { type: 'property', @@ -114,9 +116,9 @@ export default DS.RESTSerializer.extend({ type: attribute.type, timestamp: timestamp, visible: false, - source: source, - minValue: minValue, - maxValue: maxValue, + source: source, + minValue: minValue, + maxValue: maxValue, values: [] }, relationships: { @@ -136,7 +138,7 @@ export default DS.RESTSerializer.extend({ property.attributes.values.push(value); }); } else { - property.attributes.values.push([timestamp, attribute.value]); + property.attributes.values.push([(new Date()).getTime(), attribute.value]); } } @@ -181,6 +183,10 @@ export default DS.RESTSerializer.extend({ record.get('values').push(value); }); + while (record.get('values').length > 500) { + record.get('values').shift(); + } + record.set('timestamp', item.attributes.timestamp); } } else { diff --git a/app/styles/app.css b/app/styles/app.css index 22f37d0..7ace4ca 100644 --- a/app/styles/app.css +++ b/app/styles/app.css @@ -61,29 +61,29 @@ header { color: #103B7D; background-color: #fff; - height: 60px; + height: 80px; top: 0; border-bottom: 3px solid #bbb; } header #title { - font-size: 25px; + font-size: 30px; font-weight: 100; text-align: left; text-rendering: optimizeLegibility; -webkit-text-rendering: optimizeLegiblity; -moz-text-rendering: optimizeLegibitliy; - padding: 15px 0 20px 30px; + padding: 25px 0 20px 30px; float: left; } header #logos { - height: 60px; + height: 80px; - padding-top: 15px; + padding-top: 8px; float: right; } @@ -100,23 +100,23 @@ footer { } #main { - top: 60px; - bottom: 25px; + top: 80px; + bottom: 0px; left: 20px; right: 20px; } .svg-image { - width: 90%; + width: 96%; height: auto; - padding-left: 130px; + padding-left: 42px; } .svg-logo { width: auto; - height: 30px; + height: 60px; padding-right: 30px; @@ -124,9 +124,9 @@ footer { } #rwth-logo { - margin-top: 10px; + margin-top: 15px; - height: 15px !important; + height: 30px !important; } h1 { @@ -235,7 +235,6 @@ p { } #simulation-page { - } #consumer-page h2 { diff --git a/app/templates/application.hbs b/app/templates/application.hbs index d5815f9..4ebf23f 100644 --- a/app/templates/application.hbs +++ b/app/templates/application.hbs @@ -7,14 +7,8 @@ - {{outlet}} - - - diff --git a/app/templates/components/entity-chart.hbs b/app/templates/components/entity-chart.hbs index 16159e2..980acdf 100644 --- a/app/templates/components/entity-chart.hbs +++ b/app/templates/components/entity-chart.hbs @@ -1,15 +1,15 @@ -
+ {{#if entityAvailable}} {{property-table model=entity showProperty="showPropertyValues"}} {{/if}} -

{{entityName}}

+

{{entityName}}

{{#if entityAvailable}} - {{line-chart data=visibleProperty height="80%"}} + {{line-chart data=visibleProperty height="95%"}}