Commit 94732bdb authored by Eric Tobias's avatar Eric Tobias
Browse files

Fixed some properties

parent f6a3ecf2
function Load = CircuitLoad(Breaker, Consumption)
function Load = CircuitLoad(Breaker, Lights, Dryer, Dishwasher, Laptop, Smartphone)
Load = Breaker / (Consumption / 230);
\ No newline at end of file
Load = Breaker / ((Lights + Dryer + Dishwasher + Laptop + Smartphone) / 230);
\ No newline at end of file
function Consumption = PowerConsumption(Lights, Dryer, Dishwasher, Laptop, Smartphone)
function Ampere = PowerConsumption(Lights, Dryer, Dishwasher, Laptop, Smartphone)
Consumption = Lights + Dryer + Dishwasher + Laptop + Smartphone;
\ No newline at end of file
Ampere = (Lights + Dryer + Dishwasher + Laptop + Smartphone) / 230;
\ No newline at end of file
......@@ -30,11 +30,6 @@
<artifactId>tulip</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>dk.ange</groupId>
<artifactId>javaoctave</artifactId>
<version>0.6.4</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
......
......@@ -30,6 +30,6 @@ adapter.class = lu.list.itis.dkd.tui.adapter.TuioAdapter
bootstrapping.root = scenario.xml
# Properties for the equation system
scriptEngine.executable = C:\\Octave\\Octave-4.0.0\\bin\\octave
scriptEngine.executable = C:\\Octave\\Octave-4.0.0\\bin\\octave.exe
scriptEngine.workingDir = model
equation.system = scenario.xml
\ No newline at end of file
......@@ -11,183 +11,376 @@
<name>Overloaded</name>
</scene>
</scenes>
<tangibles>
<objects>
<object>
<type>ValueWidget</type>
<coronas>
<corona>
<type>Shadow</type>
<centre>
<x>0</x>
<y>0</y>
<z>0</z>
</centre>
</corona>
</coronas>
<objects>
<object>
<type>ValueWidget</type>
<handles>
<handle>1</handle>
</handles>
<coronas>
<corona>
<type>Shadow</type>
<handle>1</handle>
<centre>
<x>0</x>
<y>0</y>
<z>0</z>
</centre>
<shape>Circle</shape>
<drawPriority>0</drawPriority>
</corona>
<corona>
<type>TextBox</type>
<handle>1</handle>
<centre>
<x>50</x>
<y>50</y>
<z>0</z>
</centre>
<drawPriority>1</drawPriority>
<text>Banana</text>
</corona>
</coronas>
<name>Lights</name>
<definingShape></definingShape>
<networkAdapter></networkAdapter>
<lowerBound>0</lowerBound>
<upperBound>1</upperBound>
<lowerStopAngle>3.1415</lowerStopAngle>
<upperStopAngle>6.2830</upperStopAngle>
<stepSize>1</stepSize>
<variable>
<name>Lights</name>
<definingShape></definingShape>
<networkAdapter></networkAdapter>
<lowerBound>0</lowerBound>
<upperBound>1</upperBound>
<lowerStopAngle>3,1415</lowerStopAngle>
<upperStopAngle>6,2830</upperStopAngle>
<stepSize>1</stepSize>
<variable>
<name>Lights</name>
<unit>Watt</unit>
<value>300</value>
</variable>
<modifyValueOnRotation>False</modifyValueOnRotation>
</object>
<object>
<type>ValueWidget</type>
<coronas>
<corona>
<type>Shadow</type>
<centre>
<x>0</x>
<y>0</y>
<z>0</z>
</centre>
</corona>
</coronas>
<name>Hair Dryer</name>
<definingShape></definingShape>
<networkAdapter></networkAdapter>
<lowerBound>0</lowerBound>
<upperBound>1</upperBound>
<lowerStopAngle>3,1415</lowerStopAngle>
<upperStopAngle>6,2830</upperStopAngle>
<stepSize>1</stepSize>
<variable>
<name>Dryer</name>
<unit>Watt</unit>
<value>2200</value>
</variable>
<modifyValueOnRotation>False</modifyValueOnRotation>
</object>
<object>
<type>ValueWidget</type>
<coronas>
<corona>
<type>Shadow</type>
<centre>
<x>0</x>
<y>0</y>
<z>0</z>
</centre>
</corona>
</coronas>
<unit>Watt</unit>
<value>300</value>
</variable>
<modifyValueOnRotation>False</modifyValueOnRotation>
</object>
<object>
<type>ValueWidget</type>
<handles>
<handle>2</handle>
</handles>
<coronas>
<corona>
<type>Shadow</type>
<handle>2</handle>
<centre>
<x>0</x>
<y>0</y>
<z>0</z>
</centre>
<shape>Circle</shape>
<drawPriority>0</drawPriority>
</corona>
<corona>
<type>TextBox</type>
<handle>1</handle>
<centre>
<x>50</x>
<y>50</y>
<z>0</z>
</centre>
<drawPriority>1</drawPriority>
<text>Banana</text>
</corona>
</coronas>
<name>Hair Dryer</name>
<definingShape></definingShape>
<networkAdapter></networkAdapter>
<lowerBound>0</lowerBound>
<upperBound>1</upperBound>
<lowerStopAngle>3.1415</lowerStopAngle>
<upperStopAngle>6.2830</upperStopAngle>
<stepSize>1</stepSize>
<variable>
<name>Dryer</name>
<unit>Watt</unit>
<value>2200</value>
</variable>
<modifyValueOnRotation>False</modifyValueOnRotation>
</object>
<object>
<type>ValueWidget</type>
<handles>
<handle>3</handle>
</handles>
<coronas>
<corona>
<type>Shadow</type>
<handle>3</handle>
<centre>
<x>0</x>
<y>0</y>
<z>0</z>
</centre>
<shape>Circle</shape>
<drawPriority>0</drawPriority>
</corona>
<corona>
<type>TextBox</type>
<handle>1</handle>
<centre>
<x>50</x>
<y>50</y>
<z>0</z>
</centre>
<drawPriority>1</drawPriority>
<text>Banana</text>
</corona>
</coronas>
<name>Dishwasher</name>
<definingShape></definingShape>
<networkAdapter></networkAdapter>
<lowerBound>0</lowerBound>
<upperBound>1</upperBound>
<lowerStopAngle>3.1415</lowerStopAngle>
<upperStopAngle>6.2830</upperStopAngle>
<stepSize>1</stepSize>
<variable>
<name>Dishwasher</name>
<definingShape></definingShape>
<networkAdapter></networkAdapter>
<lowerBound>0</lowerBound>
<upperBound>1</upperBound>
<lowerStopAngle>3,1415</lowerStopAngle>
<upperStopAngle>6,2830</upperStopAngle>
<stepSize>1</stepSize>
<variable>
<name>Dishwasher</name>
<unit>Watt</unit>
<value>1800</value>
</variable>
<modifyValueOnRotation>False</modifyValueOnRotation>
</object>
<object>
<type>ValueWidget</type>
<coronas>
<corona>
<type>Shadow</type>
<centre>
<x>0</x>
<y>0</y>
<z>0</z>
</centre>
</corona>
</coronas>
<unit>Watt</unit>
<value>1800</value>
</variable>
<modifyValueOnRotation>False</modifyValueOnRotation>
</object>
<object>
<type>ValueWidget</type>
<handles>
<handle>4</handle>
</handles>
<coronas>
<corona>
<type>Shadow</type>
<handle>4</handle>
<centre>
<x>0</x>
<y>0</y>
<z>0</z>
</centre>
<shape>Circle</shape>
<drawPriority>0</drawPriority>
</corona>
<corona>
<type>TextBox</type>
<handle>1</handle>
<centre>
<x>50</x>
<y>50</y>
<z>0</z>
</centre>
<drawPriority>1</drawPriority>
<text>Banana</text>
</corona>
</coronas>
<name>Laptop</name>
<definingShape></definingShape>
<networkAdapter></networkAdapter>
<lowerBound>0</lowerBound>
<upperBound>1</upperBound>
<lowerStopAngle>3.1415</lowerStopAngle>
<upperStopAngle>6.2830</upperStopAngle>
<stepSize>1</stepSize>
<variable>
<name>Laptop</name>
<definingShape></definingShape>
<networkAdapter></networkAdapter>
<lowerBound>0</lowerBound>
<upperBound>1</upperBound>
<lowerStopAngle>3,1415</lowerStopAngle>
<upperStopAngle>6,2830</upperStopAngle>
<stepSize>1</stepSize>
<variable>
<name>Laptop</name>
<unit>Watt</unit>
<value>100</value>
</variable>
<modifyValueOnRotation>False</modifyValueOnRotation>
</object>
<object>
<type>ValueWidget</type>
<coronas>
<corona>
<type>Shadow</type>
<centre>
<x>0</x>
<y>0</y>
<z>0</z>
</centre>
</corona>
</coronas>
<unit>Watt</unit>
<value>100</value>
</variable>
<modifyValueOnRotation>False</modifyValueOnRotation>
</object>
<object>
<type>ValueWidget</type>
<handles>
<handle>5</handle>
</handles>
<coronas>
<corona>
<type>Shadow</type>
<handle>5</handle>
<centre>
<x>0</x>
<y>0</y>
<z>0</z>
</centre>
<shape>Circle</shape>
<drawPriority>0</drawPriority>
</corona>
<corona>
<type>TextBox</type>
<handle>1</handle>
<centre>
<x>50</x>
<y>50</y>
<z>0</z>
</centre>
<drawPriority>1</drawPriority>
<text>Banana</text>
</corona>
</coronas>
<name>Smartphone</name>
<definingShape></definingShape>
<networkAdapter></networkAdapter>
<lowerBound>0</lowerBound>
<upperBound>1</upperBound>
<lowerStopAngle>3.1415</lowerStopAngle>
<upperStopAngle>6.2830</upperStopAngle>
<stepSize>1</stepSize>
<variable>
<name>Smartphone</name>
<definingShape></definingShape>
<networkAdapter></networkAdapter>
<lowerBound>0</lowerBound>
<upperBound>1</upperBound>
<lowerStopAngle>3,1415</lowerStopAngle>
<upperStopAngle>6,2830</upperStopAngle>
<stepSize>1</stepSize>
<variable>
<name>Smartphone</name>
<unit>Watt</unit>
<value>5</value>
</variable>
<modifyValueOnRotation>False</modifyValueOnRotation>
</object>
<object>
<type>ValueWidget</type>
<coronas>
<corona>
<type>Shadow</type>
<centre>
<x>0</x>
<y>0</y>
<z>0</z>
</centre>
</corona>
</coronas>
<unit>Watt</unit>
<value>5</value>
</variable>
<modifyValueOnRotation>False</modifyValueOnRotation>
</object>
<object>
<type>ValueWidget</type>
<handles>
<handle>6</handle>
</handles>
<coronas>
<corona>
<type>Shadow</type>
<handle>6</handle>
<centre>
<x>0</x>
<y>0</y>
<z>0</z>
</centre>
<shape>Circle</shape>
<drawPriority>0</drawPriority>
</corona>
<corona>
<type>TextBox</type>
<handle>1</handle>
<centre>
<x>50</x>
<y>50</y>
<z>0</z>
</centre>
<drawPriority>1</drawPriority>
<text>Banana</text>
</corona>
</coronas>
<name>Breaker</name>
<definingShape></definingShape>
<networkAdapter></networkAdapter>
<lowerBound>0</lowerBound>
<upperBound>1</upperBound>
<lowerStopAngle>3.1415</lowerStopAngle>
<upperStopAngle>6.2830</upperStopAngle>
<stepSize>1</stepSize>
<variable>
<name>Breaker</name>
<definingShape></definingShape>
<networkAdapter></networkAdapter>
<lowerBound>0</lowerBound>
<upperBound>1</upperBound>
<lowerStopAngle>3,1415</lowerStopAngle>
<upperStopAngle>6,2830</upperStopAngle>
<stepSize>1</stepSize>
<variable>
<name>Breaker</name>
<unit>Ampere</unit>
<value>16</value>
</variable>
<modifyValueOnRotation>False</modifyValueOnRotation>
</object>
</objects>
</tangibles>
<unit>A</unit>
<value>16</value>
</variable>
<modifyValueOnRotation>False</modifyValueOnRotation>
</object>
<object>
<type>ValueWidget</type>
<handles>
<handle>7</handle>
</handles>
<coronas>
<corona>
<type>Shadow</type>
<handle>7</handle>
<centre>
<x>0</x>
<y>0</y>
<z>0</z>
</centre>
<shape>Circle</shape>
<drawPriority>0</drawPriority>
</corona>
<corona>
<type>TextBox</type>
<handle>7</handle>
<centre>
<x>50</x>
<y>50</y>
<z>0</z>
</centre>
<drawPriority>1</drawPriority>
<text>Banana</text>
</corona>
</coronas>
<name>Ampere</name>
<definingShape></definingShape>
<networkAdapter></networkAdapter>
<lowerBound>0</lowerBound>
<upperBound>1</upperBound>
<lowerStopAngle>3.1415</lowerStopAngle>
<upperStopAngle>6.2830</upperStopAngle>
<stepSize>1</stepSize>
<variable>
<name>Ampere</name>
<unit>A</unit>
<value>0</value>
</variable>
<modifyValueOnRotation>False</modifyValueOnRotation>
</object>
<object>
<type>ValueWidget</type>
<handles>
<handle>8</handle>
</handles>
<coronas>
<corona>
<type>Shadow</type>
<handle>8</handle>
<centre>
<x>0</x>
<y>0</y>
<z>0</z>
</centre>
<shape>Circle</shape>
<drawPriority>0</drawPriority>
</corona>
<corona>
<type>TextBox</type>
<handle>8</handle>
<centre>
<x>50</x>
<y>50</y>
<z>0</z>
</centre>
<drawPriority>1</drawPriority>
<text>Banana</text>
</corona>
</coronas>
<name>Load</name>
<definingShape></definingShape>
<networkAdapter></networkAdapter>
<lowerBound>0</lowerBound>
<upperBound>1</upperBound>
<lowerStopAngle>3.1415</lowerStopAngle>
<upperStopAngle>6.2830</upperStopAngle>
<stepSize>1</stepSize>
<variable>
<name>Load</name>
<unit>%</unit>
<value>0</value>
</variable>
<modifyValueOnRotation>False</modifyValueOnRotation>
</object>
</objects>
<system>
<outputs>
<output name="Load" />
<output name="Ampere" />
</outputs>
<equations>
<equation name="Ampere">
<equation name="Power Consumption">
<parameters>
<parameter name="Consumption" />
<parameter name="Lights" />
<parameter name="Dryer" />
<parameter name="Dishwasher" />
<parameter name="Laptop" />
<parameter name="Smartphone" />
</parameters>
<invoke>Ampere = Consumption / 230</invoke>
<invoke>Ampere = PowerConsumption (Lights, Dryer, Dishwasher, Laptop, Smartphone);</invoke>
<results>
<result name="Ampere" />
</results>
......@@ -196,13 +389,18 @@
<equation name="Circuit Load">
<parameters>
<parameter name="Breaker" />
<parameter name="Consumption" />
<parameter name="Lights" />
<parameter name="Dryer" />
<parameter name="Dishwasher" />
<parameter name="Laptop" />
<parameter name="Smartphone" />
</parameters>
<invoke>Load = CircuitLoad (Breaker, Consumption);</invoke>
<invoke>Load = CircuitLoad (Breaker, Lights, Dryer, Dishwasher, Laptop, Smartphone);</invoke>
<results>
<result name="Load" />
</results>
</equation>
</equations>
</system>
</scenario>
\ No newline at end of file
......@@ -15,8 +15,8 @@ package lu.list.itis.dkd.tui.scenario;
import lu.list.itis.dkd.cps.system.EquationSystemBuilder;
import lu.list.itis.dkd.cps.system.EquationSystemException;
import lu.list.itis.dkd.cps.variable.NumericalVariable;
import lu.list.itis.dkd.cps.variable.Variable;
import lu.list.itis.dkd.cps.variable.tangible.TangibleNumericalVariable;
import lu.list.itis.dkd.dbc.annotation.NonNullByDefault;
import lu.list.itis.dkd.tui.TangibleApplication;
import lu.list.itis.dkd.tui.TangibleObjectManager;
......@@ -24,6 +24,7 @@ import lu.list.itis.dkd.tui.bootstrapping.TangibleApplicationBootstrapper;
import lu.list.itis.dkd.tui.exception.BuildException;
import lu.list.itis.dkd.tui.scenario.bootstrapping.SceneBootstrapper;
import lu.list.itis.dkd.tui.utility.PropertiesFetcher;
import lu.list.itis.dkd.tui.widget.BaseWidget;
import lu.list.itis.dkd.tui.widget.ValueWidget;
import com.google.common.base.Strings;
......@@ -113,7 +114,7 @@ public abstract class Scenario {
private void initializeScenario() throws BuildException {
try {
equationSystemBuilder = new EquationSystemBuilder(PropertiesFetcher.fetchProperties());
equationSystemBuilder.parseEquationFile(new File(PropertiesFetcher.fetchProperties().getProperty("equation.system")));
equationSystemBuilder.parseEquationFile(new File(PropertiesFetcher.fetchProperties().getProperty("equation.system"))); //$NON-NLS-1$
} catch (final EquationSystemException exception) {
throw new BuildException("The equation system for this scenario could not be built!", exception); //$NON-NLS-1$
}
......@@ -136,14 +137,23 @@ public abstract class Scenario {
* initialized by the equation system.
*/
private void populateVariables() {
TangibleObjectManager.getWidgets().stream().filter(w -> ValueWidget.class.isInstance(w)).forEach(w -> ((ValueWidget) w).setVariable(findVariable(((ValueWidget) w).getVariable().getName())));
for (final BaseWidget widget : TangibleObjectManager.getWidgets()) {
if (widget instanceof ValueWidget) {
final TangibleNumericalVariable variable = findVariable(((ValueWidget) widget).getVariable().getName());
((ValueWidget) widget).setVariable(variable);
}
}
// TangibleObjectManager.getWidgets().stream().filter(w ->
// ValueWidget.class.isInstance(w)).forEach(w -> ((ValueWidget)
// w).setVariable(findVariable(((ValueWidget) w).getVariable().getName())));
}