Jump to content

Creating instant throttle response electric propeller engines?


Recommended Posts

Hi,

A long time ago I modelled some electric propeller engines for Infernal Robotics, but due to work commitments never got around to implementing them. Now that I have free time again, I was wondering what options I have in terms of modules / plugins to bring them to life? Here's a pic of the engines:

_03f47627516c4de58c4b06d882c4f63d

What I would like is for the engines to consume EC based on their RPM, rather than their current throttle setting. The throttle would then give a percentage thrust from zero to the maximum that RPM could deliver (by having an animation control blade pitch), allowing for instant throttle response like rocket engines. Does anybody know of a good way to achieve this with either stock modules or Firespitter?

From my searches, FSengine could do what I want, but from testing it seems EC is still dependent on the throttle, which I don't want, or at least would prefer there to be a minimum EC the engine consumes. Also, there does not appear to be any fuel consumption indicator on the module, and its RPM modifier looks to be broken.

Thanks
-Zodius

Link to comment
Share on other sites

could you not just add to your part config that's its a resource consumer, and the resource is EC? that way when it's active i'll use EC at a fixed rate, admittedly this isn't directly what you want but its would have a constant minimum consumption.

You'd probably have to cook up a little plugin to achieve what you want (which i believe is to have the EC consumption tie into the torque load on the propeller blades (helicopter style) that way you could have your constant RPM and then adjust the blade pitch and have the plugin calculate it's consumption based on the pitch angle).

Link to comment
Share on other sites

Thanks for the suggestion. Having a resource consumer to set a minimum could work. Do you know of a stock module that would achieve this that can be tied to engine activation state? As you say, I could then have the engines normal resource consumption be low to emulate the propeller blade torque load. 

Link to comment
Share on other sites

there are two stock module which might be able to do what you need, one is toggable, one is not.  The latter is first and will definitely add a steady resource consumer to your part (added bonus it makes you part a probe!).

MODULE
	{
		name = ModuleCommand
		minimumCrew = 0
		RESOURCE
		{
			name = ElectricCharge
			rate = 0.02777778 		// Make this whatever value you want for baseline consumption
		}
	}

Now the second is purely theoretical as i have not tried this myself but, potentially by assigning this module to you part you could make it toggle in game (although it may have other science based side effects).

MODULE
	{
		name = ModuleScienceLab
		containerModuleIndex = 0
		dataStorage = 0
		crewsRequired = 0
		canResetConnectedModules = false
		canResetNearbyModules = false
		interactionRange = 0
		SurfaceBonus = 0.0
		ContextBonus = 0.0
		homeworldMultiplier = 0.0
		RESOURCE_PROCESS
		{
			name = ElectricCharge
			amount = 10			// Set this amount to what you want it to draw whilst active
		}
	}

Hope one of these work for you for testing purposes. Keep us posted!

Link to comment
Share on other sites

Well, I've done an electric engine (kind of) with stock modules only. But consumption and visible RPM (animation speed) are proportional to throttle. Afterall, ModuleEnginesFX does not have any "RPM" to compare. But isn't RPM a function of throttle IRL?

Look for Impeller part in /ChopShop/Propulsion/Impeller. Though config is not very good or anyhow balanced, it does make small drones fly on all stock atmospheric planets.

