Skip to content

Commit

Permalink
2: Integrate Health with the SPI to demonstrate how to add a new system
Browse files Browse the repository at this point in the history
  • Loading branch information
keilw committed Jul 18, 2020
1 parent 6073423 commit 0e214a3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
10 changes: 8 additions & 2 deletions domain/energy/src/main/java/tech/uom/demo/energy/CO2CarDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,15 @@ public static void main(String[] args) {
} else {
System.out.println(String.format("Car: %s", args[0]));
FuelType fuelType = FuelType.valueOf(args[1]);
Quantity<Length> km100 = Quantities.getQuantity(100, KILO(METRE));
final Quantity<Length> km100 = Quantities.getQuantity(100, KILO(METRE));
Quantity<Volume> fuel = Quantities.getQuantity(Double.valueOf(args[2]), LITRE);
Quantity<FuelConsumption> fuelConsumption = fuel.divide(km100).multiply(100).asType(FuelConsumption.class);

// Debug outputs, TODO could be removed later
//System.out.println(km100);
//System.out.println(fuel);
//System.out.println(fuel.to(fuel.getUnit().getSystemUnit()));

Quantity<FuelConsumption> fuelConsumption = fuel.to(fuel.getUnit().getSystemUnit()).divide(km100).multiply(100).asType(FuelConsumption.class);
SimpleUnitFormat.getInstance().label(fuelConsumption.getUnit(), "l/100 km");
System.out.println(fuelConsumption);
Quantity<CarbonFootprint> carbon100 = fuelConsumption.multiply(fuelType.getFactor()).asType(CarbonFootprint.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@

/**
*
* @author Werner
* @author Werner Keil
* @author Andi Huber
* @see <a href="http://www.dagego.de/info_waermebedarf.html">Dageto
* Wärmebedarfsermittlung (DE)</a>
* @version 0.9
* @version 1.0
*/
public class HeatRequirementDemo {

Expand Down
1 change: 1 addition & 0 deletions src/etc/CO2CarDemo (Ferrari Enzo 6 DAV-STO).launch
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tech.uom.demo.energy.CO2CarDemo"/>
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="uom-energy-demos"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="Ferrari-Enzo6 PETROL 23 1888.9"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="uom-energy-demos"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
Expand Down

0 comments on commit 0e214a3

Please sign in to comment.