Jump to content

[1.12.x] Throttle Limit Extended


linuxgurugamer

Recommended Posts

This mod started as the Throttle Limit Action Groups, and was listed as discontinued.

A forum user, @Errol, requested that I revive it and add a new feature.  The new feature was significant enough that I decided to totally rename the mod.

Originally suggested by Kofeyh of KSPTV, this super simple mod allows players to assign levels of throttle limiting to an engine on their craft through the magical power of action groups.

These action groups work like any of the stock ones, meaning they will also copy to symmetry counterparts.

Note that users of AGX will have to abide by AGX's cooldown periods and cannot simply spam a button. Plan your groups accordingly.

Additionally, the mod now puts a minimum throttle setting on  (currently) stock engines.  What this means is that , for example, the Rapier which has a minimum throttle of 20%, will throttle from 100% down to 20% (using the full range of the throttle), and then to 0%.  

  • New functionality
    • Added toolbar button and window for controlling the Thrust Limiter
      • Can change the following:
        • All active engines
        • All inactive engines
        • All RCS
        • and can also select specific engine types
      • Remembers window position
  • Added settings window with the following options:
    • Enable Throttle Limits
    • Enable Global Thrust Limit Window
    • Use Alternative Skin

It is not totally safe to use both the Throttle Limits and the Global Thrust Limit Window together,  it seems to confuse other mods which don't expect this behaviour.

Availability

Toolbar button

zEcEsnO.png

The toolbar button is used to open up the Thrust Limit window

Action Groups

RIwS8U8.png

 

Thrust Limit Window

This mod now has the ability to change the thrust limits of various types of engines. Click the toolbar button (which looks like a throttle):

DzY3E0h.png

 

Settings Window

WT8QlU7.png

 
Edited by linuxgurugamer
Link to comment
Share on other sites

Cool.

You might be interested in this bugreport to tweak existing stock parameter to allow more sane native behavior: https://bugs.kerbalspaceprogram.com/issues/15826

 

I wonder if it is possble to use atmosphereCurve  values in MM selectors. (To autoassign thrust limits based on the difference between ASL and VAC Isp values)

Link to comment
Share on other sites

20 minutes ago, Psycho_zs said:

Cool.

You might be interested in this bugreport to tweak existing stock parameter to allow more sane native behavior: https://bugs.kerbalspaceprogram.com/issues/15826

 

I wonder if it is possble to use atmosphereCurve  values in MM selectors. (To autoassign thrust limits based on the difference between ASL and VAC Isp values)

I don't understand what you are saying in that bug report, because ModuleEnginesFX derives from ModuleEngines, and minThrust is defined in ModuleEngines, there is no reference to minThrust in ModuleEnginesFX.

This mod has no problem changing the minThrust for any engine, be it a ModuleEngines or ModuleEnginesFX

Oh, I misunderstood

You are correct, except that in your bug report you only mention ModuleEnginesFX, while I'm pretty sure it happens with ModuleEngines as well

Edited by linuxgurugamer
Link to comment
Share on other sites

@Psycho_zs

I wonder how they are going to implement it.  Frankly, I don't have a problem with it using the entire throttle range for a limited thrust range.  The only issue I see is that how do you turn off the engine.  Right now, throttling down an engine will eventually turn it off.  Using the entire throttle range prevents the engine from being accidently turned off.  I know they can code it, but not sure if it's worth it.

Link to comment
Share on other sites

Its nice to have this come to stock parts instead of just being a RO thing.  I like having the full range throttle motion to run the whole limited throttle range.  So zero throttle is actually 20% thrust.  Should work well with action groups set for engine startup and shutdown.  

Link to comment
Share on other sites

Things will get messy either way when engines with different throttle depth are used simultaneously.

Combinations of things can be reduced down to three advanced tweakables:

  • shutdown when throttle = 0
  • shutdown when current thrust < minThrust
  • throttle mapping:  proportinal, or stretched proportionally to deepest throttle, or stretched fully

Out of 12 possible combinations only 7 make sense:

Spoiler

 


Proportional, shutdown under minThrust:
Engine1:    0-----------------------------------------|maxThrust
Engine2:    000000000000|minThrust--------------------|maxThrust
Engine3:    00000000000000000000000000|minThrust------|maxThrust
Throttle:   0|not_0-----|-------------|---------------|100

