Jump to content

BradMick

Members
  • Posts

    8
  • Joined

  • Last visited

Reputation

1 Neutral

Profile Information

  • About me
    Bottle Rocketeer
  1. using UnityEngine; using System.Collections; public class plasmaThruster : MonoBehaviour { static double radiatorWasteHeatCapacity(double radiatorArea, double radiatorEmissivity, double boltzmanConstant, float radiatorTemp) { double maxReactorOutput = radiatorArea * (radiatorEmissivity * boltzmanConstant * Mathf.Pow(radiatorTemp, 4)) * 0.000001; return maxReactorOutput; } static double reactorOutput(double maxReactorOutput, double wasteHeatFraction) { double useableReactorPower = maxReactorOutput * (1 - wasteHeatFraction); return useableReactorPower; } static double thrusterOutputPower(double useableReactorPower, double thrusterEfficiency) { double thrusterPower = useableReactorPower * thrusterEfficiency; return thrusterPower; } static double wasteHeat(double maxReactorOutput, double useableReactorPower, double thrusterPower) { double systemWasteHeat = (maxReactorOutput - useableReactorPower) + (useableReactorPower - thrusterPower); return systemWasteHeat; } static double thrustOutput(double thrusterPower, double currentIsp) { double thrust = ((2 * (thrusterPower / 0.000001)) / (currentIsp * 9.81)) * 0.001; return thrust; } static double thrusterPropellantFlow(double thrust, double currentIsp) { double mDot = (thrust / 0.001) / (currentIsp * 9.81); return mDot; } static void Main() { //double minimumIsp = 400; //Isp in seconds //double maximumIsp = 5500; //Isp in seconds double currentIsp = 400; //the thrusters current set Isp <-- needs to be driven by a slider double radiatorArea = 200; //the systems radiator area in square meters float radiatorTemp = 1173.15f; //radiator temperature in Kelvin (celsius + 273.15) double radiatorEmissivity = 0.95; //the radiators emissivity, dimensionless. For carbon ~0.95 double boltzmanConstant = 5.670373 * 0.00000001; //the boltzman constant! double wasteHeatFraction = 0.75; //this is the percentage of the output that is waste heat double thrusterEfficiency = 0.60; //for a Plasma Thruster (VASIMR) currently at about 0.60 double maxReactorOutput = radiatorWasteHeatCapacity(radiatorArea, radiatorEmissivity, boltzmanConstant, radiatorTemp); //determined through a function! double useableReactorPower = reactorOutput(maxReactorOutput, wasteHeatFraction); //this is the actual useable power from the reactor after subtracting out waste heat. For a Fission reactor, around 0.75 is the waste heat, and for a Fusion Reactor around 0.05 to 0.25 double thrusterPower = thrusterOutputPower(useableReactorPower, thrusterEfficiency); //the amount of power available in the thrust beam double systemWasteHeat = wasteHeat(maxReactorOutput, useableReactorPower, thrusterPower); //the systems (reactor + thruster(s)) total waste heat output double thrust = thrustOutput(thrusterPower, currentIsp); //the thrusters current level of thrust in kilonewtons (kN) double mDot = thrusterPropellantFlow(thrust, currentIsp); //the thrusters mass mDot (propellant mass flow rate) in kg/s } } So, here's the completed set of functions for the thruster. I'm starting to play with figuring out how to put this all together with the GUI stuff, but I'm not really 100% with what goes where inside of the GUI code. Essentially the slider needs drive currentIsp. A small function needs to be written to make sure that currentIsp cannot go higher than maximumIsp and minimumIsp. Really, it'd be something like: (maximumIsp - minimumIsp) / 100 = slider setting, then currentSliderSetting * sliderSetting = currentIsp. Just spit-balling that off the top of my head. Well, except that 0 on the slider would equal 400 and 100 would equal 5500. So, that logic needs to be built in there too. So, really it'd be if currentSliderSetting = 0, set to minimumIsp, and then minimumIsp + (sliderSetting * currentSliderSetting) = currentIsp. So that way it's not going lower than the minimum and and then just adds the sliderSetting to the minimumIsp value. The neat thing, after playing with it in Excel, is that no logic check for exceeding the maximum is required, because at 100% it'll total up to 5500 for the Isp. Anyway, gonna keep plugging away, but the integration may need to be bounced into your court now. Brad
  2. Here's what I accomplished today...which isn't as much as I wanted. I've put this all together in visual studio just so I could actually wet my teeth on the actual syntax and flow of C# (it's enough different from C++, and my knowledge there is ridiculously rudimentary at this point) that it was a little bit of an uphill fight, but I at least got the functions working. I'll work on it some more tomorrow, but I wanted to at least show some progress on this. Basically I just have to finish up the parts that will get integrated into the slider, which that looks like it'll be fun to do for sure. Anyway, any hints/tips/tricks/etc. would be awesome! I'm learning as I go here and enjoying every minute of it. Brad
  3. Rock on! Okay, I'll work on finishing up the code tonight and then post it for you here. I'll have to dig around to find the log as well to make sure all the math is functioning right. I've got it working in the C++ code, but I really ant to visually see it in the C# code to make sure I didn't mess anything up. Bear in mind this is going to be the first real program I've written, so...it'll probably be woefully inefficient, but it'll pump out all the data needed, so...that's the bonus, right? Heheh... Brad Also, I've done zero modeling so far, as I've really been interested in the code side of the house, so let's just have Mek do the modeling. If he wants I can help, but I'm having fun tinkering right now with code...a lot of fun, probably more than I should be.
  4. Awesome! So, I've started coding this in Unity using the Monodevelop software, and it's a pretty awesome tool! Now, the problem is...I'm trying to get it to display a console window with the results of the function that I've coded and it's not showing me any output. There are no errors, warnings only because I've specified some initial values that haven't been used yet, and no window showing me the output I'm telling it to print to the screen. I would like to see that the output matches what I've coded, been looking through the unity stuff, but can't really find a clear cut 'put this in there and it'll print to the screen!'. I'm learning this on the fly and as I go with my 'intro to programming' class I'm taking right now...appreciate the patience! Brad
  5. So, some good news. I've programmed the functions to allow all of this stuff to be generated. The bad news is, it's not a loop right now, and it's also using the Dark GDK. I haven't written the bits for limiting the users Isp input range yet either. Actually, there's zero input right now. it's all just hard coded. I'm going to try my hand at coding it for Kerbal. Will let you know! Brad
  6. Orbitus, Sounds awesome! I'll be more than happy to lend whatever knowledge and stuff like that! I'm getting ready to start modeling the parts to the ship I've envisaged in the next couple of days. Right now i'm looking at a total of four total modules. Actually, make that 5. It'll be the Drive section, Waste Heat Array/Power Plant Module, Propellant Module, Spin Hab module and Flight Module. May change, but that's the general idea so far. Will post some stuff as I get things working. Brad
  7. I think i'm starting to figure this out a little bit...the problem is though, getting a power source to work for it. After referencing this thread: http://forum.kerbalspaceprogram.com/showthread.php/26354-Ion-Engine-consumes-more-energy-than-it-should?p=321868&viewfull=1#post321868 It looks like the ratio would be energy: 7,698,888 electricity per second for every 0.398 kg/s propellant usage in Low gear (1.56 kN / 400 sec Isp) That way, when multiplied, the energy used per second when the engine is at full thrust is 3,061,051. Still pluggin' away. Brad McKinstry
  8. Howdy all! First post. Been a long time support of KSP and am now finally getting into playing around with config files and the like. I'm trying to work out how to translate the numbers I've run for a VASIMR style engine into the config file. Here is what i'm working with: First I started by deciding the size of my powerplants radiator. For this system I went with a 200m2 radiator. Using this formula: Radiator Area * (Emissivity * Boltzman Constant * Temperature^4) = 200 * (0.95*(5.670373*0.00000001)*1173.15^4 = 20,407,011.47 watts OR 20.41 MW. I then divided this by 4. Why 4 you ask? Because through research (that was pointed out by Ken Burnside of Attack Vector: Tactical fame) I understand that for every watt of useful power, there's 4 watts of waste heat. This gives me 5.10 MW of useable output. Further research into VASIMR has it sitting around 60% efficient right now, so taking 60% of 5.10 MW, I've now got 3.06 MW going to my actual thruster. I set my ISP values for Low to 400 sec, medium 2550 sec and high to 5500 sec. Running the numbers based on the power going into the thrust beam using: (2 * Thrust Power ) / (Isp * 9.81) I came up with thrust for Low to be 1.56 kN, medium 0.24 kN and high to be 0.11 kN Total waste heat is going to be 17.35 MW ((20.41-5.10) + (5.10-3.06)) Which is more than covered by the system as it's designed right now...So, sorry for the long winded post, but yeah..there is my dilemma. As I understand it right now, in the config file I can specify Max Thrust, Minimum Thrust, Heat Production, and fuel consumption. What I can figure out is how I get the variable parts in there within the ranges I've specified. I'm sure to there are lots of mistakes in my assumptions, and there's a lot of debate as to whether or not VASIMR is viable anyway, but it'd be neat to simulate all of this and see hhow it might work in real time. The reactor is assumed to be a nuclear fission reactor. Also, I am assuming a lot of research shrunk the reactors down to manageable sizes, but even assuming 500 kilograms per megawatt, this reactor at 20.41 MW output is 10,200kg! But, anyway...Hopefully some of the brains out there that have been doing this for a minute can help me along! Thanks in advance! V/R Brad McKinstrys
×
×
  • Create New...