RESOURCE_DEFINITION
{
  name = Airflow
  density = 0.005
  flowMode = NO_FLOW
  transfer = NONE
  isVisible = false
}
PART
{
// --- general parameters ---
name = lil_buzzer
module = Part
author = Dr. Jet

mesh = model.mu
scale = 1

node_attach = 0.0, 0.0, -0.16, 0.0, 0.0, 1.0, 0

// attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision
attachRules = 0,1,0,0,0

// --- editor parameters ---
TechRequired = advElectrics
entryCost = 1200
cost = 400
category = Propulsion
subcategory = 0
title = Li'l Buzzer
manufacturer = Dr. Jet's Chop Shop
description = Tiny electric impeller, salvaged from RC model plane.

// --- standard part parameters ---
mass = 0.01
dragModelType = default
maximum_drag = 0.2
minimum_drag = 0.1
angularDrag = 1
crashTolerance = 7
maxTemp = 1200 
bulkheadProfiles = srf

MODULE
	{
		name = ModuleEnginesFX
		engineID = Cruise
		thrustVectorTransformName = thrustTransform
		exhaustDamage = False
		ignitionThreshold = 0.1
		minThrust = 0
		maxThrust = 5
		heatProduction = 0.1
		useEngineResponseTime = True
		engineAccelerationSpeed = 0.5
		engineDecelerationSpeed = 0.8
		flameoutEffectName = flameout
		powerEffectName = running_thrust
		engageEffectName =
		disengageEffectName =
		spoolEffectName = running_turbine
		engineSpoolIdle = 0.05
		engineSpoolTime = 2.0
		EngineType = Turbine
		PROPELLANT
		{
		name = ElectricCharge
		ratio = 5
		DrawGauge = True
		}
		PROPELLANT
		{
		name = Airflow
		ratio = 1
		}		
		atmosphereCurve
		{
		key = 0 220 0 0
		key = 1 200 -55 -55
		key = 5 100 0 0
		}
		// Jet params
		atmChangeFlow = False
		useVelCurve = False
		useAtmCurve = True
		machLimit = 0.75
		machHeatMult = 3.5
		velCurve
		{
		key = 0 1 0 0
		key = 0.5 0.8 -0.9460317 -0.9460317
		key = 0.8 0.3523809 -1.626984 -1.626984
		key = 1 0 -1.761905 -1.761905
		}
		atmCurve
		{
		key = 0 0 0 0
		key = 0.3 0.18 0.6 0.6
		key = 1 0.5 0.4 0.4
		key = 5 1 0 0
		}
	}
	EFFECTS
	{		
    running_thrust
	{
	AUDIO
    {
      channel = Ship
      clip = ChopShop/Sounds/rsths13_hubsan
      volume = 0.0 0.0
      volume = 1.5 1.5
      pitch = 0.0 0.2
      pitch = 1.3 1.3
      loop = true
    }
	}
	running_turbine
	{
		AUDIO
		{
		channel = Ship
		clip = ChopShop/Sounds/rsths13_hubsan
		volume = 0.0 0.0
		volume = 0.6 0.7
		volume = 0.85 0.95
		pitch = 0.3 0.7
		pitch = 0.55 0.8
		pitch = 1.0 1.0
		loop = true
		}
	}
	}
MODULE
{
  name = ModuleResourceIntake
  resourceName = Airflow
  checkForOxygen = false
  area = 0.0005
  intakeSpeed = 0.05
  intakeTransformName = Intake  
}

MODULE
	{
		name = FXModuleAnimateThrottle
		animationName = Rotate
		responseSpeed = 1.0
		layer = 2
		dependOnEngineState = True
		dependOnThrottle = True
		weightOnOperational = True
		affectTime = false
		baseAnimSpeed = 0.1		// base + (throttle setting * multiplier)
		baseAnimSpeedMult = 1000
		playInEditor = False
		animWrapMode = 2  	//	Default = 0	Once = 1		Clamp = 1	Loop = 2		PingPong = 4	ClampForever = 8
	}
RESOURCE
{
    name = Airflow
    amount = 0.3
    maxAmount = 0.5
}
}

P.S. If you will generate any ideas of improving this config (realistic curves settings especially) - please share them with me. 

Edited by Dr. Jet
Link to comment
Share on other sites

The stock alternator module could help zero out the ec consumption, if its set to generate the same as consumed.  It varies by throttle and only works if the engine is on.  As far as a minimum goes, take a look at module reourceconverter or module generator, both can be toggled and can be set to consume resources.  Resource converter, can be "throttled" separately from main ships throttle.  Not sure how to tie these in to engine activation though.  Other modules can be used to consume ec like module radiator.

Link to comment
Share on other sites

Thanks for the comments guys.

10 hours ago, mikerl said:

