-
Posts
346 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by Blackline
-
Using stock heat system
Blackline replied to Blackline's topic in KSP1 C# Plugin Development Help and Support
Thanks for clarification regarding warp and supposed heat mechanic. but I think I have to go with the core heat module, because I want to be able to stop radiators from cooling my stuff too much, and tempGoal seems to be the perfect functionality for this purpose. But since I can't get my batteries' heat system to work properly, are there any mods out there using the moduleCoreHeat? I can't find anything. -
Ok, this day was used to get heat working: what a pain... Uploaded my todays work to github, no new release. tried ModuleCoreHeat with coreHeatModule.AddEnergyToCore, but the stuff just won't work properly: CoreTempGoal not showing the values from the MM cfg (maybe something is wrong there...) if i try to get the field within the C# lines, but the radiator behavior shows a fixed goal of 500K, no matter what i enter (like 320K) tried part.AddThermalFlux: no radiator will ever work and cool my battery down Any ideas? I really want to stay as stock as possible... EDIT for Point 1: Holy snacks, i am quite a fool: BatteryTempStatus = String.Format("{0:F1} K / {0:F1} K", currentTemp, maxTemp); and wondering, why it shows the currentTemp twice. So i think ill stick to coreTemp System. New upload ready!
-
Hello everyone, after some family time, here comes the update: -new: MM cfg, that duplicates all stock batteries and makes real batteries out of it.--> Module Manager needed -new: moved battery config into dll, part.cfg can choose between available battery techs (like lead_acid, li_ion etc.) Currently lead-acid only, which gives about 3.6 times the EC per weight compared to stock batteries. Lead acid batteries are charged with 1C and discharged with 10C (ie. a 1kWh Battery will give 10EC/s to the EC pool while discharging, and take 1EC/s while charging) There is also a sort of saturation feature, where the charging rate will slow down with higher SOC's (Sate of Charge ie. how full the battery is) its about 100% until 50%SOC, 80% up to 80%SOC and 50% at 100% SOC -info: 1 EC is now treated as 1kWs; 1 StoredCharge is now treated as 1kWh, thus 3600EC = 1SC Have fun! EDIT made me self a release: https://github.com/blackliner/RealBattery/releases/tag/v1.1.0
-
Since I am very new to the API: could you explain that mechanic a little further? methods, fields, your github source :-)
-
Thats on thing on my list: batteries will loose stored charge over time, just like real ones. then, as a next step, id need to implement a vessel wide EC drain, using the same technique, just different parameters (because capacitors loose ther charge faster). if someone now would install one of my batteries, the would try to keep the EC level on 95% (thats already implemented) and thus discharge themselves, to compensate the capacitor loss. I think id like that behavior very much ;-)
-
Figured that after reading moooarrr of your and freethinkers work... I think I am gonna start with some moduleCoreHeat for the time being, and handle timewarp when time comes. Btw, did anyone try my last night's update? concerns, questions, requests?
-
KSP Interstellar Extended Continued Development Thread
Blackline replied to FreeThinker's topic in KSP1 Mod Development
Danfarnsy on page 169 mentioned a way to get rid of waste heat in favour of the stock heat system. did this venture go well? I am asking, because maybe we (other mod developers) could learn a lot from that. Cheers -
Ah, suddenly it makes sense, why your wasteheat bars get unusually high during warp. how does stock ksp solve that issue? I really would like to stay as stock as possible. And regarding your usage of Megajoules: the one reason you mention in the wiki is not valid anymore, since 1.2 brought a new functionality for engines to not suck out all available EC/fuel. nevertheless, havin 12000000EC doesn't make sense as well... I wish, the stock display of large values would automatically add k(ilo), M(ega) and G(iga) and only show 3 significant values.
-
I use TimeWarp.fixedDeltaTime, I thought that accounts all the timing stuff. Doesn't it?
-
Hi there, For my mod RealBattery I would like to implement a heat-up system when dis/charging my battery and reduce charge rates. Many mods use their own heat system, like KSPI-E wasteheat. Is it possible to use the stock heat system (internal, part, skin temp + all the Flux)? any tutorials/mods to learn from? Thanks!
-
Updated Version: more Info in VAB, different charge and discharge rates, mass auto-configs to given capacity and energy density, same with discharge rate.
-
I thought I saw 1 EC is 1 Ws, thats where my assumption comes from. do you have a source for that? I would definitely prefer 1kWs! Edit: got it, thats the next thing im gonna do https://github.com/KSP-RO/RealismOverhaul/wiki
-
I am using StoredCharge for my RealBattery mod. is there a way to change its tweakable property to true?
-
Weird, recharching should happen if over 80% total EC. can you post a Screenshot during full EC and low StoredCharge? Regarding the outstanding balancing: Apollo CSM had a 400Ah battery, with 28V that makes roughly 1.2kWh. This would aready convert to 4 million EC!.... Maybe only trains need more than that :-)
-
Alright, i created 2 batteries for now. get it here: https://github.com/blackliner/RealBattery/tree/master/RealBattery/GameData/RealBattery You will need Assumptions: 1 StoredCharge (from CRP) = 1kWh; 1 EC = 1 W; lead-acid energy density: 110 kJ/kg or 30 kWh/t and a power density of 300W/kg 20 kWh lead-acid battery based on stock 200EC model. That thing has to weigh 700kg !!! and could supply 210kW = 210000 EC per second. Balancing issues... 100 kWh based in 1k model, 3.3t and i dont even mention the power capabilities. So, next step would be a reconsidering of assumptions. I think i will look closer at the apollo onboard batteries, which were charged by fuel cells. That should give some aprox. on the needed values.
-
The hard part is done now, take the cfg and make it as heavy as possible. you can config charge rates and ratio, even efficiency for charging. The next thing to do is balancing, maybe another color/model and make a real mod out of it. The plugin was made using visual Studio 15 community edition (free) and c#. very easy! there is a tutorial in the wiki how to setup visual Studio.
-
One Step ahead: But it wont work, it seems OnFixedUpdate is not called... EDIT: seems a part.force_activate(); was missing, it works!! EDIT2: final set for tonight: using System; using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; namespace KSPplugin1 { public class Bettery : PartModule { // Charge Rate, how much storedCharge is taken per call [KSPField(isPersistant = false)] public float ChargeRate; // Amount of Ec per storedCharge [KSPField(isPersistant = false)] public float ChargeRatio; // Only charge if total EC is higher than this, eg 0.95 [KSPField(isPersistant = false)] public float HighEClevel; // Only discharge if total EC is lowe than this, eg 0.9 [KSPField(isPersistant = false)] public float LowEClevel; // chargin/discharge efficiency [KSPField(isPersistant = false)] public float ChargeEfficiency; // Bettery Status string [KSPField(isPersistant = false, guiActive = true, guiName = "Status")] public string ChargingStatus; public override void OnStart(StartState state) { //Debug.Log("Bettery: OnStart"); ChargingStatus = "Initializing"; part.force_activate(); } public override void OnUpdate() { //Debug.Log("Bettery: OnUpdate"); //ChargingStatus = "OnUpdate"; } public override string GetInfo() { //Debug.Log("Bettery: GetInfo"); return String.Format("Maximum Charge Rate: {0:F2}SC/s", ChargeRate) + "\n" + String.Format("Efficiency: {0:F2}%", ChargeEfficiency * 100); } public override void OnFixedUpdate() { //Debug.Log("Bettery: OnFixedUpdate"); double EC_amount, EC_maxAmount, EC_delta, EC_delta_avail, EC_delta_missing; double SC_amount, SC_maxAmount, SC_SOC, SC_delta; //ChargingStatus = "OnFixedUpdate"; int EC_id = PartResourceLibrary.Instance.GetDefinition("ElectricCharge").id; int SC_id = PartResourceLibrary.Instance.GetDefinition("StoredCharge").id; this.part.GetConnectedResourceTotals(EC_id, out EC_amount, out EC_maxAmount); if (EC_maxAmount > 0) { EC_delta_avail = EC_amount - EC_maxAmount * HighEClevel; //amount of available EC for charging: 980 - 1000 * 0.95 = 30EC to spare EC_delta_missing = EC_maxAmount * LowEClevel - EC_amount; //amount of missing EC for discharging: 1000 * 0.9 - 500 = 400EC missing } else { EC_delta_avail = 0; EC_delta_missing = 0; } this.part.GetConnectedResourceTotals(SC_id, out SC_amount, out SC_maxAmount); if (SC_maxAmount > 0) SC_SOC = SC_amount / SC_maxAmount; else SC_SOC = 0; if (EC_delta_avail > 0 && SC_SOC < 1) // Charge internal Bettery { EC_delta = this.part.RequestResource(EC_id, Math.Min(TimeWarp.fixedDeltaTime * ChargeRate * ChargeRatio, EC_delta_avail)); // EC_delta = 0.1s * 1SC/s * 10EC/SC = 1EC SC_delta = this.part.RequestResource(SC_id, -EC_delta / ChargeRatio * ChargeEfficiency); // SC_delta = -1EC / 10EC/SC * 0.9 = -0.09SC ChargingStatus = String.Format("Charging"); } else if (EC_delta_missing > 0 && SC_SOC > 0) // Discharge internal Bettery { SC_delta = this.part.RequestResource(SC_id, Math.Min(TimeWarp.fixedDeltaTime * ChargeRate, EC_delta_missing / ChargeRatio)); // SC_delta = 0.1s * 1SC/s = 0.1SC EC_delta = this.part.RequestResource(EC_id, -SC_delta * ChargeRatio); // EC_delta = -0.1SC * 10EC/SC = 1EC ChargingStatus = String.Format("Discharging"); } else { ChargingStatus = String.Format("idle"); } } } } RESOURCE_DEFINITION { name = StoredCharge abbreviation = SC density = 0 unitCost = 0 hsp = 0 flowMode = NO_FLOW transfer = NONE isTweakable = true volume = 1 } PART { name = bettery1k module = Part author = Flo mesh = model.mu //MODEL //{ // model = Squad/Parts/Resources/FuelCell/FuelCell //} rescaleFactor = 1 node_attach = 0, 0, 0, 1, 0, 0, 0 TechRequired = largeElectrics entryCost = 2250 cost = 750 category = Electrical subcategory = 0 title = Bettery 1k manufacturer = Elektro Me description = A better battery. Also handy for re-heating snacks. attachRules = 1,0,1,1,0 node_stack_top = 0.0, 0.1108553, 0.0, 0.0, 1.0, 0.0 node_stack_bottom = 0.0, -0.1108553, 0.0, 0.0, -1.0, 0.0 // --- standard part parameters --- mass = 0.05 dragModelType = default maximum_drag = 0.2 minimum_drag = 0.2 angularDrag = 2 crashTolerance = 7 maxTemp = 2000 // = 3000 bulkheadProfiles = srf tags = array bank charge convert e/c elect energ pack power volt watt MODULE { name = Bettery ChargeRate = 0.1 ChargeRatio = 10 ChargeEfficiency = 1 HighEClevel = 0.95 LowEClevel = 0.9 } RESOURCE { name = StoredCharge amount = 1000 maxAmount = 1000 } RESOURCE { name = ElectricCharge amount = 10 maxAmount = 10 } } 25% of the credits go to @Nertea, i stole used some code from his capacitors...
-
I wont go too far with that, just watch the current EC and charge the bettery if >95% and discharge if <90%. This way you implicitly check existing generators. If I just knew how to write plugins...
-
I am not going down that road again and get me some sour cookies. And I won't discuss electrotechnical basics. Whoever thinks he knows capacitors AND thinks, batteries in KSP are not similar to capacitors at all: http://machinedesign.com/batteriespower-supplies/what-s-difference-between-batteries-and-capacitors and some of https://www.quora.com/What-is-the-difference-between-a-capacitor-and-a-battery and maybe even some of http://physics.stackexchange.com/questions/32391/what-is-the-difference-between-a-battery-and-a-charged-capacitor @Jimbodiahany luck last night?
-
It was battery vs capacitor vs real world. not worth the hassle... To the Topic: With 1.2 the ion engine got a new feature, which stops the engines fuel consumption, if no/very little EC is left. Can I somehow use this mechanic for my part? Edit found it: minResToLeave, found in ionEngine.cfg, under MODULE --> PROPELLANT: only time mentioned in the internet: so, @NathanKell: could INPUT_RESOURCE also profit of that mechanic? After some thinking, maybe i need to throw in an engine, without thrust etc, and have it run on EC, with BetterEC as byproduct?
-
Alright, updatet code. And a name: Bettery What works: manual conversion from EC to BetterEC (BEC) and back. And it only fills EC up until 95% due to FillAmount Whats missing: automatism - Only charge bettery if total EC > 95%, Only discharge bettery if total EC < 90% RESOURCE_DEFINITION { name = BetterEC abbreviation = BEC density = 0 unitCost = 0 hsp = 0 flowMode = STAGE_PRIORITY_FLOW transfer = PUMP isTweakable = true volume = 1 } PART { name = bettery module = Part author = Flo mesh = model.mu //MODEL //{ // model = Squad/Parts/Resources/FuelCell/FuelCell //} rescaleFactor = 1 node_attach = 0, 0, 0, 1, 0, 0, 0 TechRequired = largeElectrics entryCost = 2250 cost = 750 category = Electrical subcategory = 0 title = Bettery 1k manufacturer = Elektro Me description = A better battery. Also handy for re-heating snacks. attachRules = 1,0,1,1,0 node_stack_top = 0.0, 0.1108553, 0.0, 0.0, 1.0, 0.0 node_stack_bottom = 0.0, -0.1108553, 0.0, 0.0, -1.0, 0.0 // --- standard part parameters --- mass = 0.05 dragModelType = default maximum_drag = 0.2 minimum_drag = 0.2 angularDrag = 2 crashTolerance = 7 maxTemp = 2000 // = 3000 bulkheadProfiles = srf tags = array bank charge convert e/c elect energ pack power volt watt MODULE { name = ModuleResourceConverter ConverterName = Bettery BEC 2 EC StartActionName = Start BEC 2 EC StopActionName = Stop BEC 2 EC ToggleActionName = Toggle BEC 2 EC FillAmount = 0.95 AutoShutdown = false GeneratesHeat = false UseSpecialistBonus = false INPUT_RESOURCE { ResourceName = BetterEC Ratio = 1 FlowMode = NO_FLOW } OUTPUT_RESOURCE { ResourceName = ElectricCharge Ratio = 10 DumpExcess = false } } MODULE { name = ModuleResourceConverter ConverterName = Bettery EC 2 BEC StartActionName = Start EC 2 BEC StopActionName = Stop EC 2 BEC ToggleActionName = Toggle EC 2 BEC FillAmount = 0.95 AutoShutdown = false GeneratesHeat = false UseSpecialistBonus = false INPUT_RESOURCE { ResourceName = ElectricCharge Ratio = 10 } OUTPUT_RESOURCE { ResourceName = BetterEC Ratio = 1 DumpExcess = false } } RESOURCE { name = BetterEC amount = 1000 maxAmount = 1000 } }
-
[snip] Meanwhile, i am trying this: PART { name = bettery module = Part author = Flo mesh = model.mu //MODEL //{ // model = Squad/Parts/Resources/FuelCell/FuelCell //} rescaleFactor = 1 node_attach = 0, 0, 0, 1, 0, 0, 0 TechRequired = largeElectrics entryCost = 2250 cost = 750 category = Electrical subcategory = 0 title = Bettery 1k manufacturer = Elektro Me description = A better battery. Also handy for re-heating snacks. attachRules = 0,1,0,0,0 // --- standard part parameters --- mass = 0.05 dragModelType = default maximum_drag = 0.2 minimum_drag = 0.2 angularDrag = 2 crashTolerance = 7 maxTemp = 2000 // = 3000 bulkheadProfiles = srf tags = array bank charge convert e/c elect energ pack power volt watt MODULE { name = ModuleResourceConverter ConverterName = Bettery BEC 2 EC StartActionName = Start BEC 2 EC StopActionName = Stop BEC 2 EC ToggleActionName = Toggle BEC 2 EC FillAmount = 0.95 AutoShutdown = false GeneratesHeat = false UseSpecialistBonus = false INPUT_RESOURCE { ResourceName = BetterEC Ratio = 1 FlowMode = NO_FLOW } OUTPUT_RESOURCE { ResourceName = ElectricCharge Ratio = 10 DumpExcess = false } } MODULE { name = ModuleResourceConverter ConverterName = Bettery EC 2 BEC StartActionName = Start EC 2 BEC StopActionName = Stop EC 2 BEC ToggleActionName = Toggle EC 2 BEC FillAmount = 0.95 AutoShutdown = false GeneratesHeat = false UseSpecialistBonus = false INPUT_RESOURCE { ResourceName = ElectricCharge Ratio = 10 } OUTPUT_RESOURCE { ResourceName = BetterEC Ratio = 1 DumpExcess = false } } RESOURCE { name = BetterEC amount = 1000 maxAmount = 1000 } }
-
I just learned, that the stock fuel cells may be a good starting point. They already convert one fueltype (LFO) to EC. Swap LFO with something proprietary and enable "cahrging" of that proprietary fuel by consuming ec.
-
I used @Nertea's mod in the past, and if you are reffering to the parts called "capacitors", thats not exactly what i am about. But it can of course be used as a starter for another mod, to learn stuff etc. What i don't like with NFT-capacitors: proprietary unit and manual re/charge. And of course the naming is imho totally wrong.