Proportional, shutdown at 0:
Engine1:    0-----------------------------------------|maxThrust
Engine2:    0mmmmmmmmmmm|minThrust--------------------|maxThrust
Engine3:    0mmmmmmmmmmmmmmmmmmmmmmmmm|minThrust------|maxThrust
Throttle:   0|not_0-----------------------------------|100

Proportional, no shutdown:
Engine1:    0-----------------------------------------|maxThrust
Engine2:    mmmmmmmmmmmm|minThrust--------------------|maxThrust
Engine3:    mmmmmmmmmmmmmmmmmmmmmmmmmm|minThrust------|maxThrust
Throttle:   0|not_0-----------------------------------|100



Stretched proportionally to deepest throttle, no shutdown:
(Engine1 removed, otherwise it would be the same as proportional)
Engine2:    |minThrust--------------------------------|maxThrust
Engine3:    mmmmmmmmmmmmmmmmmmmmm|minThrust-----------|maxThrust
Throttle:   0|not_0-----------------------------------|100

Stretched proportionally to deepest throttle, shutdown at 0
(Engine1 removed, otherwise it would be the same as proportional)
Engine2:    0|minThrust-------------------------------|maxThrust
Engine3:    0mmmmmmmmmmmmmmmmmmmm|minThrust-----------|maxThrust
Throttle:   0|not_0-----------------------------------|100



Stretched full, no shutdown:
Engine1:                                                     0----------------------|maxThrust
Engine2:                                              0------|minThrust-------------|maxThrust
Engine3:    0------------------------------------------------|minThrust-------------|maxThrust
Throttle:                                                    0|not_0----------------|100

Stretched full, shutdown at 0:
Engine1:                                                     0----------------------|maxThrust
Engine2:                                              0------0|minThrust------------|maxThrust
Engine3:    0------------------------------------------------0|minThrust------------|maxThrust
Throttle:                                                    0|not_0----------------|100

 


 

Edited by Psycho_zs
Link to comment
Share on other sites

1 hour ago, Psycho_zs said:

Things will get messy either way when engines with different throttle depth are used simultaneously.

I totally agree.  Wonder what happens now?

1 hour ago, Psycho_zs said:

Combinations of things can be reduced down to three advanced tweakables:

  • shutdown when throttle = 0
  • shutdown when current thrust < minThrust
  • throttle mapping: stretched or proportinal

Interesting analysis.  But it doesn't address your first point.

Throttle mapping needs to be done the same for all active engines. I think the simplest would one of the following:

  1. Throttle mapping is not stretched at all
  2. Throttle mapping is stretected to whichever engine has the lowest minThrust setting
Link to comment
Share on other sites

Another batch of thoughts:

Continuing burning when throttle is at 0 does not make sense gameplay-wise.

Engines dynamically affecting behavior of other engines might not be handy predictablity-wise. You dock to some deeply throttleable craft while your throttle is not 0 and boom, unplanned blastoff. So proportional stretching should at least be optional.

Flameout below minThrust can be set at part level.

Sumarizing this we are left with 3 major variants:

Proportional:
Engine1:    0-----------------------------------------|maxThrust
Engine2:    0mmmmmmmmmmm|minThrust--------------------|maxThrust
Engine3:    0mmmmmmmmmmmmmmmmmmmmmmmmm|minThrust------|maxThrust
Throttle:   0|not_0-----------------------------------|100


Stretched proportionally to deepest throttle:
(Engine1 removed, otherwise it would be the same as proportional)
Engine2:    0|minThrust-------------------------------|maxThrust
Engine3:    0mmmmmmmmmmmmmmmmmmmm|minThrust-----------|maxThrust
Throttle:   0|not_0-----------------------------------|100


Stretched full:
Engine1:                                                     0----------------------|maxThrust
Engine2:                                              0------0|minThrust------------|maxThrust
Engine3:    0------------------------------------------------0|minThrust------------|maxThrust
Throttle:                                                    0|not_0----------------|100

+ an option at part level to flameout below minThrust, (default false)

Link to comment
Share on other sites

Returning to Throttle Limit. I want to find a fallback algorithm of autoassigning minThrottle via MM in relation to Isp.

Here are a couple of ways to calculate a coefficient to apply to maxThrottle:

