public class ServerRack extends Appliance { private String type = "ServerRack"; private float basePower = 160.0f; private float maxPower = 350.0f; private float temperature = 20f; public ServerRack(boolean plugged) { super(plugged); } public void step(float seconds, float ventRPM) { if (super.getPowerState()) { temperature += min(basePower + (temperature - 20f) * 1.8f, maxPower) * seconds * 0.024f; } temperature -= (temperature - 20f) * ventRPM*0.0003f * seconds; temperature -= 0.006f * (temperature - 20f) * seconds; } public float getPowerConsumption() { if (super.getPowerState()) { return min(basePower + (temperature - 20f) * 1.8f, maxPower); } else { return 0f; } } }