Jump to content

aquilux

Members
  • Posts

    199
  • Joined

  • Last visited

Reputation

19 Good

Profile Information

  • About me
    Spacecraft Engineer

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I'm not sure about real fuels, so you'll have to try it out both your suggested way, and by listing each fuel, but you'll have to make a whole copy of each fuel. The reason why I had to separate oxidiser and monoprop is that apparently " | " does not work in the filter section. If this changes, or I'm wrong, I'll be combining the two so that there is only one math section and what not.
  2. If the useEngineResponseTime components carry over to any new engines generated by MM copies of .cfg files, then yes you can, otherwise you could probably just change the resources it looks for (unless the engine code gets stupid complicated with the ability to select various fuels). But I just realised that I think I got the math backwards, and I'm in the process of reworking it, so give me a little while.
  3. Engine spool delay for all. Ok, so here is the completed patch. I'd like to thank @Aelfhe1m for all their help, I couldn't have figured this thing without them. This patch adds engine spool delays to all engines that pump some form of fluid for a chemical reaction (stock resources only). The delays are based off of engine mass, with the ratios being loosely based on the KW rocketry engines. //Add engine response time to engines that pump fluids but have no engine spooling. //Author: Aelfhe1m & Aquilux //////////////////////////////////////////////////////////////////// //This script adds engine spooling delay to engines that pump at least one liquid for a chemical reaction. //Engine spooling delay is dependent on the momentum of the turbines in the engine. //This script assumes that turbine mass is an average fraction of engine mass, thus delay is derived from engine mass. // //equations for accel/decel/mass relationships loosely derived from KW rocketry values: // //engineAccelerationSpeed = -1.16878m + 0.0875252m^2 + -0.00253789m^3 + 0.0000260111m^4 + 5.74868 // //engineDecelerationSpeed = 1.14632m + 0.0856818m^2 + -0.00246803m^3 + 0.0000251029m^4 + 5.82994 // //values and derived trend lines can be found here: https://goo.gl/733mKw (published google sheets chart) ////////////////////////////////////////////////////////////////// //Spooling for engines with oxidiser (to account for hybrid and other exotic chemical engines using oxidiser) @PART[*]:HAS[@MODULE[ModuleEngines*]:HAS[@PROPELLANT[Oxidizer],~useEngineResponseTime[True]]] //find parts containing ModuleEngines* that uses Oxidiser, but does not have useEngineResponseTime { @MODULE[ModuleEngines*] { useEngineResponseTime = True //create useEngineResponseTime //////////////////////////////////////////////////begin polynomial math for engineAccelerationSpeed MATHa = #$/mass$ //start first component temp variable @MATHa *= -1.16878 //complete first component // MATHb = #$/mass$ //start second component temp variable @MATHb != 2 //incorporate exponent @MATHb *= 0.0875252 //complete second component // MATHc = #$/mass$ //start third component temp variable @MATHc != 3 //incorporate exponent @MATHc *= -0.00253789 //complete third component // MATHd = #$/mass$ //start fourth component @MATHd != 4 //incorporate exponent @MATHd *= 0.0000260111 //complete fourth component // engineAccelerationSpeed = #$MATHa$ //combine first component @engineAccelerationSpeed += #$MATHb$ //combine second component @engineAccelerationSpeed += #$MATHc$ //combine third component @engineAccelerationSpeed += #$MATHd$ //combine fourth component @engineAccelerationSpeed += 5.74868 //combine fifth component //keep variables initialised //////////////////////////////////////////////////begin polynomial math for engineDecelerationSpeed @MATHa = #$/mass$ //start first component temp variable @MATHa *= 1.14632 //complete first component // @MATHb = #$/mass$ //start second component temp variable @MATHb != 2 //incorporate exponent @MATHb *= 0.0856818 //complete second component // @MATHc = #$/mass$ //start third component temp variable @MATHc != 3 //incorporate exponent @MATHc *= -0.00246803 //complete third component // @MATHd = #$/mass$ //start fourth component @MATHd != 4 //incorporate exponent @MATHd *= 0.0000251029 //complete fourth component // engineDecelerationSpeed = #$MATHa$ //combine first component @engineDecelerationSpeed += #$MATHb$ //combine second component @engineDecelerationSpeed += #$MATHc$ //combine third component @engineDecelerationSpeed += #$MATHd$ //combine fourth component @engineDecelerationSpeed += 5.82994 //combine fifth component // !MATHa = clear //clear temp variable !MATHb = clear //clear temp variable !MATHc = clear //clear temp variable !MATHd = clear //clear temp variable //////////////////////////////////////////////////end polynomial math } } //Spooling for engines with MonoPropellant @PART[*]:HAS[@MODULE[ModuleEngines*]:HAS[@PROPELLANT[MonoPropellant],~useEngineResponseTime[True]]] //find parts containing ModuleEngines* that uses MonoPropellant, but does not have useEngineResponseTime { @MODULE[ModuleEngines*] { useEngineResponseTime = True //create useEngineResponseTime //////////////////////////////////////////////////begin polynomial math for engineAccelerationSpeed MATHa = #$/mass$ //start first component temp variable @MATHa *= -1.16878 //complete first component // MATHb = #$/mass$ //start second component temp variable @MATHb != 2 //incorporate exponent @MATHb *= 0.0875252 //complete second component // MATHc = #$/mass$ //start third component temp variable @MATHc != 3 //incorporate exponent @MATHc *= -0.00253789 //complete third component // MATHd = #$/mass$ //start fourth component @MATHd != 4 //incorporate exponent @MATHd *= 0.0000260111 //complete fourth component // engineAccelerationSpeed = #$MATHa$ //combine first component @engineAccelerationSpeed += #$MATHb$ //combine second component @engineAccelerationSpeed += #$MATHc$ //combine third component @engineAccelerationSpeed += #$MATHd$ //combine fourth component @engineAccelerationSpeed += 5.74868 //combine fifth component //keep variables initialised //////////////////////////////////////////////////begin polynomial math for engineDecelerationSpeed @MATHa = #$/mass$ //start first component temp variable @MATHa *= 1.14632 //complete first component // @MATHb = #$/mass$ //start second component temp variable @MATHb != 2 //incorporate exponent @MATHb *= 0.0856818 //complete second component // @MATHc = #$/mass$ //start third component temp variable @MATHc != 3 //incorporate exponent @MATHc *= -0.00246803 //complete third component // @MATHd = #$/mass$ //start fourth component @MATHd != 4 //incorporate exponent @MATHd *= 0.0000251029 //complete fourth component // engineDecelerationSpeed = #$MATHa$ //combine first component @engineDecelerationSpeed += #$MATHb$ //combine second component @engineDecelerationSpeed += #$MATHc$ //combine third component @engineDecelerationSpeed += #$MATHd$ //combine fourth component @engineDecelerationSpeed += 5.82994 //combine fifth component // !MATHa = clear //clear temp variable !MATHb = clear //clear temp variable !MATHc = clear //clear temp variable !MATHd = clear //clear temp variable //////////////////////////////////////////////////end polynomial math } }
  4. Good eye. I'm not sure how I missed that. Same with the @ on the second section, that was leftover from when I made and deleted the variables twice.
  5. Something in the math keeps throwing exceptions, but I'm not seeing it. I'll keep looking, but for now, this is what I have. //Add engine response time to engines that pump fluids but have no engine spooling. //Author: Aelfhe1m & Aquilux //////////////////////////////////////////////////////////////////// //This script adds engine spooling delay to engines that pump at least one liquid for a chemical reaction. //Engine spooling delay is dependent on the momentum of the turbines in the engine. //This script assumes that turbine mass is an average fraction of engine mass, thus delay is derived from engine mass. // //equations for accel/decel/mass relationships loosely derived from KW rocketry values: // //engineAccelerationSpeed = -0.00488414m + 0.00482174m^2 + -0.000113284m^3 + 0.0000007285m^4 + 0.0898108 // //engineDecelerationSpeed = 0.00557365m + 0.00486915m^2 + -0.000118177m^3 + 0.0000007683m^4 + 0.123049 // //values and derived trend lines can be found here: https://goo.gl/733mKw (published google sheets chart) ////////////////////////////////////////////////////////////////// //Spooling for engines with oxidiser (to account for hybrid and other exotic chemical engines using oxidiser) @PART[*]:HAS[@MODULE[ModuleEngines*]:HAS[@PROPELLANT[Oxidizer],~useEngineResponseTime[True]]] //find parts containing ModuleEnginesFX that uses Oxidiser, but does not have useEngineResponseTime { @MODULE[ModuleEngines*] { useEngineResponseTime = True //create useEngineResponseTime //////////////////////////////////////////////////begin polynomial math for engineAccelerationSpeed MATHa = #$/mass$ //start first component temp variable @MATHa *= -0.00488414 //complete first component // MATHb = #$/mass$ //start second component temp variable @MATHb != 2 //incorporate exponent @MATHb *= 0.00482174 //complete second component // MATHc = #$/mass$ //start third component temp variable @MATHc != 3 //incorporate exponent @MATHc *= -0.000113284 //complete third component // MATHd = #$mass$ //start fourth component @MATHd != 4 //incorporate exponent @MATHd *= 0.0000007285 //complete fourth component // engineAccelerationSpeed = #$MATHa$ //combine first component @engineAccelerationSpeed += #$MATHb$ //combine second component @engineAccelerationSpeed += #$MATHc$ //combine third component @engineAccelerationSpeed += #$MATHd$ //combine fourth component @engineAccelerationSpeed += 0.0898108 //combine fifth component //keep variables initialised //////////////////////////////////////////////////begin polynomial math for engineDecelerationSpeed MATHa = #$/mass$ //start first component temp variable @MATHa *= 0.00557365 //complete first component // MATHb = #$/mass$ //start second component temp variable @MATHb != 2 //incorporate exponent @MATHb *= 0.00486915 //complete second component // MATHc = #$/mass$ //start third component temp variable @MATHc != 3 //incorporate exponent @MATHc *= -0.000118177 //complete third component // MATHd = #$mass$ //start fourth component @MATHd != 4 //incorporate exponent @MATHd *= 0.0000007683 //complete fourth component // engineDecelerationSpeed = #$MATHa$ //combine first component @engineDecelerationSpeed += #$MATHb$ //combine second component @engineDecelerationSpeed += #$MATHc$ //combine third component @engineDecelerationSpeed += #$MATHd$ //combine fourth component @engineDecelerationSpeed += 0.123049 //combine fifth component // !MATHa = clear //clear temp variable !MATHb = clear //clear temp variable !MATHc = clear //clear temp variable !MATHd = clear //clear temp variable //////////////////////////////////////////////////end polynomial math } } //todo: repeat patch for monoprop engines. If I comment out all the MATHd sections, the errors go away. I had thought that maybe it was an issue of too many characters for a number, but rounding up did not help.
  6. That's weird. I could have sworn I copy/pasted from a squad .cfg. That might be it. I was starting to guess that. I feel kind of dumb for not trying it. Thank you so much for the help @Aelfhe1m. Also, considering how atrocious the <code> tool is for tabbing and alignment, I'm not even going to try. I'll just copy/paste directly from notepad++ and dump it into the widget. Hopefully it comes out right on the other side when others copy/paste from the page. In case you or someone else uses notepad++ as well, there's a forum post that has a user defined language syntax that you can download and import to properly highlight MM patches.
  7. This is what I'm working with. //Add engine response time to engines that pump fluids but have no engine spooling. //Author: Aelfhe1m & Aquilux //////////////////////////////////////////////////////////////////// //This script adds engine spooling delay to engines that pump at least one liquid for a chemical reaction. //Engine spooling delay is dependent on the momentum of the turbines in the engine. //This script assumes that turbine mass is an average fraction of engine mass, thus delay is derived from engine mass. // //equations for accel/decel/mass relationships derived from KW rocketry values: // //engineAccelerationSpeed = -0.153838M + 0.00495282M^2 + 1.95125 // //engineDecelerationSpeed = -0.165447M + 0.0053904M^2 + 2.1989 // //values and derived trend lines can be found here: //https://goo.gl/733mKw (published google sheets chart) ////////////////////////////////////////////////////////////////// //Spooling for engines with oxidiser (to account for hybrid and //other exotic chemical engines using oxidiser) //This does not apply the test values to the stock parts in my game. //I could send you my Config Cach, but it might take a while to go through. @PART[*]:HAS[@MODULE[ModuleEngines*]:HAS[@PROPELLANT[Oxidiser],~useEngineResponseTime[True]]] //find parts containing ModuleEnginesFX that use //Oxidiser, but does not have useEngineResponseTime { @MODULE[ModuleEngines*] { //math functions not operative yet, just spits out errors, //////////////////////////////////////begin polynomial math for engineAccelerationSpeed // MATHa = #$/mass$ //start first component temp variable // @MATHa *= -0.153838 //complete first component // // // MATHb = #$/mass$ //start second component temp variable // @MATHb != 2 //incorporate exponent // @MATHb *= 0.00495282 //complete second component // // // MATHc = 1.95125 //set third component temp variable // // // //Do these all need to be "#$/MATH*$" ? // // // engineAccelerationSpeed = MATHa //combine first component // @engineAccelerationSpeed += MATHb //combine second component // @engineAccelerationSpeed += MATHc //combine third component // // // //temp variables not cleared to reduce operations // // // //////////////////////////////////////begin polynomial math for engineDecelerationSpeed // @MATHa = #$/mass$ //alter previously set first component temp variable // @MATHa *= -0.165447 //complete first component // // // @MATHb = #$/mass$ //alter previously set second component temp variable // @MATHb != 2 //incorporate exponent // @MATHb *= 0.0053904 //complete second component // // // @MATHc = 2.1989 //alter previously set third component temp variable // // // engineDecelerationSpeed = MATHa //combine first component // @engineDecelerationSpeed += MATHb //combine second component // @engineDecelerationSpeed += MATHc //combine third component // // // !MATHa = clear //clear temp variable // !MATHb = clear //clear temp variable // !MATHc = clear //clear temp variable // //////////////////////////////////////end polynomial math engineAccelerationSpeed = 6 //absurd test value engineDecelerationSpeed = 6 //more absurdity (for SCIENCE!) useEngineResponseTime = True //create useEngineResponseTime } } //todo: repeat patch for monoprop engines.
  8. @PART[*]:HAS[@MODULE[ModuleEngines*]:HAS[!PROPELLANT[SolidFuel],~useEngineResponseTime[True]]] @PART[*]:HAS[@MODULE[ModuleEngines*]:HAS[@PROPELLANT[Oxidizer],~useEngineResponseTime[True]]] So I'm getting stumped. what is the difference between these, and why would the one asking for oxidiser fail but not the one rejecting solid fuel?
  9. So, I've managed to chart the engineAccelerationSpeed, engineDecelerationSpeed, and Mass values for the KW rocketry engines as examples and derive trendlines. Problem is the equations are polynomial. Now, I'm total crap at algebra and the MM algebra functions appear to be done one step at a time, but this'd be easily solved if I could use multiple variables. and toss them when done. Is this doable within MM config files, or will I have to somehow consolidate the mass variables together? These are the equations: engineAccelerationSpeed = -0.153838m + 0.00495282m2 + 1.95125 engineDecelerationSpeed =-0.165447m + 0.0053904m2 + 2.1989 I want to do something along the line of: engineAccelerationSpeed = #$/mass$ //start first componenet engineAccelerationSpeed *= -0.153838 //complete first component A = #$/mass$ //start second component A != 2 //continue second component A *= 0.00495282 //complete second component engineAccelerationSpeed += A //combine components one and two engineAccelerationSpeed += 1.95125 //combine final component //for final product Is this possible in MM code, or is there some better way to do it?
  10. So I 'll have to make separate MM configs for each resource I guess. I have a few hybrid rocket engines that still need to spool up the delivery of oxidiser, but use solid fuel. Yeah, just found that. Feel kind of dumb for it, but hey, that's how you learn right? Hmmm. Going to have to wrap my head around that math then, I got my assumptions backwards. That clarifies things. I guess I missed that in the documentation. I'll post my results when I figure out the math, as that's likely going to be the last thing I'll figure out.
  11. Sorry, I missed that bit. I've been trying this out: //Add engine response time to all instant response engines based on part mass. //Author: Aelfhe1m, Aquilux //@PART[*]:HAS[@MODULE[ModuleEngines*]]:HAS[PROPELLANT[Oxidizer]|PROPELLANT[MonoPropellant],~useEngineResponseTime[True]] //Aq version @PART[*]:HAS[@MODULE[ModuleEngines*]]:HAS[!PROPELLANT[SolidFuel],~useEngineResponseTime[True]] //Ae version //find parts containing ModuleEnginesFX that uses Oxidiser, but does not have useEngineResponseTime { @MODULE[ModuleEngines*] { engineAccelerationSpeed = #$/mass$ //edit engineAccelerationSpeed, initially set it equal to mass$ @engineAccelerationSpeed *= 4.3333 // modify by multiplying value using KW values for ratio engineDecelerationSpeed = #$/mass$ //same for decel @engineDecelerationSpeed *= 4.4333 // modify by KW ratio // other operators are += for add -= for subtract and |= for raise to the power of (e.g. square) useEngineResponseTime = True //create useEngineResponseTime } } Both my search string and your search string (starting up with one commented out, then restarting with the other commented out and clearing MM's cache between loads) just catches all engines. Solid fuel, Xenon, whatever. Also, I'm getting weird behavior with the "engine??celerationSpeed" values. The "Skipper" LF engine, being the heaviest on my test craft, throttles up and down the fastest, while the "Puff" Monoprop engine, the lightest of them all, is the slowest to respond. Looking at the documentation, ModuleEnginesFX appears not to support those variables, though they obviously have some sort of affect. Test Edit: BTW, your code often contained an extra closing bracket. I tried running it as is once, but it threw a fault. Was this an extra bracket, or were you missing an open bracket? Edit edit: I think I see it in the documentation. I'll try the assumption that it was needed for the nesting, and come back with the results.
  12. But once we find the .cfg we want to edit with the search section, aren't we then telling it which module to modify? What happens if it finds a part without the *FX module, then tries to modify the nonexistant module?
  13. The ModuleEnginesFX issue occured to me as well, but if we also test for ModuleEngines wouldn't we need to detect which one is being used, and change our package accordingly? I was just going to perfect the FX version, then copy it for the sans-FX version. Edit: I'm testing the code now with an absurd delay, I'll see if this patch is catching the solids, though I do have hybrid engines (Solid Fuel+Oxidiser), and figured they'd need spool up times as well.
  14. So, I seem to have it working, though it appears as though it's adding response time to solid fuel engines despite the addition of the requirement for oxidiser as a propellant. I'm trying to figure out what I did wrong, and if I can get it to check for oxidiser OR monopropellant. I know OR involves the | symbol, I just don't know how to incorporate it into the search. Here is what I have (ps: notepad++ is boss for catching nesting errors before you get syntax exceptions). //Add engine response time to all instant response engines based on part mass. //Author: Aelfhe1m, Aquilux @PART[*]:HAS[@MODULE[ModuleEnginesFX]]:HAS[PROPELLANT[Oxidizer]]:HAS[~useEngineResponseTime[True]] //find parts containing ModuleEnginesFX that uses Oxidiser, but does not have useEngineResponseTime { @MODULE[ModuleEnginesFX] { engineAccelerationSpeed = #$/mass$ //edit or create engineAccelerationSpeed, initially set it equal to mass$ @engineAccelerationSpeed *= 1.3333 // modify by multiplying value using KW values for ratio engineDecelerationSpeed = #$/mass$ @engineDecelerationSpeed *= 1.4333 // modify by KW ratio // other operators are += for add -= for subtract and |= for raise to the power of (e.g. square) useEngineResponseTime = True //edit or create useEngineResponseTime, may exist set to false, set true } }
×
×
  • Create New...