engine    Isp(ASL)  Isp(Vac)       Isp(Vac) / Isp(ASL)    ( Isp(Vac) / Isp(ASL) )^2

Thud      275       305            0,90                   0,81
Terrier   85        345            0,25                   0,06
Puddle    90        350            0,26                   0,07
Skipper   280       320            0,88                   0,77
Mainsail  285       310            0,92                   0,85
Reliant   260       310            0,84                   0,70
Swivel    250       320            0,78                   0,61
Vector    295       315            0,94                   0,88
Rhino     205       340            0,60                   0,36
Dart      290       340            0,85                   0,73

I do not know how to extract data from atmosphereCurve.

Link to comment
Share on other sites

This config automatically sets throttle depth devised from Isp. It can be adapted to with ThrottleLimiterModule and act as a fallback.

// find engines that use Oxidiser and have minThrust 0
@PART[*]:HAS[@MODULE[ModuleEngines*]:HAS[@PROPELLANT[Oxidizer],#minThrust[0]]]:FINAL {
	@MODULE[ModuleEngines*] {
		// set minThrust to maxThrust
		@minThrust = #$maxThrust$
		// multiply by Isp(ASL):
		@minThrust *= #$atmosphereCurve/key,1[1, ]$
		// divide by Isp(Vac):
		@minThrust /= #$atmosphereCurve/key,0[1, ]$

		// Uncomment these for quad variant:
		// multiply by Isp(ASL) again:
		//@minThrust *= #$atmosphereCurve/key,1[1, ]$
		// divide by Isp(Vac) again:
		//@minThrust /= #$atmosphereCurve/key,0[1, ]$
	}

	// update description
	thrustPerc = #$MODULE[ModuleEngines*]/minThrust$
	@thrustPerc *= 100
	@thrustPerc /= #$MODULE[ModuleEngines*]/maxThrust$
	@description ^= :$: Can be throttled down to #$thrustPerc$%.:
}

There are limitations: values from atmosphereCurve are extracted positionally. I haven't seen a config in my GameData that does funky things with atmosphereCurve, but if the first key isn't a vacuum value or the second isn't sea level value, things will go wrong. Maybe I will add filter for proper order in atmosphereCurve.

The last bit about description update does not render the variable properly...

Edited by Psycho_zs
Link to comment
Share on other sites

  • 3 weeks later...

Some time ago, I was working on making a mod like this.  I never quite got the PartModule to behave the way I wanted, but I worked out a Module Manager patch that looked at an engine's part tags to determine whether it was a turbopump-driven (60% min throttle) or pressure-fed (15% min throttle) engine.  (Any engines left over at the end got a 30% throttle limit.)  It would be pretty straightforward to adapt to the different config logic that your mod uses.

I can adjust the limits if you think e.g. 80% is a better limit for lifter engines, or what have you, but it would be a patch that handles any engine from any mod that didn't have a a specific patch for it.  Would you be interested in taking it as a PR?

Link to comment
Share on other sites

13 minutes ago, Kerbas_ad_astra said:

Some time ago, I was working on making a mod like this.  I never quite got the PartModule to behave the way I wanted, but I worked out a Module Manager patch that looked at an engine's part tags to determine whether it was a turbopump-driven (60% min throttle) or pressure-fed (15% min throttle) engine.  (Any engines left over at the end got a 30% throttle limit.)  It would be pretty straightforward to adapt to the different config logic that your mod uses.

I can adjust the limits if you think e.g. 80% is a better limit for lifter engines, or what have you, but it would be a patch that handles any engine from any mod that didn't have a a specific patch for it.  Would you be interested in taking it as a PR?

PRs are welcome, but I'm trying to understand what you are saying.

How can you tell if an engine is turbopump-driven or pressure-fed?  Sounds like it would be very useful.

And, regarding the limit for lifter engines, for now I'd like to leave it at 80, although specific engines can always override that.  The actual limit can be chagned later.

Link to comment
Share on other sites

1 minute ago, linuxgurugamer said:

PRs are welcome, but I'm trying to understand what you are saying.

How can you tell if an engine is turbopump-driven or pressure-fed?  Sounds like it would be very useful.

And, regarding the limit for lifter engines, for now I'd like to leave it at 80, although specific engines can always override that.  The actual limit can be chagned later.

I'm basically depending on mod authors to be honest when tagging their engines. :)  If the engine's tag list has "vernier", "land", "maneuver", "orbit', or "vacuum" in it, I figure it's a pressure-fed engine with a deep throttle.  If the tags say "sustain", "launch", "ascend", or "boost", I figure it's a pump-driven engine.  I'll set the patches to run AFTER[ThrottleLimitExtended], so the patches will only run on engines that haven't been specifically patched already (so we can handle any weird cases with patches that run earlier).

The actual patch I'd made for what would have been my "ThrottleUp" mod is here: https://github.com/Kerbas-ad-astra/ThrottleUp/blob/master/GameData/ThrottleUp/ThrottleUp.cfg

In addition to changing the limit, I'll also re-arrange the patches a little bit, since (in my mind) "orbit" and "vacuum" are a little more "ambiguous" in terms of what they signify, so I'll have 'vernier', 'land', and 'maneuver' first, then the turbopump tags, and then 'orbit' and 'vacuum'.

Link to comment
Share on other sites

30 minutes ago, Kerbas_ad_astra said:

I'm basically depending on mod authors to be honest when tagging their engines. :)  If the engine's tag list has "vernier", "land", "maneuver", "orbit', or "vacuum" in it, I figure it's a pressure-fed engine with a deep throttle.  If the tags say "sustain", "launch", "ascend", or "boost", I figure it's a pump-driven engine.  I'll set the patches to run AFTER[ThrottleLimitExtended], so the patches will only run on engines that haven't been specifically patched already (so we can handle any weird cases with patches that run earlier).

The actual patch I'd made for what would have been my "ThrottleUp" mod is here: https://github.com/Kerbas-ad-astra/ThrottleUp/blob/master/GameData/ThrottleUp/ThrottleUp.cfg

In addition to changing the limit, I'll also re-arrange the patches a little bit, since (in my mind) "orbit" and "vacuum" are a little more "ambiguous" in terms of what they signify, so I'll have 'vernier', 'land', and 'maneuver' first, then the turbopump tags, and then 'orbit' and 'vacuum'.

Sounds good.

Link to comment
Share on other sites

22 minutes ago, Psycho_zs said:

Well, I went on EVA, let go of the ladder and the ship turned the engine on and flew away.

Very nice.

some details would be nice, such as a log file, craft file, etc

Edit:  I just tested this, and didn't have a problem.  This mod doesn't change the throttle, it just prevents it from going below a certain level.

Edited by linuxgurugamer
Link to comment
Share on other sites

ThrottleLimiterModule.CheckThrust:  part; LV-303 "Pug" Liquid Fuel Engine,   stv: decrease
ThrottleLimiterModule.CheckThrust:  part; LV-303 "Pug" Liquid Fuel Engine,   stv: off
ThrottleLimiterModule.CheckThrust:  part; LV-303 "Pug" Liquid Fuel Engine,   stv: off

Just reproduced it again. This was in the log in the moment of ignition.

Simple craft: mk1 pod, FL-T100, Pug. (from overhauls). Throttle was cut off by pressing X.

More precisely, engine starts when I bump the craft with a kerbal, not when I let go of the hatch.

Among other mods there are RealPlume/Smokescreen. These have a history of messing with engines in weird way. Will try on stock soon...

...Yep, same thing on stock game + TLE.

Mk1 Pod, FL-T100, Terrier. The craft is scared of bumping it with a helmet and flies away. Similar messages in the log.

Edited by Psycho_zs
Link to comment
Share on other sites

Hi.

Was able to reproduce it. Have to say, that pressing CTRL what is "throttle down" kicks the thrust of my engine to 60%. But the throttle stays at 0%. To kill the engine I need to press "X" (cut engine).

Interesting is, even on EVA that happens. Made a quick video, send it to you, @linuxgurugamer Maybe it helps debugging. o/

BR
JebsSY

Edited by Jebs_SY
Link to comment
Share on other sites

Oh, i just duplicated it.  It is when you hit the Ctrl key (ie:  throttle down) or Shift (ie:  thorttle up), nothing to do with bumping.

And, I think I found it :D

New release, 2.0.3:

  • Fixed bug where any and all vessels in Physics range would turn on their engines if the throttle keys were pressed. Most noticed on EVA
Edited by linuxgurugamer
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...