public override string GetExplanationUnfinalized(StatRequest req, ToStringNumberSense numberSense)
        {
            CompTempControl tempControl    = req.Thing.TryGetComp <CompTempControl>();
            Thing           tempController = req.Thing;

            IntVec3 intVec3_1 = tempController.Position + IntVec3.North.RotatedBy(tempController.Rotation);
            IntVec3 intVec3_2 = tempController.Position + IntVec3.South.RotatedBy(tempController.Rotation);

            float cooledRoomTemp          = intVec3_1.GetTemperature(tempController.Map);
            float extRoomTemp             = intVec3_2.GetTemperature(tempController.Map);
            float efficiencyLossPerDegree = 1.0f / 130.0f;                     // SOS2 internal value, means loss of efficiency for each degree above targettemp, lose 50% at 65C above targetTemp, 100% at 130+
            float energyPerSecond         = tempControl.Props.energyPerSecond; // the power of the radiator
            float roomSurface             = SOS2HS_SOS2_Radiator.GetRoomSurface(req.Thing);
            float coolingConversionRate   = 4.16666651f;                       // Celsius cooled per JoulesSecond*Meter^2  conversion rate
            float sidesTempGradient       = (cooledRoomTemp - extRoomTemp);
            float efficiency     = (1f - sidesTempGradient * efficiencyLossPerDegree);
            float maxACPerSecond = energyPerSecond * efficiency / roomSurface * coolingConversionRate; // max cooling power possible


            SEB seb = new SEB("StatsReport_SOS2HS");

            seb.Simple("CooledRoomTemp", cooledRoomTemp);
            seb.Simple("ExteriorRoomTemp", extRoomTemp);
            seb.Simple("EfficiencyLossPerDegree", efficiencyLossPerDegree);
            seb.Simple("EnergyPerSecond", energyPerSecond);
            seb.Simple("CooledRoomSurface", roomSurface);
            seb.Simple("ACConversionRate", coolingConversionRate);
            seb.Full("SidesTempGradient", sidesTempGradient, cooledRoomTemp, extRoomTemp);
            seb.Full("RelativeEfficiency", efficiency * 100, sidesTempGradient, efficiencyLossPerDegree);
            seb.Full("MaxACPerSecond", maxACPerSecond, energyPerSecond, efficiency, roomSurface, coolingConversionRate);

            return(seb.ToString());
        }
Exemple #2
0
 public override float GetValueUnfinalized(StatRequest req, bool applyPostProcess = true)
 {
     if (req.Thing == null)
     {
         Log.Error("Getting " + this.GetType().FullName + " for " + req.Def.defName + " without concrete thing. This always returns 1. This is a bug. Contact the dev.");
         return(1);
     }
     return(SOS2HS_SOS2_Radiator.GetCurrentACPerSecond(req, applyPostProcess));
 }
Exemple #3
0
        public override string GetExplanationUnfinalized(StatRequest req, ToStringNumberSense numberSense)
        {
            CompTempControl tempControl    = req.Thing.TryGetComp <CompTempControl>();
            Thing           tempController = req.Thing;

            IntVec3 intVec3_1 = tempController.Position + IntVec3.North.RotatedBy(tempController.Rotation);

            float cooledRoomTemp = intVec3_1.GetTemperature(tempController.Map);
            float targetTemp     = tempControl.targetTemperature;
            float targetTempDiff = targetTemp - cooledRoomTemp;
            float maxACPerSecond = SOS2HS_SOS2_Radiator.GetMaxACPerSecond(req); // max cooling power possible
            bool  isHeater       = tempControl.Props.energyPerSecond > 0;
            float actualAC;

            if (isHeater)
            {
                actualAC = Mathf.Max(Mathf.Min(targetTempDiff, maxACPerSecond), 0);
            }
            else
            {
                actualAC = Mathf.Min(Mathf.Max(targetTempDiff, maxACPerSecond), 0);
            }

            SEB seb = new SEB("StatsReport_SOS2HS");

            seb.Simple("CooledRoomTemp", cooledRoomTemp);
            seb.Simple("TargetTemperature", targetTemp);
            seb.Full("TargetTempDiff", targetTempDiff, targetTemp, cooledRoomTemp);
            seb.Simple("MaxACPerSecond", maxACPerSecond);
            if (isHeater)
            {
                seb.Full("ActualHeaterACPerSecond", actualAC, targetTempDiff, maxACPerSecond);
            }
            else
            {
                seb.Full("ActualCoolerACPerSecond", actualAC, targetTempDiff, maxACPerSecond);
            }

            return(seb.ToString());
        }