Jump to content

[1.12.x] ConstantTWR


Recommended Posts

If you are doing launches and getting frustrated by having to constantly modify the engine thrust to maintain the desired TWR, then this mod is for you.

If you have G force limits set in a hard mode, so that your Kerbals will die if they get too many G's, or if the vessel will break if there are too many G's, then this mod is for you.

The idea is simple:  Specify a TWR ratio to maintain during a launch.  The implementation is a bit more difficult.

This mod is under active development, feedback and ideas are welcome.

New Dependencies

Currently, the mod has the ability vary the thrust of the vessel based on one of 4 different measurements:

  • Altitude
  • Speed
  • Mach
  • G-Limit

For each of these, the following can be specified:

  • A range of values of the measurement where the desired TWR can be set
  • A range of values for the TWR

Keep in mind that the TWR values you can set have nothing to do with the vessel;  the TWR range is merely a target for the throttle to be set to;  if the target TWR is greater than what the vessel can provide, the target throttle will be 100%.

The way it work is that when the measured value is at the lowest point of the range, then the lowest point of the TWR range is used as the target TWR.  As the measurement increases, the target TWR will increase, assuming there is a range of TWR values.   You can also set the TWR range so that the minimum is equal to the maximum, which would effectively have a constant TWR during the ascent.

You can specify multiple ranges, so that when the first range is finished, the next one will be used.  This will continue until all ranges have been used.

TWR profiles can be saved, but they are not specific to a vessel.  This allows you to define and name a TWR profile and save it, and then load it as necessary.

The windows are available both in the editor (VAB/SPH) and on the launch pad.  

When  you are ready with your profile, click the "Activate" button and then launch the vessel.

Now for what you are all waiting for:

Download Information

Spacedock: https://spacedock.info/mod/1429/ConstantTWR

Source code: https://github.com/linuxgurugamer/ConstantTWR

License: GPLv3

 

 

Edited by linuxgurugamer
Link to comment
Share on other sites

Can you add a PID loop? So that TWR can be set using turbojet engines? (thinking of hovering using a VTOL with draining fuel).

EDIT: yeah not the point of this mod. But of this one:

 

Edited by ioresult
Link to comment
Share on other sites

4 hours ago, ioresult said:

Can you add a PID loop? So that TWR can be set using turbojet engines? (thinking of hovering using a VTOL with draining fuel).

EDIT: yeah not the point of this mod. But of this one:

 

As you said, not the point of this mod.

Sorry.

 

Link to comment
Share on other sites

Looks cool: I get bored of having to constantly watch TWR and press Ctrl at intervals; a relatively smart monkey could do this job. Now, this mod goes even farther with its conditions and presets. Gonna give it a try (that is, as soon as I can continue playing).

Link to comment
Share on other sites

I like manually adjusting throttle on ascent, especially since we have prograde SAS lock now, I can focus on maintaining inclination and time to apoapse. My throttling can vary wildly during a launch.

Link to comment
Share on other sites

Well, it seems to work well.
My style of rockets is more "Light them up, pedal to the metal!!" then have a feather touch in orbit.

Cool mod tho'! If I need to do some real finesse flying, then it's getting used.

Link to comment
Share on other sites

On 7/3/2017 at 6:44 AM, ioresult said:

Can you add a PID loop? So that TWR can be set using turbojet engines? (thinking of hovering using a VTOL with draining fuel).

EDIT: yeah not the point of this mod. But of this one:

 

Also check out Throttle Controlled Avionics if you're keen to build hovering things. It's quite a suite of controls.

Link to comment
Share on other sites

  • 3 months later...

New release, 0.0.2:

  • Updated for KSP 1.3.1
On 7/8/2017 at 2:13 PM, Alewx said:

Could you add some fields to enter the values by keyboard, the sliders are not exaclty accurate.

I'll add this as an enhancement request. May be a little bit, I'm busy with updates right now

Next time, ping me so I see the message

Edited by linuxgurugamer
Link to comment
Share on other sites

  • 5 months later...

@linuxgurugamer

DirectoryNotFoundException: Directory 'D:\Kerbal Space Program\GameData\ConstantTWR\PluginData' not found.
  at System.IO.Directory.GetFileSystemEntries (System.String path, System.String searchPattern, FileAttributes mask, FileAttributes attrs) [0x00000] in <filename unknown>:0 
  at System.IO.Directory.GetFiles (System.String path, System.String searchPattern) [0x00000] in <filename unknown>:0 
  at System.IO.DirectoryInfo.GetFiles (System.String searchPattern) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:GetFiles (string)
  at ConstantTWR.ConstantTWR.GetFileList () [0x00000] in <filename unknown>:0 
  at ConstantTWR.ConstantTWR.FileSelWindow (Int32 id) [0x00000] in <filename unknown>:0 
  at UnityEngine.GUILayout+LayoutedWindow.DoWindow (Int32 windowID) [0x00000] in <filename unknown>:0 
  at UnityEngine.GUI.CallWindowDelegate (UnityEngine.WindowFunction func, Int32 id, Int32 instanceID, UnityEngine.GUISkin _skin, Int32 forceRect, Single width, Single height, UnityEngine.GUIStyle style) [0x00000] in <filename unknown>:0 
 
(Filename:  Line: -1)
  1. the folder was not existing, so the mod bugged out, after I manually added the folder the UI was back alive
  2. the folder should perhaps be \ConstantTWR\Plugins\PluginData
