public override void OnUpdate() // is called while in flight { update_count++; if (update_count < 9) { return; } update_count = 0; thermalPowerConvStrField.guiActive = convectedThermalPower > 0; // synchronize states if (_moduleDeployableRadiator != null && pivotEnabled && showControls) { if (_moduleDeployableRadiator.deployState == ModuleDeployableRadiator.DeployState.EXTENDED) { radiatorIsEnabled = true; } else if (_moduleDeployableRadiator.deployState == ModuleDeployableRadiator.DeployState.RETRACTED) { radiatorIsEnabled = false; } } radiatorIsEnabledField.guiActive = showControls; radiatorIsEnabledField.guiActiveEditor = showControls; isAutomatedField.guiActive = showControls; isAutomatedField.guiActiveEditor = showControls; pivotEnabledField.guiActive = showControls; pivotEnabledField.guiActiveEditor = showControls; if (radiatorIsEnabled && canRadiateHeat) { thermalPowerDissipStr = PluginHelper.getFormattedPowerString(radiatedThermalPower, "0.0", "0.000"); thermalPowerConvStr = PluginHelper.getFormattedPowerString(convectedThermalPower, "0.0", "0.000"); } else { thermalPowerDissipStr = "disabled"; thermalPowerConvStr = "disabled"; } radiatorTempStr = CurrentRadiatorTemperature.ToString("0.0") + "K / " + maxCurrentTemperature.ToString("0.0") + "K"; partTempStr = part.temperature.ToString("0.0") + "K / " + part.maxTemp.ToString("0.0") + "K"; if (showColorHeat) { ColorHeat(); } }
public override void OnUpdate() // is called while in flight { if (update_count > 8) { update_count = 0; Fields["thermalPowerConvStr"].guiActive = convectedThermalPower > 0; // synchronize states if (_moduleDeployableRadiator != null && pivotEnabled) { if (_moduleDeployableRadiator.deployState == ModuleDeployableRadiator.DeployState.EXTENDED) { radiatorIsEnabled = true; } else if (_moduleDeployableRadiator.deployState == ModuleDeployableRadiator.DeployState.RETRACTED) { radiatorIsEnabled = false; } } //if ((_moduleDeployableRadiator != null && _moduleDeployableRadiator.deployState == ModuleDeployableRadiator.DeployState.EXTENDED) || _moduleDeployableRadiator == null) if (radiatorIsEnabled && canRadiateHeat) { thermalPowerDissipStr = radiatedThermalPower.ToString("0.000") + "MW"; thermalPowerConvStr = convectedThermalPower.ToString("0.000") + "MW"; } else { thermalPowerDissipStr = "disabled"; thermalPowerConvStr = "disabled"; } radiatorTempStr = CurrentRadiatorTemperature.ToString("0.0") + "K / " + MaxRadiatorTemperature.ToString("0.0") + "K"; partTempStr = part.temperature.ToString("0.0") + "K / " + part.maxTemp.ToString("0.0") + "K"; if (showColorHeat) { ColorHeat(); } } update_count++; }
public override void OnUpdate() // is called while in flight { update_count++; if (update_count < FRAME_DELAY) { return; } update_count = 0; if (_moduleDeployableRadiator != null && (_moduleDeployableRadiator.deployState == ModuleDeployablePart.DeployState.RETRACTED || _moduleDeployableRadiator.deployState == ModuleDeployablePart.DeployState.EXTENDED)) { if (radiatorState != _moduleDeployableRadiator.deployState) { part.SendMessage("GeometryPartModuleRebuildMeshData"); Debug.Log("[KSPI] - Updating geometry mesh due to radiator deployment."); } radiatorState = _moduleDeployableRadiator.deployState; } thermalPowerConvStrField.guiActive = convectedThermalPower > 0; // synchronize states if (_moduleDeployableRadiator != null && pivotEnabled && showControls) { if (_moduleDeployableRadiator.deployState == ModuleDeployableRadiator.DeployState.EXTENDED) { radiatorIsEnabled = true; } else if (_moduleDeployableRadiator.deployState == ModuleDeployableRadiator.DeployState.RETRACTED) { radiatorIsEnabled = false; } } radiatorIsEnabledField.guiActive = showControls; radiatorIsEnabledField.guiActiveEditor = showControls; isAutomatedField.guiActive = showControls; isAutomatedField.guiActiveEditor = showControls; pivotEnabledField.guiActive = showControls; pivotEnabledField.guiActiveEditor = showControls; if (radiatorIsEnabled && canRadiateHeat) { thermalPowerDissipStr = PluginHelper.getFormattedPowerString(radiatedThermalPower, "0.0", "0.000"); thermalPowerConvStr = PluginHelper.getFormattedPowerString(convectedThermalPower, "0.0", "0.000"); } else { thermalPowerDissipStr = "disabled"; thermalPowerConvStr = "disabled"; } radiatorTempStr = CurrentRadiatorTemperature.ToString("0.0") + "K / " + maxCurrentTemperature.ToString("0.0") + "K"; partTempStr = part.temperature.ToString("0.0") + "K / " + part.maxTemp.ToString("0.0") + "K"; if (showColorHeat) { ColorHeat(); } }
public override void OnUpdate() // is called while in flight { update_count++; if (update_count < FRAME_DELAY) { return; } update_count = 0; if (_moduleDeployableRadiator != null && (_moduleDeployableRadiator.deployState == ModuleDeployablePart.DeployState.RETRACTED || _moduleDeployableRadiator.deployState == ModuleDeployablePart.DeployState.EXTENDED)) { if (radiatorState != _moduleDeployableRadiator.deployState) { part.SendMessage("GeometryPartModuleRebuildMeshData"); Debug.Log("[KSPI] - Updating geometry mesh due to radiator deployment."); } radiatorState = _moduleDeployableRadiator.deployState; } external_temperature = FlightGlobals.getExternalTemperature(part.transform.position); normalizedAtmosphere = Math.Min(vessel.atmDensity, 1); effectiveRadiatorArea = EffectiveRadiatorArea; maxCurrentTemperature = maxAtmosphereTemperature * Math.Max(normalizedAtmosphere, 0) + maxVacuumTemperature * Math.Max(Math.Min(1 - vessel.atmDensity, 1), 0); temperatureDifferenceCurrentWithExternal = maxCurrentTemperature - external_temperature; temperatureDifferenceMaximumWithExternal = maxRadiatorTemperature - external_temperature; thermalPowerConvStrField.guiActive = convectedThermalPower > 0; // synchronize states if (_moduleDeployableRadiator != null && pivotEnabled && showControls) { if (_moduleDeployableRadiator.deployState == ModuleDeployablePart.DeployState.EXTENDED) { radiatorIsEnabled = true; } else if (_moduleDeployableRadiator.deployState == ModuleDeployablePart.DeployState.RETRACTED) { radiatorIsEnabled = false; } } radiatorIsEnabledField.guiActive = showControls; radiatorIsEnabledField.guiActiveEditor = showControls; isAutomatedField.guiActive = showControls; isAutomatedField.guiActiveEditor = showControls; pivotEnabledField.guiActive = showControls; pivotEnabledField.guiActiveEditor = showControls; if (radiatorIsEnabled && canRadiateHeat) { thermalPowerDissipStr = PluginHelper.getFormattedPowerString(radiatedThermalPower, "0.0", "0.000"); thermalPowerConvStr = PluginHelper.getFormattedPowerString(convectedThermalPower, "0.0", "0.000"); } else { thermalPowerDissipStr = "disabled"; thermalPowerConvStr = "disabled"; } radiatorTempStr = CurrentRadiatorTemperature.ToString("0.0") + "K / " + maxCurrentTemperature.ToString("0.0") + "K"; partTempStr = part.temperature.ToString("0.0") + "K / " + part.maxTemp.ToString("0.0") + "K"; if (showColorHeat) { ColorHeat(); } }
public override void OnUpdate() // is called while in flight { radiator_deploy_delay++; if (_moduleDeployableRadiator != null && (_moduleDeployableRadiator.deployState == ModuleDeployablePart.DeployState.RETRACTED || _moduleDeployableRadiator.deployState == ModuleDeployablePart.DeployState.EXTENDED)) { if (radiatorState != _moduleDeployableRadiator.deployState) { part.SendMessage("GeometryPartModuleRebuildMeshData"); Debug.Log("[KSPI]: Updating geometry mesh due to radiator deployment."); } radiatorState = _moduleDeployableRadiator.deployState; } stefanArea = PhysicsGlobals.StefanBoltzmanConstant * effectiveRadiatorArea * 1e-6; external_temperature = Math.Max(FlightGlobals.getExternalTemperature(vessel.altitude, vessel.mainBody), PhysicsGlobals.SpaceTemperature); oxidationModifier = 0; UpdateMaxCurrentTemperature(); if (keepMaxPartTempEqualToMaxRadiatorTemp && double.IsNaN(maxCurrentRadiatorTemperature) == false) { part.skinMaxTemp = maxCurrentRadiatorTemperature; part.maxTemp = maxCurrentRadiatorTemperature; } currentTemperatureDifferenceWithExternal = maxCurrentRadiatorTemperature - external_temperature; maximumTemperatureDifferenceWithExternal = maxRadiatorTemperature - external_temperature; thermalPowerConvStrField.guiActive = convectedThermalPower > 0; // synchronize states if (_moduleDeployableRadiator != null && pivotEnabled && showControls) { if (_moduleDeployableRadiator.deployState == ModuleDeployablePart.DeployState.EXTENDED) { ActivateRadiator(); } else if (_moduleDeployableRadiator.deployState == ModuleDeployablePart.DeployState.RETRACTED) { DeactivateRadiator(); } } radiatorIsEnabledField.guiActive = !isPassive && showControls; radiatorIsEnabledField.guiActiveEditor = !isPassive && showControls; isAutomatedField.guiActive = showControls && isDeployable; isAutomatedField.guiActiveEditor = showControls && isDeployable; pivotEnabledField.guiActive = showControls && isDeployable; pivotEnabledField.guiActiveEditor = showControls && isDeployable; if (radiatorIsEnabled && canRadiateHeat) { thermalPowerDissipStr = PluginHelper.getFormattedPowerString(radiatedThermalPower, "0.0", "0.000"); thermalPowerConvStr = PluginHelper.getFormattedPowerString(convectedThermalPower, "0.0", "0.000"); } else { thermalPowerDissipStr = "disabled"; thermalPowerConvStr = "disabled"; } radiatorTempStr = CurrentRadiatorTemperature.ToString("0.0") + "K / " + maxCurrentRadiatorTemperature.ToString("0.0") + "K"; partTempStr = part.temperature.ToString("0.0") + "K / " + part.maxTemp.ToString("0.0") + "K"; if (showColorHeat) { ApplyColorHeat(); } }