The stock alternator module could help zero out the ec consumption, if its set to generate the same as consumed.  It varies by throttle and only works if the engine is on.  As far as a minimum goes, take a look at module reourceconverter or module generator, both can be toggled and can be set to consume resources.  Resource converter, can be "throttled" separately from main ships throttle.  Not sure how to tie these in to engine activation though.  Other modules can be used to consume ec like module radiator.

Using an alternator to zero out ec is an interesting thought.

3 hours ago, IronCretin said:

Can the generator module be set to generate negative EC?

Yep. Just tested it. Although I cannot see any way to tie it's state to that of an engine. 

I suspect if I want a minimum I will need to have a custom Module created that hooks in to ModuleEngine like the alternator, but only has a fixed consumption based on activation state. Sounds like a simple enough feature, but I haven't done any coding for KSP before, and have got plenty of other mod parts to be getting on with at the moment.

Btw, for those interested, I've made good progress on getting the parts functional: http://forum.kerbalspaceprogram.com/index.php?/topic/59359-wip-msis-infernal-robotics-model-rework-v02-pre-release-beta/&page=86

Link to comment
Share on other sites

7 hours ago, ZodiusInfuser said:

Yep. Just tested it. Although I cannot see any way to tie it's state to that of an engine. 

I suspect if I want a minimum I will need to have a custom Module created that hooks in to ModuleEngine like the alternator, but only has a fixed consumption based on activation state. Sounds like a simple enough feature, but I haven't done any coding for KSP before, and have got plenty of other mod parts to be getting on with at the moment.

You can add this parameter to "ModuleGenerator"

isThrottleControlled = true

But i think the better idea is to make engine more efficient with higher RPM:

MODULE
{
 name = ModuleEnginesFX
 useThrottleIspCurve = True

 throttleIspCurve //Modifies Isp based on throttle 
  {
  key = 0 1  // 0=throttle,1=multiplier to Isp 
  key = 1 *
  } 

 throttleIspCurveAtmStrength //Modifies Isp based on throttle 
  {
  key = 0 1  // 0=pressure in atm,1=how much throttling affects Isp
  key = 1 *
  }
}

It would be nice if we had access to actual models for testing.:wink:

Link to comment
Share on other sites

Hello @ZodiusInfuser,i made this test *.cfg for the "IR_MediumPropeller":

// --- Engine Parameters ---
 MODULE
 {
 name = ModuleEngines
 thrustVectorTransformName = thrustTransform
 exhaustDamage = false
 ignitionThreshold = 0.01
 minThrust = 0.5
 maxThrust = 10
 heatProduction = 8
 atmChangeFlow = true
 useThrottleIspCurve = true
 flameout = true
 engineType = Turbine

  PROPELLANT
   {
   name = ElectricCharge
   ratio = 10
   DrawGauge = true
   //ignoreForIsp = true
   }

 atmosphereCurve
  {
  key = 0 250
  }

 throttleIspCurve
  {
  key = 0 0  
  key = 0.5 1
  key = 1 1.5 
  }

 throttleIspCurveAtmStrength  //delete this curve for fixed "Isp"
  {
  key = 0 1 
  key = 0.05 0.75
  key = 1 0 
  }
}

//MODULE
//{
//  name = FXModuleAnimateThrottle
//  animationName = MediumPropPitch
//  dependOnEngineState = false
//  responseSpeed = 0.5
//}

MODULE
{
  name = FSplanePropellerSpinner
  propellerName = PropHub
  rotationSpeed = -250
  thrustRPM = -100
  windmillRPM = -30
  windmillMinAirspeed = 30
  spinUpTime = 0.2
  useRotorDiscSwap = 0
  //rotorDiscFadeInStart = 0.95
  //rotorDiscFadeInEnd = .95
  //rotorDiscSpeed = 80
  //rotorDiscName = PropHub
  blade1 = Blade1
  blade2 = Blade2
  blade3 = Blade3
}

it needs to be balanced,but it's just a concept how electric propeller could work.
I hope this is somehow helpful to you http://sendvid.com/v6wp7z7b

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...