Link to comment
Share on other sites

21 minutes ago, Gordon Dry said:

@linuxgurugamer


DirectoryNotFoundException: Directory 'D:\Kerbal Space Program\GameData\ConstantTWR\PluginData' not found.
  at System.IO.Directory.GetFileSystemEntries (System.String path, System.String searchPattern, FileAttributes mask, FileAttributes attrs) [0x00000] in <filename unknown>:0 
  at System.IO.Directory.GetFiles (System.String path, System.String searchPattern) [0x00000] in <filename unknown>:0 
  at System.IO.DirectoryInfo.GetFiles (System.String searchPattern) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:GetFiles (string)
  at ConstantTWR.ConstantTWR.GetFileList () [0x00000] in <filename unknown>:0 
  at ConstantTWR.ConstantTWR.FileSelWindow (Int32 id) [0x00000] in <filename unknown>:0 
  at UnityEngine.GUILayout+LayoutedWindow.DoWindow (Int32 windowID) [0x00000] in <filename unknown>:0 
  at UnityEngine.GUI.CallWindowDelegate (UnityEngine.WindowFunction func, Int32 id, Int32 instanceID, UnityEngine.GUISkin _skin, Int32 forceRect, Single width, Single height, UnityEngine.GUIStyle style) [0x00000] in <filename unknown>:0 
 
(Filename:  Line: -1)
  1. the folder was not existing, so the mod bugged out, after I manually added the folder the UI was back alive
  2. the folder should perhaps be \ConstantTWR\Plugins\PluginData

The location is correct, a new build process left out the directory.

Just create the missing folder in 

ConstantTWR/PluginData

I'll get it fixed this evening 

New release, 0.0.4:

  • Added code to create config directory if it wasn't there
  • Changed version info to allow all 1.4.*
Link to comment
Share on other sites

  • 2 months later...
  • 1 year later...

Nice mod.. cant believe I havent seen this yet...
I am *constantly* adjusting throttle, watching TWR to maintain within a good a range, during ascent... (I usually overbuild rockets... dont spend much time testing and fine tuning them) :P

I dont know if its just me imagining it, or KSP aero really does take into consideration, MaxQ... vOv
but I've found (in stock scale), that throttling down between ~7.5km to 9, 10km, along with switching SAS to follow prograde during this part of ascent (or just letting off on pushing AoA changes, and go to prograde manually), seems to help prevent rocket flipping, or sudden pitch changes... vOv
I also try to work similar strategy during side-booster sep... (at least the following prograde, and having 0° AoA during sep)... it seems to help keep booster/core collisions from happening...

So, my question is, if KSP aero does indeed consider/model MaxQ, and I am not really crazy imagining this, would it possible/within scope of the mod, to add in automatically adjusting thrust level/TWR based on *pressure* measurement? vOv

Edited by Stone Blue
Link to comment
Share on other sites

On 6/28/2019 at 10:59 AM, Stone Blue said:

Nice mod.. cant believe I havent seen this yet...
I am *constantly* adjusting throttle, watching TWR to maintain within a good a range, during ascent... (I usually overbuild rockets... dont spend much time testing and fine tuning them) :P

I dont know if its just me imagining it, or KSP aero really does take into consideration, MaxQ... vOv
but I've found (in stock scale), that throttling down between ~7.5km to 9, 10km, along with switching SAS to follow prograde during this part of ascent (or just letting off on pushing AoA changes, and go to prograde manually), seems to help prevent rocket flipping, or sudden pitch changes... vOv
I also try to work similar strategy during side-booster sep... (at least the following prograde, and having 0° AoA during sep)... it seems to help keep booster/core collisions from happening...

So, my question is, if KSP aero does indeed consider/model MaxQ, and I am not really crazy imagining this, would it possible/within scope of the mod, to add in automatically adjusting thrust level/TWR based on *pressure* measurement? vOv

Its an interesting idea.  How would you adjust the throttle?  I would assume that you would want the twr adjusted according to the pressure, but how?

Link to comment
Share on other sites

  • 3 months later...
  • 3 months later...
1 hour ago, leatherneck6017 said:

@linuxgurugamer Currently, if using MechJeb ascent guidance for launches, Constant TWR can't control the throttle. Would it be possible to get that to function? An idea I had would be to make this mod control the max thrust, instead of the throttle. Thoughts?

This can't override Mechjeb.  If Mechjeb is controlling the throttle, then you are stuck with that.

And this wasn't written to control the max thrust, rather different internally

Link to comment
Share on other sites

21 hours ago, leatherneck6017 said:

@linuxgurugamer Currently, if using MechJeb ascent guidance for launches, Constant TWR can't control the throttle. Would it be possible to get that to function? An idea I had would be to make this mod control the max thrust, instead of the throttle. Thoughts?

And I just remembered that Mechjeb can do the same thing, just limit the top accel.

Link to comment
Share on other sites

54 minutes ago, linuxgurugamer said:

And I just remembered that Mechjeb can do the same thing, just limit the top accel.

That "sorta" works. I'm playing a highly modded JNSQ and I get the best results using the MechJeb default launch profile and MANUALLY controlling the max thrust myself via the PAW to keep TWR at around 1.5 until 45km or so. I was just curious if there was a code change for this mod that would hook into the max thrust instead of throttle.

Edited by leatherneck6017
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...