|
@@ -138,22 +138,6 @@ public class HolonBattery extends AbstractCpsObject{
|
|
|
|
|
|
|
|
|
|
stateOfChargeLevels[x] = validStateOfCharge(newStateOfCharge);
|
|
stateOfChargeLevels[x] = validStateOfCharge(newStateOfCharge);
|
|
- //DEBUG
|
|
|
|
- //TODO delete Debug
|
|
|
|
- boolean debug = false;
|
|
|
|
- if(debug)
|
|
|
|
- {
|
|
|
|
- System.out.println( "Iterations:" + x);
|
|
|
|
- for(int i = 0; i < stateOfChargeLevels.length - 1; i++)
|
|
|
|
- {
|
|
|
|
- System.out.print( i+":"+stateOfChargeLevels[i]+ ", ");
|
|
|
|
- if(i%10 == 0)
|
|
|
|
- {
|
|
|
|
- System.out.println();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- System.out.println( stateOfChargeLevels.length - 1+":"+stateOfChargeLevels[stateOfChargeLevels.length - 1]);
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
public float getStateOfChargeAtTimeStep(int x) {
|
|
public float getStateOfChargeAtTimeStep(int x) {
|
|
if(iterations != SingletonControl.getInstance().getControl().getModel().getIterations())
|
|
if(iterations != SingletonControl.getInstance().getControl().getModel().getIterations())
|
|
@@ -191,4 +175,13 @@ public class HolonBattery extends AbstractCpsObject{
|
|
return stateOfChargeToValid;
|
|
return stateOfChargeToValid;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ public String getImageBattery() {
|
|
|
|
+ //HardCoded Image selection
|
|
|
|
+
|
|
|
|
+ float actualStateOfCharge = getStateOfChargeAtTimeStep(SingletonControl.getInstance().getControl().getModel().getCurIteration() - 1 );
|
|
|
|
+ int whichOne = (int)(actualStateOfCharge/capacity * 4);
|
|
|
|
+ String battery = "/Images/battery"+ whichOne + ".png";
|
|
|
|
+ setImage(battery);
|
|
|
|
+ return battery;
|
|
|
|
+ }
|
|
}
|
|
}
|