Kaynağa Gözat

Implements Saving/Loading of HolonBatterys States

Changes the HolonBattery Constructor to a 1000U in&out Ratio with 20000U
capacity
Andreas T. Meyer-Berg 7 yıl önce
ebeveyn
işleme
6f794e99f8
1 değiştirilmiş dosya ile 12 ekleme ve 4 silme
  1. 12 4
      src/classes/HolonBattery.java

+ 12 - 4
src/classes/HolonBattery.java

@@ -1,14 +1,23 @@
 package classes;
 import ui.model.Model;
+
+import com.google.gson.annotations.Expose;
+
 import ui.controller.*;
 
 public class HolonBattery extends AbstractCpsObject{
 	
+	@Expose
 	private float inRatio;
+	@Expose
 	private float outRatio;
+	@Expose
 	private float capacity;
+	@Expose
 	private float initialStateOfCharge;
+	@Expose
 	private float[] stateOfChargeLevels;
+	@Expose
 	private float iterations = 0;
 	public enum State{STANDBY, COLLECT, EMIT};
 	private State state;
@@ -18,9 +27,9 @@ public class HolonBattery extends AbstractCpsObject{
 	public HolonBattery(String ObjName)
 	{
 		super(ObjName);
-		inRatio = 0;
-		outRatio = 0;
-		capacity = 0;
+		inRatio = 1000.0f;
+		outRatio = 1000.0f;
+		capacity = 20000.0f;
 		initialStateOfCharge = 0;
 		setState(State.STANDBY);
 	}
@@ -38,7 +47,6 @@ public class HolonBattery extends AbstractCpsObject{
 		setState(State.STANDBY);
 	}
 	public float getCapacity() {
-	
 		return capacity;
 	}
 	public void setCapacity(float capacity) {