Jump to content

tlion

New Members
  • Posts

    3
  • Joined

  • Last visited

Reputation

8 Neutral
  1. I just finished the first version of "Kerbal Guidance System", a kOS script capable of launching a rocket to a precise orbit while maximizing payload. The algorithm is based on optimal control theory using a Newton-Raphson algorithm to solve a set of guidance equations and determine the optimal trajectory. I am aware that other scripts exist, including PEGAS from which I gained a lot of inspiration, my original goal was to get a better understanding of the math behind guidance algorithms. I set out to learn more about PEG, but ultimately decided to use a different type algorithm. Both are based on similar fundamentals, but hopefully this adds something new and can maybe help others learn a little bit more as well. This technique is relatively computationally expensive when compared to the slow processor speeds of kOS. In the future I may translate the code to python to use with krpc. KGS can launch a rocket to a specified orbit while minimizing fuel consumption. KGS offers the specification of three types of orbits: Unconstrainted orbital plane Constrained inclination Constrained inclination and longitude of the ascending node Some of the capabilities of KGS include: calculation of launch time calculate of launch azimuth predefined atmospheric ascent phase coast phases precise orbit targeting I put together a few examples, two for the stock KSP system and one for RSS. The scripts, a guide, and theoretical background documents can all be found on my GitHub page https://github.com/TomTheLion/Kerbal-Guidance-System. It can be somewhat challenging to set up and successfully fly a rocket using this script, but hopefully the guide provides enough detail. I would be more than happy to offer help or clarify anything if anyone decides to try this script. For the stock rockets the only required mod is kOS, for the RSS rocket I used a custom module manager patch to rebalance the engines for a larger solar system (included on my Github page) and the following mods installed from CKAN: Real Solar System Kerbal Joint Reinforcement Continued Restock Restock+ Waterfall Core Simple Adjustable Fairings - KW Rocketry Pack Simple Adjustable Fairings - Plugin
  2. I am trying to write a simple patch that adjusts engine thrusts based on a formula taking into account their mass, vac isp, and atm isp. I started off with something simple, just trying to replace the thrust with the vacuum ISP then multiply it by a number, but I can't get it to work. Ultimately I would to have [thrust] =[constant] x [isp atm] + [constant] x [isp vac] + [constant ] * mass] or something like this. Below is what I have so far but it does not really seem to do anything. Any help would be super appreciated! @PART[*]:HAS[@MODULE[ModuleEngines*]]:FINAL { @MODULE[ModuleEngines*] { @maxThrust = #$/atmosphereCurve/key,0[1,]$ @maxThrust *= 2 } } Edit: I was able to solve my own problem. I fit a trend line to a list of real rockets and found a thrust (N) ~ (-3 * ISP (seconds) + 1850) * mass (kg). I had to scale it down to be balance for KSP so I added a final multiplier to balance. @PART[*]:HAS[@MODULE[ModuleEngines*]]:FINAL { @MODULE[ModuleEngines*] { @maxThrust = #$/MODULE[ModuleEngines*]/atmosphereCurve/key,0[1, ]$ @maxThrust *= -3 @maxThrust += 1850 @maxThrust *= #$../mass$ @maxThrust *= 0.24 } }
×
×
  • Create New...