Starwaster

[1.2.2] Ioncross Crew Support v1.26.0 (Starwaster's branch) - Jul 7, 2016

Recommended Posts

Ok. I can see the point of having an electrical cost for general life support. You do have to heat the capsule to a minimal degree and Kerbals do need their snacks. But it would be nice if we could get the current general cost lowered. At present, the default electrical charge for general life support means a standard Mk1 capsule has only enough electricity for about 10 hours assuming no other power usage or generation. I'd like to see that at least doubled. I know that part I can do myself by editing my config file but along with the reduced electrical cost for general life support, I'd like to see an extra electrical cost when scrubbers are activated. Not sure if that's something I can do myself by editing the config or if it's even possible with the current system.

I'll look into it for the next update.

As to what's possible, of course electric charge can be added to scrubbers. Very little of that stuff is hard coded. The only thing that is is stuff that depends on knowing if atmosphere for the current body has oxygen or not.

edit: btw, I'm surprised nobody commented on the implication that Kerbals run the microwave oven around the clock :P

Edit #2 PROGRESS!

I have the toolbar working and I have per save game persistence working.

For right now that's going to be limited to enabling/disabling the mod per save game. It's open to expansion though but right now I don't know what might go in there.

Edited by Starwaster

Share this post


Link to post
Share on other sites

Current display code


[COLOR=#009695][FONT=Menlo]if[/FONT][/COLOR][COLOR=#444444][FONT=Menlo] ([/FONT][/COLOR][COLOR=#444444][FONT=Menlo]Math[/FONT][/COLOR][COLOR=#444444][FONT=Menlo].[/FONT][/COLOR][COLOR=#444444][FONT=Menlo]Abs[/FONT][/COLOR][COLOR=#444444][FONT=Menlo]([/FONT][/COLOR][COLOR=#444444][FONT=Menlo]rate[/FONT][/COLOR][COLOR=#444444][FONT=Menlo]) < [/FONT][/COLOR][COLOR=#444444][FONT=Menlo]minValue[/FONT][/COLOR][COLOR=#444444][FONT=Menlo])[/FONT][/COLOR]
[COLOR=#444444][FONT=Menlo]{[/FONT][/COLOR]
[FONT=Menlo][COLOR=#444444] rate[/COLOR][COLOR=#444444] *= [/COLOR][/FONT][FONT=Menlo][COLOR=#f57c00]24.0f[/COLOR][/FONT][FONT=Menlo][COLOR=#444444];[/COLOR]
[COLOR=#444444] units[/COLOR][COLOR=#444444] = [/COLOR][COLOR=#f57c00]"[/COLOR][COLOR=#f57c00]day[/COLOR][COLOR=#f57c00]"[/COLOR][COLOR=#444444];[/COLOR]
[COLOR=#444444]}[/COLOR]
[/FONT]

See what I did there?


[FONT=Menlo][COLOR=#009695]if[/COLOR][COLOR=#444444] ([/COLOR][COLOR=#444444]Math[/COLOR][COLOR=#444444].[/COLOR][COLOR=#444444]Abs[/COLOR][COLOR=#444444]([/COLOR][COLOR=#444444]rate[/COLOR][COLOR=#444444]) < [/COLOR][COLOR=#444444]minValue[/COLOR][COLOR=#444444])[/COLOR]
[COLOR=#444444]{[/COLOR]
[COLOR=#444444] rate[/COLOR][COLOR=#444444] *= ([/COLOR][COLOR=#3363a4]float[/COLOR][COLOR=#444444])([/COLOR][/FONT][FONT=Menlo][COLOR=#444444]([/COLOR][COLOR=#444444]KSPUtil[/COLOR][COLOR=#444444].[/COLOR][COLOR=#444444]Day[/COLOR][COLOR=#444444]/[/COLOR][COLOR=#f57c00]3600[/COLOR][/FONT][FONT=Menlo][COLOR=#444444])[/COLOR][COLOR=#444444];[/COLOR]
[COLOR=#444444] units[/COLOR][COLOR=#444444] = [/COLOR][COLOR=#f57c00]"[/COLOR][COLOR=#f57c00]day[/COLOR][COLOR=#f57c00]"[/COLOR][COLOR=#444444];[/COLOR]
[COLOR=#444444]}[/COLOR]
[/FONT]

Edit: The Results.

Kerbin Time vs Earth Time

qF2jWRJ.png?1jz7RPDT.png?2

Edited by Starwaster

Share this post


Link to post
Share on other sites

Opinion request time

Currently I'm working on the part of the code that will disable the mod if the mod has been turned off from the Space Center via the new control button.

At this time it suspends updating for things like generators, collectors and all life support checks including death checks. I went that route instead of removing the actual modules from the parts because that would break a player's existing settings. And generally wreak havoc with persistence. What else should it do? hide the GUI? Hide GUI buttons? Anything else I'm not thinking of?

Share this post


Link to post
Share on other sites

Great news about the time display thing.

Yes, if you turn off the mod, the modules should remain but the information and buttons should all disappear.

So I've been trying to tweek the O2 consumption rates, CO2 generation rates, ElectricCharge Rate (ECR) in general and add an ECR specifically for activating the scrubber. In he process of doing all that I've noticed some strange things with the default settings. By default there is a general life support ECR of 0.00138889 which equates to 5/hr per allowable occupant. Also by default there appears to be an Air Vent ECR of -0.00005787041 which should equate to 0.208/hr per kerbal. So in space a Mk1 Command Pod should list an ECR of 5/hr and on the ground it should show 5.208/hr. That isn't the case. On the ground, every one-kerbal module shows an ECR of 5.028/hour and you get the same reading in space. So it doesn't appear that the AirVent ECR is being included. Not sure but could this be because of the automatic system? I can't test this since there isn't a way for me to manually turn the air vent on/off while in an atmosphere. Also it seems there is some phantom 0.028/hr ECR that I can't seem to trace to anywhere.

Possible oddity number two, a 2-kerbal module requires double the base ECR even if only a single Kerbal is present. This is true whether in space or in an atmosphere. So a Mk2 Lander Can uses 10.028/hr with one or two kerbals. A Mk1-2 Command Pod uses 15.028/hr with one, two or three kerbals. And a Hitchhiker Storage Container uses 20.028/hr with one, two, three or four kerbals. I'm not sure if that was intentional or not.

And oddity number three, CO2 scrubbers are turned on by default even when you're in an atmosphere. Is it possible to have them try to turn off when the air vents activate? I'd still like the ability to manually turn the scrubbers on/off, even when in an atmosphere, but if they can also automatically turn on/off based on the air vents, that would be really nice.

All that leads to the tweeks I have been trying to make. For starters, I wanted to increase O2 consumption, increase CO2 generation and reduce general ECR. I therefore changed my O2 rate to 0.0000462962 (1/6hr), my CO2 rate to -0.000324075 (7/6hr) and my ECR to 0.000231482 (5/6hr or 0.8333352/hr). I also changed the scrubber CO2 value to 10.5/6hr, the AirVent O2 rate to 1/hr, the AirVent CO2 rate to 7/hr but left the AirVent ECR at the 0.208/hr rate is uses by default. My resulting O2 consumption and CO2 generation rates appear to work just fine. And the general ECR changes seem to be working as well. My modules are using 0.833/hr per potential occupant, plus the phantom 0.028/hr. So a Mk1 cockpit uses 0.861, a Mk2 Lander Can uses 1.694, a Mk1-2 Command Pod uses 2.528 and a Hitchhiker module uses 3.361. And just like the default, this is true whether on the ground with the air vents running or in space with the air vents turned off.

So, with the above basically working (at least with all the oddities that the default settings give), I added one more tweek to my config file. I want CO2 scrubbers to use electricity so I tried adding the following code to the "ION_POD_GENERATOR" section that deals with the CO2Scrubber:

 OUTPUT_RESOURCE
{
name = ElectricCharge
rateBase = 0
ratePerCapacity = -0.000462964 //set to 10/6h
effectOnEfficiency = 0.9
}

This addition sort of works. When you turn the CO2 scrubbers on, the ElectricCharge Rate for a module changes. But the change isn't the value I intended. The ratePerCapacity I set should result in an ECR cost of 1.6666704/hr

Example 1: Mk1 Cockpit on landing pad. One kerbal capacity and occupancy. Scrubber turned off, ECR = 0.861/hr. Scrubber turned on, ECR = 1.602/hr. That means the scrubber is only costing 0.741/hr.

Example 2: Mk2 Lander Can on landing pad. Two kerbal capacity with one occupant. Scrubber turned off, ECR = 1.694/hr. Scrubber turned on, ECR = 2.065/hr. If I add a second kerbal, the ECR goes up to 3.176/hr. That's a 0.371 increase for 1 kerbal and 1.482 increase for 2 kerbals.

Example 3: Mk1-2 Command Pod on landing pad. Three kerbal capacity with one occupant. Scrubber turned off, ECR = 2.528/hr. Scrubber turned on, ECR = 2.775/hr. Add a 2nd kerbal and ECR goes up to 3.515/hr. Add a third and it's up to 4.75/hr. That means increases of 0.247, 0.987 and 2.222 respectively.

Example 4: Hitchhiker Module on landing pad. Four kerbal capacity with one occupant. Scrubber turned off, ECR = 3.361/hr. Scrubber turned on, ECR = 3.546/hr. Add a second kerbal and ECR goes up to 4.102/hr. Add a third and its up to 5.028/hr. Add a fourth and you get 6.324/hr. That means increases of 0.185, 0.741, 1.667, and 2.963 respectively.

The above are all on the landing pad so they are in an atmosphere. So technically we don't need the scrubbers in the first place. But still, I'd have expected at least a uniform increase in the ECR value. How it's calculating the ECR changes is a complete mystery to me. Though, of course, it may simply be that the mod can't currently support an electric charge associated with the scrubber. Or maybe it has something to do with how the scrubbers work in an atmosphere with the air vents running. One thing I did notice is that with or without the scrubbers going, the CarbonDioxide Rate was always 0.000/day while on the ground (which is actually to be expected).

In space it's a different matter. As soon as the air vents close, while the scrubber is running, the ECR and CO2 rates start acting eratically. What I discovered after much trial and error is, when the CO2 storage drops to 0.00 (or lower?) the CO2 rate and ECR indicators start fluctuating all over the place. But once the CO2 storage is 0.01 or higher, CO2 rate and ECR both give correct values. This only happens when there is an ECR associated with the CO2 scrubbers. Now, I know the code wasn't originally intending for a seperate scrubber electriccharge so the fluctuating ECR makes a certain kind of sense. But could you check out the scrubber portion of the code and make sure it's working as though there is always at least a tiny fraction of CO2 (say 0.001 minimum) in the tanks so that the values don't bounce around like they currently do.

Share this post


Link to post
Share on other sites
Great news about the time display thing.

Yes, if you turn off the mod, the modules should remain but the information and buttons should all disappear.

So I've been trying to tweek the O2 consumption rates, CO2 generation rates, ElectricCharge Rate (ECR) in general and add an ECR specifically for activating the scrubber. In he process of doing all that I've noticed some strange things with the default settings. By default there is a general life support ECR of 0.00138889 which equates to 5/hr per allowable occupant. Also by default there appears to be an Air Vent ECR of -0.00005787041 which should equate to 0.208/hr per kerbal. So in space a Mk1 Command Pod should list an ECR of 5/hr and on the ground it should show 5.208/hr. That isn't the case. On the ground, every one-kerbal module shows an ECR of 5.028/hour and you get the same reading in space. So it doesn't appear that the AirVent ECR is being included. Not sure but could this be because of the automatic system? I can't test this since there isn't a way for me to manually turn the air vent on/off while in an atmosphere. Also it seems there is some phantom 0.028/hr ECR that I can't seem to trace to anywhere.

Possible oddity number two, a 2-kerbal module requires double the base ECR even if only a single Kerbal is present. This is true whether in space or in an atmosphere. So a Mk2 Lander Can uses 10.028/hr with one or two kerbals. A Mk1-2 Command Pod uses 15.028/hr with one, two or three kerbals. And a Hitchhiker Storage Container uses 20.028/hr with one, two, three or four kerbals. I'm not sure if that was intentional or not.

And oddity number three, CO2 scrubbers are turned on by default even when you're in an atmosphere. Is it possible to have them try to turn off when the air vents activate? I'd still like the ability to manually turn the scrubbers on/off, even when in an atmosphere, but if they can also automatically turn on/off based on the air vents, that would be really nice.

All that leads to the tweeks I have been trying to make. For starters, I wanted to increase O2 consumption, increase CO2 generation and reduce general ECR. I therefore changed my O2 rate to 0.0000462962 (1/6hr), my CO2 rate to -0.000324075 (7/6hr) and my ECR to 0.000231482 (5/6hr or 0.8333352/hr). I also changed the scrubber CO2 value to 10.5/6hr, the AirVent O2 rate to 1/hr, the AirVent CO2 rate to 7/hr but left the AirVent ECR at the 0.208/hr rate is uses by default. My resulting O2 consumption and CO2 generation rates appear to work just fine. And the general ECR changes seem to be working as well. My modules are using 0.833/hr per potential occupant, plus the phantom 0.028/hr. So a Mk1 cockpit uses 0.861, a Mk2 Lander Can uses 1.694, a Mk1-2 Command Pod uses 2.528 and a Hitchhiker module uses 3.361. And just like the default, this is true whether on the ground with the air vents running or in space with the air vents turned off.

So, with the above basically working (at least with all the oddities that the default settings give), I added one more tweek to my config file. I want CO2 scrubbers to use electricity so I tried adding the following code to the "ION_POD_GENERATOR" section that deals with the CO2Scrubber:

 OUTPUT_RESOURCE
{
name = ElectricCharge
rateBase = 0
ratePerCapacity = -0.000462964 //set to 10/6h
effectOnEfficiency = 0.9
}

This addition sort of works. When you turn the CO2 scrubbers on, the ElectricCharge Rate for a module changes. But the change isn't the value I intended. The ratePerCapacity I set should result in an ECR cost of 1.6666704/hr

Example 1: Mk1 Cockpit on landing pad. One kerbal capacity and occupancy. Scrubber turned off, ECR = 0.861/hr. Scrubber turned on, ECR = 1.602/hr. That means the scrubber is only costing 0.741/hr.

Example 2: Mk2 Lander Can on landing pad. Two kerbal capacity with one occupant. Scrubber turned off, ECR = 1.694/hr. Scrubber turned on, ECR = 2.065/hr. If I add a second kerbal, the ECR goes up to 3.176/hr. That's a 0.371 increase for 1 kerbal and 1.482 increase for 2 kerbals.

Example 3: Mk1-2 Command Pod on landing pad. Three kerbal capacity with one occupant. Scrubber turned off, ECR = 2.528/hr. Scrubber turned on, ECR = 2.775/hr. Add a 2nd kerbal and ECR goes up to 3.515/hr. Add a third and it's up to 4.75/hr. That means increases of 0.247, 0.987 and 2.222 respectively.

Example 4: Hitchhiker Module on landing pad. Four kerbal capacity with one occupant. Scrubber turned off, ECR = 3.361/hr. Scrubber turned on, ECR = 3.546/hr. Add a second kerbal and ECR goes up to 4.102/hr. Add a third and its up to 5.028/hr. Add a fourth and you get 6.324/hr. That means increases of 0.185, 0.741, 1.667, and 2.963 respectively.

The above are all on the landing pad so they are in an atmosphere. So technically we don't need the scrubbers in the first place. But still, I'd have expected at least a uniform increase in the ECR value. How it's calculating the ECR changes is a complete mystery to me. Though, of course, it may simply be that the mod can't currently support an electric charge associated with the scrubber. Or maybe it has something to do with how the scrubbers work in an atmosphere with the air vents running. One thing I did notice is that with or without the scrubbers going, the CarbonDioxide Rate was always 0.000/day while on the ground (which is actually to be expected).

In space it's a different matter. As soon as the air vents close, while the scrubber is running, the ECR and CO2 rates start acting eratically. What I discovered after much trial and error is, when the CO2 storage drops to 0.00 (or lower?) the CO2 rate and ECR indicators start fluctuating all over the place. But once the CO2 storage is 0.01 or higher, CO2 rate and ECR both give correct values. This only happens when there is an ECR associated with the CO2 scrubbers. Now, I know the code wasn't originally intending for a seperate scrubber electriccharge so the fluctuating ECR makes a certain kind of sense. But could you check out the scrubber portion of the code and make sure it's working as though there is always at least a tiny fraction of CO2 (say 0.001 minimum) in the tanks so that the values don't bounce around like they currently do.

Eek ok lots of stuff here. I'll go over it more thoroughly in a bit but I'll address one thing now. ratePerCapacity is independent of how many Kerbals there are. It's based on how many Kerbals the part can hold. If the part has a capacity of 4 then the resource drain is always x4 even if only one Kerbal is there.

Share this post


Link to post
Share on other sites
Eek ok lots of stuff here. I'll go over it more thoroughly in a bit but I'll address one thing now. ratePerCapacity is independent of how many Kerbals there are. It's based on how many Kerbals the part can hold. If the part has a capacity of 4 then the resource drain is always x4 even if only one Kerbal is there.

Oh, I figured that was why the Hitchhiker (for example) used 20.028 even with only a single kerbal. My point was, I wasn't sure if that was the intended result. I.E., should a 4-kerbal module really use the same amount of power to run the life support for a single kerbal as it uses for four kerbals? If so, then that part is fine. I just thought it was a bit weird that we'd be running circulation pumps and air scrubbers, and heaters/coolers (and the microwave for snacks, of course) at the same rate when only a single kerbal was present. Especially when you start building larger ships or stations with multiple crew modules. I could see building a ship with a Command Pod, MPL and a hitchhiker module but only intending to ever have 4 kerbals on board. Seems like a waste to power life support for 7 kerbals when only 4 are present. That said, I'm not complaining about it. I just thought it was weird and wanted to make sure it was intended. :) I can always use ratePerKerbal for the scrubbers and leave general life support with ratePerCapacity.

Share this post


Link to post
Share on other sites
Oh, I figured that was why the Hitchhiker (for example) used 20.028 even with only a single kerbal. My point was, I wasn't sure if that was the intended result. I.E., should a 4-kerbal module really use the same amount of power to run the life support for a single kerbal as it uses for four kerbals? If so, then that part is fine. I just thought it was a bit weird that we'd be running circulation pumps and air scrubbers, and heaters/coolers (and the microwave for snacks, of course) at the same rate when only a single kerbal was present. Especially when you start building larger ships or stations with multiple crew modules. I could see building a ship with a Command Pod, MPL and a hitchhiker module but only intending to ever have 4 kerbals on board. Seems like a waste to power life support for 7 kerbals when only 4 are present. That said, I'm not complaining about it. I just thought it was weird and wanted to make sure it was intended. :) I can always use ratePerKerbal for the scrubbers and leave general life support with ratePerCapacity.

Yes, it should, because heating, air circulation, etc depend on volume of the crew area.

And of course, a lone Kerbal will increase snack consumption in the absence of his comrades so the microwave usage remains constant as well ;)

As for scrubbers, you could argue it either way

  • The fans have to run at the same capacity even not all crew slots are manned - use ratePerCapacity
  • The fans are run at reduced capacity to save power - use ratePerKerbal

I think I lean towards the latter and if I give scrubbers an EC cost then I'll likely use ratePerKerbal - The scrubber system could easily be smart enough to increase / decrease fan speed and duty cycle based on the amount of detected CO2. Yeah, I'd buy that.

In other news, slow progress on the update today as I am looking at adding another feature to this update and am having to muddle through some unknown territory in the KSP API. If I can get it in then it should be pretty cool...

Share this post


Link to post
Share on other sites
Eek ok lots of stuff here. I'll go over it more thoroughly in a bit but I'll address one thing now. ratePerCapacity is independent of how many Kerbals there are. It's based on how many Kerbals the part can hold. If the part has a capacity of 4 then the resource drain is always x4 even if only one Kerbal is there.

I do tend to provide a lot of detail. Let me see if I can explain my huge post in fewer words.

1) There is an extra 0.28/hr ElectricCharge that doesn't seem to be related to anything in IonCross.

2) The ElectricCharge for operating the Air Vents is not being applied.

3) ratePerCapacity vs ratePerKerbal, which you've already explained

4) Can the scrubbers be set to default on/off based on the air vents?

5) If you add an ElectricCharge to the scrubbers, you get some odd results while in an atmosphere. Any clue as to why?

6) If you add an ElectricCharge to the scrubbers, when you're in space the ECR and CO2 display values go nuts when the available CO2 is 0.00 or less. Can that be fixed?

Share this post


Link to post
Share on other sites
I do tend to provide a lot of detail. Let me see if I can explain my huge post in fewer words.

1) There is an extra 0.28/hr ElectricCharge that doesn't seem to be related to anything in IonCross.

2) The ElectricCharge for operating the Air Vents is not being applied.

3) ratePerCapacity vs ratePerKerbal, which you've already explained

4) Can the scrubbers be set to default on/off based on the air vents?

5) If you add an ElectricCharge to the scrubbers, you get some odd results while in an atmosphere. Any clue as to why?

6) If you add an ElectricCharge to the scrubbers, when you're in space the ECR and CO2 display values go nuts when the available CO2 is 0.00 or less. Can that be fixed?

  1. You're probably seeing rateBase = 0.00277778. All resource modifications are rateBase + (ratePerKerbal * number of kerbals) + (ratePerCapacity * number of available crew slots). For a given part
  2. I'll look into it; last time I checked it was being applied...
  3. ...
  4. I don't think so currently; I'll have to look at the resource logic and see how and where that could get implemented. Probably not going to happen this round of updates. (unless I look at it and say "Oh of course, that's easy")
  5. Need to see your config and need more explanation of 'odd results'
  6. Same. Can't answer until I know how they're going nuts. Your configs would be useful to look at
  7. Does Tim Roth EVER play a nice / good guy?

Share this post


Link to post
Share on other sites

  1. You're probably seeing rateBase = 0.00277778. All resource modifications are rateBase + (ratePerKerbal * number of kerbals) + (ratePerCapacity * number of available crew slots). For a given part
  2. I'll look into it; last time I checked it was being applied...
  3. ...
  4. I don't think so currently; I'll have to look at the resource logic and see how and where that could get implemented. Probably not going to happen this round of updates. (unless I look at it and say "Oh of course, that's easy")
  5. Need to see your config and need more explanation of 'odd results'
  6. Same. Can't answer until I know how they're going nuts. Your configs would be useful to look at
  7. Does Tim Roth EVER play a nice / good guy?

1. Sorry. I meant 0.028/hr. And yeah, it is rateBase. Tried removing that line and the 0.028 charge was gone. Not exactly sure how 0.00277778 (which should work out to 10/h) is adding up to .028, though. It's like rateBase is only counted 10 times per hour (0.00277778 * 10 = 0.0277778 which rounds to 0.028).

5.

ION_SUPPORT_RESOURCE
{
name = Oxygen
GUIName = 02
ratePerKerbal = 0.0000462962 //set to 1/6h

causeDeath = True
killRollInterval = 3600
killChance = 0.1

evaAmount = 1
evaMaxAmount = 1
}

ION_SUPPORT_RESOURCE
{
name = CarbonDioxide
GUIName = CO2
ratePerKerbal = -0.000324075 //set to 7/6h

causeDeath = True
killRollInterval = 600
killChance = 0.1
}
ION_SUPPORT_RESOURCE
{
name = ElectricCharge
GUIName = Electricity
rateBase = 0.00277778
ratePerCapacity = 0.000231482 //set to 5/6h

causeLock = True
}
ION_POD_GENERATOR
{
generatorName = CO2Scrubber
generatorGUIName = Scrubber

startOn = True

hideStatusL2 = True
hideEfficency = True
hideOutputControls = True

OUTPUT_RESOURCE
{
name = CarbonDioxide
rateBase = 0
ratePerCapacity = -0.000486111 //set to 10.5/6h
effectOnEfficency = 1
}
OUTPUT_RESOURCE
{
name = ElectricCharge
rateBase = 0
ratePerCapacity = -0.000462964 //set to 10/6h
effectOnEfficiency = 0.9
}
}
ION_POD_COLLECTOR
{
generatorName = AtmoVents
generatorGUIName = Air Vents

minAtmosphere = 0.5
isAutomaticOxygen = True

hideStatusL2 = True
hideEfficency = True
hideOutputControls = True
hideAtmoContents = True

OUTPUT_RESOURCE_OXYGEN
{
name = Oxygen
rateBase = 0
ratePerCapacity = 0.000277778 //set to 1/h
effectOnEfficency = 0
}
OUTPUT_RESOURCE_OXYGEN
{
name = CarbonDioxide
rateBase = 0
ratePerCapacity = -0.001944444 //set to 7/h
effectOnEfficency = 0
}
OUTPUT_RESOURCE
{
name = ElectricCharge
rateBase = 0
ratePerCapacity = -0.00005787041 //set to 1.75/6h
effectOnEfficiency = 0.9
}
}

As for an explanation of "odd results", look at the four examples I included in my post from August 9th. I'll repost example 3 here.

Example 3: Mk1-2 Command Pod on landing pad. Three kerbal capacity with one occupant. Scrubber turned off, ECR = 2.528/hr. Scrubber turned on, ECR = 2.775/hr. Add a 2nd kerbal and ECR goes up to 3.515/hr. Add a third and it's up to 4.75/hr. That means increases of 0.247, 0.987 and 2.222 respectively.

Basically, instead of charging 1.667/occupant (so 5.0 in the above example) regardless of number of occupants (since I used ratePerCapacity), it's charging based on the number of kerbals present. And the amount charged per kerbal is odd..... 0.247 for one kerbal, +0.74 for the second and +1.235 for the third. And at no point is the full, expected 5.0 every charged. This may well be because of the 0.00 CO2 in storage, but it still seemed strange that more kerbals meant more electric charge when I'm using ratePerCapacity in my test config.

6. Going nuts as in fluctuating so much that I can't tell you exactly what value is being used. The fluctuation stops once CO2 in the tank goes above 0.01 so I know it's a calculation issue. I'll try to upload some screen shot fragments later if that would help.

Share this post


Link to post
Share on other sites
1. Sorry. I meant 0.028/hr. And yeah, it is rateBase. Tried removing that line and the 0.028 charge was gone. Not exactly sure how 0.00277778 (which should work out to 10/h) is adding up to .028, though. It's like rateBase is only counted 10 times per hour (0.00277778 * 10 = 0.0277778 which rounds to 0.028).

5.


{
name = Oxygen
GUIName = 02
ratePerKerbal = 0.0000462962 //set to 1/6h

causeDeath = True
killRollInterval = 3600
killChance = 0.1

evaAmount = 1
evaMaxAmount = 1
}

ION_SUPPORT_RESOURCE
{
name = CarbonDioxide
GUIName = CO2
ratePerKerbal = -0.000324075 //set to 7/6h

causeDeath = True
killRollInterval = 600
killChance = 0.1
}
ION_SUPPORT_RESOURCE
{
name = ElectricCharge
GUIName = Electricity
rateBase = 0.00277778
ratePerCapacity = 0.000231482 //set to 5/6h

causeLock = True
}
ION_POD_GENERATOR
{
generatorName = CO2Scrubber
generatorGUIName = Scrubber

startOn = True

hideStatusL2 = True
hideEfficency = True
hideOutputControls = True

OUTPUT_RESOURCE
{
name = CarbonDioxide
rateBase = 0
ratePerCapacity = -0.000486111 //set to 10.5/6h
effectOnEfficency = 1
}
OUTPUT_RESOURCE
{
name = ElectricCharge
rateBase = 0
ratePerCapacity = -0.000462964 //set to 10/6h
effectOnEfficiency = 0.9
}
}
ION_POD_COLLECTOR
{
generatorName = AtmoVents
generatorGUIName = Air Vents

minAtmosphere = 0.5
isAutomaticOxygen = True

hideStatusL2 = True
hideEfficency = True
hideOutputControls = True
hideAtmoContents = True

OUTPUT_RESOURCE_OXYGEN
{
name = Oxygen
rateBase = 0
ratePerCapacity = 0.000277778 //set to 1/h
effectOnEfficency = 0
}
OUTPUT_RESOURCE_OXYGEN
{
name = CarbonDioxide
rateBase = 0
ratePerCapacity = -0.001944444 //set to 7/h
effectOnEfficency = 0
}
OUTPUT_RESOURCE
{
name = ElectricCharge
rateBase = 0
ratePerCapacity = -0.00005787041 //set to 1.75/6h
effectOnEfficiency = 0.9
}
}
ION_SUPPORT_RESOURCE

As for an explanation of "odd results", look at the four examples I included in my post from August 9th. I'll repost example 3 here.

Example 3: Mk1-2 Command Pod on landing pad. Three kerbal capacity with one occupant. Scrubber turned off, ECR = 2.528/hr. Scrubber turned on, ECR = 2.775/hr. Add a 2nd kerbal and ECR goes up to 3.515/hr. Add a third and it's up to 4.75/hr. That means increases of 0.247, 0.987 and 2.222 respectively.

Basically, instead of charging 1.667/occupant (so 5.0 in the above example) regardless of number of occupants (since I used ratePerCapacity), it's charging based on the number of kerbals present. And the amount charged per kerbal is odd..... 0.247 for one kerbal, +0.74 for the second and +1.235 for the third. And at no point is the full, expected 5.0 every charged. This may well be because of the 0.00 CO2 in storage, but it still seemed strange that more kerbals meant more electric charge when I'm using ratePerCapacity in my test config.

6. Going nuts as in fluctuating so much that I can't tell you exactly what value is being used. The fluctuation stops once CO2 in the tank goes above 0.01 so I know it's a calculation issue. I'll try to upload some screen shot fragments later if that would help.

I'm not really seeing how, but it's possible that positive amounts of ElectricCharge are being generated. If that's so then the actual drain would be less than the expected drain. But that's an awful lot of net positive generation for that to be the case.

In general I'm thinking the behavior you're seeing is interaction with the atmospheric vents and some of it is probably natural but there's too much that's unnatural in what you're describing. I'm going to plug that config in and see what I get.

Some other general thoughts: ION_SUPPORT_RESOURCE nodes are ALWAYS inputs so to have drains there has to be negative values, so that's natural there. But the generators and collectors also accept INPUT_RESOURCE and I'm not sure why they were originally set up as OUTPUT_RESOURCE, all of them. To my way of thinking, CO2 should have been set up as an input, but it wasn't, and when I added the electric charge to the atmo vents, I just followed the example before me, and I'm not sure that was good.

I should have looked into doing CO2 as an input and I should have investigated the full effect of 'effectOnEfficency'. Looking at the code, having CO2 with a value of 0 for that field on an OUTPUT_RESOURCE should kill all OUTPUT_RESOURCE for that generator.

It should be 1 and probably should also be an INPUT (with a positive value instead of negative). So I'm going to try changing those and see what it does but I won't be able to for awhile, later today.

Edit: Oh, also, make sure you only have one file with any of those configs in. For instance, either edit the original or delete it and replace with something else, but don't have two config files with the base settings in it because it will apply them all.

Edit #2: Also, about the 'per Kerbal' charge; it's not that it's literally applying the charge per Kerbal because there is no such charge defined. It's what I mentioned above that the lack of CO2 is halting (or slowing) generation

Edited by Starwaster

Share this post


Link to post
Share on other sites

Yeah, I only have the one config. I have notes on the various changes I'm playing with and I just put those changes in effect, try them out, then revert back to the original file when I'm done testing.

I noticed that the ION_POD_COLLECTOR section, we've got "OUTPUT_RESOURCE_OXYGEN" for both O2 and CO2. Should they be the same for those two resources and what's the difference between "OUTPUT_RESOURCE" and "OUTPUT_RESOURCE_OXYGEN"?

Anyway, I've been running some tests:

with regards to effectOnEfficency in the air vents section-

When set to 0, the air vents will continue to run even after all electricity is gone. Also, the O2 and CO2 values don't constantly change. O2 will slowly increase to max based on the ratePerCapacity value that's been set. And CO2 will slowly decrease to 0, again based on the ratePerCapacity setting. As far as I can tell, you're still using O2 and generating CO2, but both are being cleaned to the point where no change is made to the storage tanks.

When set to 1, the air vents will stop working when you run out of electricity. However, O2 and CO2 fluctuate constantly. Both the rate that is displayed in game and what's actually stored in the tanks according to the savegame file. O2 will use the ratePerCapacity value to increase up to just shy of storage capacity, but it will never reach full capacity. It's always something like 0.000001 shy and is always in flux. In fact, it almost seems as though you use O2 until it's dropped to a certain level (something like 19.999990 with mk1 command pod), then the air vents increase what's in the tank (possible to full 20.0) and then you start using it again. Same with CO2 (in reverse, of course). The amounts are miniscule so you don't really see them in game but it explains why the O2 and CO2 rate values are constantly in flux.

For giggles, I tried setting effectOnEfficency = 0.1 but got the same basic results that effectOnEfficency = 0 give.

Next, I tried a bunch of different things and was in the process or writting a book again but then things just started to gell for me and I figured it would just be easier if I posted the config file I ended up with and noted the various changes.

 
ION_SUPPORT_RESOURCE
{
name = Oxygen
GUIName = 02
ratePerKerbal = 0.0000462962 //set to 1/6h

causeDeath = True
killRollInterval = 3600
killChance = 0.1

evaAmount = 1
evaMaxAmount = 1
}

ION_SUPPORT_RESOURCE
{
name = CarbonDioxide
GUIName = CO2
ratePerKerbal = -0.000324075 //set to 7/6h

causeDeath = True
killRollInterval = 600
killChance = 0.1
}
ION_SUPPORT_RESOURCE
{
name = ElectricCharge
GUIName = Electricity
rateBase = 0.00277778
ratePerCapacity = 0.000231482 //set to 5/6h

causeLock = True
}
ION_POD_GENERATOR
{
generatorName = CO2Scrubber
generatorGUIName = Scrubber

startOn = True

hideStatusL2 = True
hideEfficency = True
hideOutputControls = True

INPUT_RESOURCE
{
name = CarbonDioxide
rateBase = 0
ratePerKerbal = 0.000486111 //set to 10.5/6h
effectOnEfficency = 0
}
INPUT_RESOURCE
{
name = ElectricCharge
rateBase = 0
ratePerKerbal = 0.000462964 //set to 10/6h
effectOnEfficiency = 0.9
}
}
ION_POD_COLLECTOR
{
generatorName = AtmoVents
generatorGUIName = Air Vents

minAtmosphere = 0.5
isAutomaticOxygen = True

hideStatusL2 = True
hideEfficency = True
hideOutputControls = True
hideAtmoContents = True

OUTPUT_RESOURCE_OXYGEN
{
name = Oxygen
rateBase = 0
ratePerCapacity = 0.000277778 //set to 1/h
effectOnEfficency = 0
}
INPUT_RESOURCE
{
name = CarbonDioxide
rateBase = 0
ratePerCapacity = 0.001944444 //set to 7/h
effectOnEfficency = 0
}
INPUT_RESOURCE
{
name = ElectricCharge
rateBase = 0
ratePerCapacity = 0.00005787041 //set to 1.75/6h
effectOnEfficiency = 0.9
}
}

Obviously the numbers used are based on the usage rates I've been aiming for so disregard them. What important about this is:

Changing the ECR of the air vents to a INPUT_RESOURCE results in the electricCharge for air vents being displayed and applied. Now if I run the capsule out of power, the air vents stop working.

Setting the effectOnEfficency = 0 for CO2 on the scrubbers stops the wildely fluctuating CO2 and ECR rates I was seeing before.

I'm stilling seeing the "phantom" 0.028/hour electricCharge. I know it's from the rateBase but I still can't figure out how "rateBase = 0.00277778" works out to 0.028/hour of ECR.

Changing CO2 and EC on both the scrubber and air vents into INPUT_RESOURCE seems to have resolved the strange math I was seeing when air vents were running. THough maybe that is becuase I'm using ratePerKerbal for scrubbers. But either way, I'm seeing good numbers now.

With air vents, without air vents, with scrubbers, without scrubbers, with "full" tanks and without, all my expected numbers are lining up with what I am expecting. Still have a bit more testing to do, but this is a good step in the right direction. :)

Share this post


Link to post
Share on other sites
Yeah, I only have the one config. I have notes on the various changes I'm playing with and I just put those changes in effect, try them out, then revert back to the original file when I'm done testing.

I noticed that the ION_POD_COLLECTOR section, we've got "OUTPUT_RESOURCE_OXYGEN" for both O2 and CO2. Should they be the same for those two resources and what's the difference between "OUTPUT_RESOURCE" and "OUTPUT_RESOURCE_OXYGEN"?

OUTPUT_RESOURCE_OXYGEN (Kerbin / Laythe) is used when the part is in an oxygen atmosphere. You can also use OUTPUT_RESOURCE_NO_OXYGEN (Duna, Eve, etc) for planets with no oxygen (or low oxygen. KSP has fields for the planets that determine whether they have oxygen or not.

The collector extends Ioncross's version of the generator.

There are other fields it has like requiresWater / requiresLand.

Anyway, I've been running some tests:

with regards to effectOnEfficency in the air vents section-

When set to 0, the air vents will continue to run even after all electricity is gone. Also, the O2 and CO2 values don't constantly change. O2 will slowly increase to max based on the ratePerCapacity value that's been set. And CO2 will slowly decrease to 0, again based on the ratePerCapacity setting. As far as I can tell, you're still using O2 and generating CO2, but both are being cleaned to the point where no change is made to the storage tanks.

When set to 1, the air vents will stop working when you run out of electricity. However, O2 and CO2 fluctuate constantly. Both the rate that is displayed in game and what's actually stored in the tanks according to the savegame file. O2 will use the ratePerCapacity value to increase up to just shy of storage capacity, but it will never reach full capacity. It's always something like 0.000001 shy and is always in flux. In fact, it almost seems as though you use O2 until it's dropped to a certain level (something like 19.999990 with mk1 command pod), then the air vents increase what's in the tank (possible to full 20.0) and then you start using it again. Same with CO2 (in reverse, of course). The amounts are miniscule so you don't really see them in game but it explains why the O2 and CO2 rate values are constantly in flux.

For giggles, I tried setting effectOnEfficency = 0.1 but got the same basic results that effectOnEfficency = 0 give.

Next, I tried a bunch of different things and was in the process or writting a book again but then things just started to gell for me and I figured it would just be easier if I posted the config file I ended up with and noted the various changes.

Obviously the numbers used are based on the usage rates I've been aiming for so disregard them. What important about this is:

Changing the ECR of the air vents to a INPUT_RESOURCE results in the electricCharge for air vents being displayed and applied. Now if I run the capsule out of power, the air vents stop working.

Setting the effectOnEfficency = 0 for CO2 on the scrubbers stops the wildely fluctuating CO2 and ECR rates I was seeing before.

I'm stilling seeing the "phantom" 0.028/hour electricCharge. I know it's from the rateBase but I still can't figure out how "rateBase = 0.00277778" works out to 0.028/hour of ECR.

Changing CO2 and EC on both the scrubber and air vents into INPUT_RESOURCE seems to have resolved the strange math I was seeing when air vents were running. THough maybe that is becuase I'm using ratePerKerbal for scrubbers. But either way, I'm seeing good numbers now.

With air vents, without air vents, with scrubbers, without scrubbers, with "full" tanks and without, all my expected numbers are lining up with what I am expecting. Still have a bit more testing to do, but this is a good step in the right direction. :)

I likewise had better results testing with INPUT_RESOURCE instead of OUTPUT_RESOURCE for things that were logically INPUTs. One difference between the two is that setting effectOnEfficency on an input affects the outputs which is as it should be. The problems seem to start because setting the same on an output affects ALL outputs which can effectively stop the generator from generating. effectOnEfficency is a multiplier for the generator when it can't process an input/output resource. It should probably not be less than 1 for an output. And it probably also adds up if it comes into play on multiple inputs. And, this next part would be really bad, but I think it might be cumulative between frames.

One thing that you aren't seeing in your tests is the effect on the efficiency rating (hideEfficency = true). What I saw when I disabled that was that efficiency on the scrubbers never rose above 78% and was usually lower. Something similar might be happening on the base LSS section which might be why rateBase is so unusually low. I still don't know what the actual cause is though.

Share this post


Link to post
Share on other sites

Will the fact that I replaced an OUTPUT_RESOURCE_OXYGEN value in the air vents section with an INPUT_RESOURCE (specifically the section for CO2) have an impact that I'm not able to see yet? Like if I landed on a planet with an atmosphere but not oxygen? Is there an "INPUT_RESOURCE_OXYGEN" tag I should use instead?

As for effectOnefficency, that's probably why O2 and CO2 both have values of 0 but things still work. They would function less effeciently when power was low, but high O2/CO2 wouldn't really effect the other. And it also explains my fluctuating values since a low CO2 for the scrubbers was trying to make the system use less power.

Share this post


Link to post
Share on other sites
Will the fact that I replaced an OUTPUT_RESOURCE_OXYGEN value in the air vents section with an INPUT_RESOURCE (specifically the section for CO2) have an impact that I'm not able to see yet? Like if I landed on a planet with an atmosphere but not oxygen? Is there an "INPUT_RESOURCE_OXYGEN" tag I should use instead?

There is no equivalent for inputs. The impact is that your vents will suck CO2 out even if the outside air is full of CO2. (well not literally; KSP only knows oxygen or no oxygen. But the intent of the original configuration is that air vents are only useful on a planet that is moderately like Kerbin.

As for effectOnefficency, that's probably why O2 and CO2 both have values of 0 but things still work. They would function less effeciently when power was low, but high O2/CO2 wouldn't really effect the other. And it also explains my fluctuating values since a low CO2 for the scrubbers was trying to make the system use less power.

Most likely, yes.

Share this post


Link to post
Share on other sites

Running various tests with different rate values on ION_SUPPORT_RESOURCE

with no other EC set anywhere, I set rateBase to 1 (1 per second) and got exactly the results that I should have got.

1 per sec

60 per min

3600 per hour

Then set

rateBase = 1

ratePerKerbal = 1

ratePerCapacity = 1

resulting in triple the above reported rates.

Will try tomorrow sticking some EC back in other areas

Share this post


Link to post
Share on other sites

Closing the books on any resource display issues. Maybe I can go back and improve things later, but I have to conclude right now that anything chrisl was seeing was just a display issue. Crewed (and other Ioncross parts) are consuming the correct amounts. However, the resource display can reflect net changes no matter what the source, including external non-Ioncross sources. It might not do it for all displayed data but it definitely does it for the base LSS modules (that is, non-generator / non-collector).

I'll change the base configuration to use INPUT* where it makes sense instead of OUTPUT*

Time to get back to actual development.

(Clarification Edit: I shouldn't say it's just a display issue since it does reflect actual resource changes, but it doesn't represent incorrect resource drain/generation in the mod)

Edited by Starwaster

Share this post


Link to post
Share on other sites

I'm not trying to be argumentative here, and I appologize for all the screen shots and the length of this post, but this is definitely not a display issue. Just to be absolutely sure, I removed all the mods I have and just installed a clean copy of ioncross 1.16.3. Here is the config file I'm using:

ION_SUPPORT_RESOURCE
{
name = Oxygen
GUIName = 02
ratePerKerbal = 0.0000028935

causeDeath = True
killRollInterval = 3600
killChance = 0.1

evaAmount = 1
evaMaxAmount = 1
}

ION_SUPPORT_RESOURCE
{
name = CarbonDioxide
GUIName = CO2
ratePerKerbal = -0.0000021039

causeDeath = True
killRollInterval = 600
killChance = 0.1
}
ION_SUPPORT_RESOURCE
{
name = ElectricCharge
GUIName = Electricity
rateBase = 0.00277778
ratePerCapacity = 0.00138889

causeLock = True
}
ION_POD_GENERATOR
{
generatorName = CO2Scrubber
generatorGUIName = Scrubber

startOn = True

hideStatusL2 = True
hideEfficency = True
hideOutputControls = True

OUTPUT_RESOURCE
{
name = CarbonDioxide
rateBase = 0
ratePerCapacity = -0.0000031558
effectOnEfficency = 1
}
}
ION_POD_COLLECTOR
{
generatorName = AtmoVents
generatorGUIName = Air Vents

minAtmosphere = 0.5
isAutomaticOxygen = True

hideStatusL2 = True
hideEfficency = True
hideOutputControls = True
hideAtmoContents = True

OUTPUT_RESOURCE_OXYGEN
{
name = Oxygen
rateBase = 0
ratePerCapacity = 0.000069444
effectOnEfficency = 0
}
OUTPUT_RESOURCE_OXYGEN
{
name = CarbonDioxide
rateBase = 0
ratePerCapacity = -0.0000504936
effectOnEfficency = 0
}
OUTPUT_RESOURCE
{
name = ElectricCharge
rateBase = 0
ratePerCapacity = -0.00005787041
effectOnEfficiency = 0.9
}
}

Notice that this is the default config file that comes with the 1.16.3 download. According to it, there is a base electricCharge of "rateBase = 0.00277778" (which is 10.000/hour), a per capacity electricCharge of "ratePerCapacity = 0.00138889" (which is 5.000/hour/capacity) and a per capacity electricCharge for running the air vents of "ratePerCapacity = -0.00005787041" (which is .208/hour/capacity). Put that altogether and a Mk1 Command Pod (capacity 1, occupancy 1), sitting on the launch pad, should have an electric charge of 15.208/hour.

As you can see in the following screen shot, I've put together a very simple ship with a Mk1 Command Pod and just enough fuel/engine to get into orbit. There's no extra battery or solar panels included. Notice that the displayed information says I'm going to be charged 5.028/hr.9A120857A6D057FC3FDD8881A0391E95BA8FBAF3

Now, from this one screen shot, it's possible that all I'm seeing is a display issue. Maybe it sayd 5.028/hour but it's really gong to charge me the correct 15.208 for an hour. Unfortunately, if I advance time by one hour, you can see that isn't the case:

1CAE67708630A9205674EDC04E40FB3C14C79D73

Please notice that the time in the first screen shot is "Y1, D01, 0:00:10" and I'm showing 49.99 of 50.42 available electrical charge. In the second screen shot the time is "Y1, D01, 1:00:18" and I'm showing 44.95 of 50.42 available electrical charge. That means in 1 hour, 8 seconds of time, I used 5.04ec which is basically what the information panel is saying I'm going to use in that amount of time. So I'm charged exactly what the display says I should be charged, so it's definitely not a display problem. But according to the config file, I should have been charged about three times as much.

Now, from previoud tests, I know three things for certain:

1) The displayed electricCharge rate of 5.028/hour does not include the electricCharge for the air vents and, in fact, air vents are not costing electricity to run

2) Of the displayed electricCharge Rate of 5.028/hour, the .028 is from the "rateBase = 0.00277778"

3) Of the displayed electricCharge Rate of 5.028/hour, the 5 is from the "ratePerCapacity = 0.00138889" line and if you use a larger command module, this cose will increase correctly

I know the above are facts from all the tests I've run in the past, but I can easily prove it. The first fact is simply to prove with the default config. As you can see in both of the above screen shots, the air vents are running. If an electricCharge was being applied, then advancing the clock by 26 kerbal days should result in either Jeb dying from lack of oxygen or (at the very least) the available O2 being reduced by at least 25 kerbal days (8.25 real days). Instead, as this third screen shot shows, no Oxygen was used and Jeb is alive and well.A3720BE3B62A5D111822C210ED259A0B318F67D0

There's one other way you can prove that the air vents are running even without electricity. Create the ship I have and put it on the launch pad. Hit F5 to create a quicksave, then tab out of he game and edit that quicksave file. Find the Oxygen and CarbonDioxide resources for your command pod and change the "amount = " value to 5 for each. Tab back into the game and hold F9 to load your quicksave game. You'll notice that the O2 and CO2 tanks should now have 5 units in each. Now, advance time to day 26 and notice that the entire time you'll be losing CO2 and gaining O2.

As for fact 2, that I can only prove by editing the config file. If I edit the config file and remove the "rateBase = 0.00277778", when I go back into the game it will display "ElectricCharge Rate: 5.000/hour".

Fact 3 is easily proved by using a larger command module. If you use a Mk1-2 Coomand Pod (capacity 3) the display will show 15.028/hour (with the default config).

Now, fact 1 I can easily fix. If I change the air vent electicCharge to an INPUT_RESOURCE (with a positive ratePerCapacity), the air vents will start using ec. Here is the edited config I'm using to correct the issue seen in fact 1:

ION_SUPPORT_RESOURCE
{
name = Oxygen
GUIName = 02
ratePerKerbal = 0.0000028935

causeDeath = True
killRollInterval = 3600
killChance = 0.1

evaAmount = 1
evaMaxAmount = 1
}

ION_SUPPORT_RESOURCE
{
name = CarbonDioxide
GUIName = CO2
ratePerKerbal = -0.0000021039

causeDeath = True
killRollInterval = 600
killChance = 0.1
}
ION_SUPPORT_RESOURCE
{
name = ElectricCharge
GUIName = Electricity
rateBase = 0.00277778
ratePerCapacity = 0.00138889

causeLock = True
}
ION_POD_GENERATOR
{
generatorName = CO2Scrubber
generatorGUIName = Scrubber

startOn = True

hideStatusL2 = True
hideEfficency = True
hideOutputControls = True

OUTPUT_RESOURCE
{
name = CarbonDioxide
rateBase = 0
ratePerCapacity = -0.0000031558
effectOnEfficency = 1
}
}
ION_POD_COLLECTOR
{
generatorName = AtmoVents
generatorGUIName = Air Vents

minAtmosphere = 0.5
isAutomaticOxygen = True

hideStatusL2 = True
hideEfficency = True
hideOutputControls = True
hideAtmoContents = True

OUTPUT_RESOURCE_OXYGEN
{
name = Oxygen
rateBase = 0
ratePerCapacity = 0.000069444
effectOnEfficency = 0
}
OUTPUT_RESOURCE_OXYGEN
{
name = CarbonDioxide
rateBase = 0
ratePerCapacity = -0.0000504936
effectOnEfficency = 0
}
INPUT_RESOURCE
{
name = ElectricCharge
rateBase = 0
ratePerCapacity = 0.00005787041
effectOnEfficiency = 0.9
}
}

Here's the first screen shot using the updated config file. Notice that ECR is now showing 5.236/hour which is 5.000 for the "ratePerCapacity = 0.00138889" line, 0.028 for the "rateBase = 0.00277778" line (which is still inaccurate but this first fix isn't meant to address that problem) and .208 for the corrected "ratePerCapacity = 0.00005787041" line found in the air vents section.2F914B193ACD6E0AED668337BC14703FFFFC105B

This second screen shot is after I've advanced time by about 1 hour to show that the displayed 5.236 is actually what is being charged:DB79C8FEF8EAC1DFF104E41643B28DC07CB116A0

And this third screen shot is after advancing to day 27 to show that the air vents do eventually stop working (notice that O2 in storage is down to 18.44):A253281D9311DD7B38D50B07DB055F0449461864

Obviously, Jeb is still alive after 27 days stuck in a capsule with no power, so internal life support is still working to some degree. I'm not hugely worried about that since, technically, getting air into the capsule from the LSS would simply involve opening a valve. Also notice that there is no CO2 in the tanks because the scrubbers don't actually use electricity with the default config and they remained online the whole time. And since we're sitting on the launch pad on Kerbin, the inside of the capsule never would have gotten overly hot or cold. Obviously, it would be better if there was some sort of death chance if the LSS stopped working due to lack of electricity since the capsule would turn into a meat locker, but I don't think that was built into the default config. It looks like death can only occur if you get too much CO2 or run out of O2.

As for the problem shown with fact 2, I'm not sure why "rateBase = 0.00277778" is only counting at .028/hour of electrical charge instead of the 10/hour it should be. I tried taking out the ratePerCapacity, plus all the scrubber and air vent information, leaving me with the following config file:

ION_SUPPORT_RESOURCE
{
name = Oxygen
GUIName = 02
ratePerKerbal = 0.0000028935

causeDeath = True
killRollInterval = 3600
killChance = 0.1

evaAmount = 1
evaMaxAmount = 1
}

ION_SUPPORT_RESOURCE
{
name = CarbonDioxide
GUIName = CO2
ratePerKerbal = -0.0000021039

causeDeath = True
killRollInterval = 600
killChance = 0.1
}
ION_SUPPORT_RESOURCE
{
name = ElectricCharge
GUIName = Electricity
rateBase = 0.00277778

causeLock = True
}

When I get onto the launch pad with my test ship and that config, I get the following screen shot:1DFEA9E3C22308DA48DBB7B8BCD4C5040C669DE4

Now ElectricCharge Rate is 0.667/day which is more like the 4 minute cost (0.00277778 * 60 * 4 = 0.6666672). Definitely not the "/day" which is really "/24 hours". And just so we are clear, this is definitely not just displaying wrong as you can see in this next screen shot which is taken one hour later and where I've only used 49.97 of 50.42. I am assuming that the .42 is not appearing on the resource list which is not an ioncross issue.75E6ABAB301D1A4454C849294B2FC7968DBDC3E1

As a matter of fact, I tried one more test where I removed the O2 and CO2 portions from the config file leaving me with just the following:

ION_SUPPORT_RESOURCE
{
name = ElectricCharge
GUIName = Electricity
rateBase = 0.00277778

causeLock = True
}

This next screen shots show the result which is still a 0.667/day ElectricCharge Rate.D231C87AF2AC82024A3B9D4A55DC0F6BB9CFC7EF

So I've got no idea why "rateBase = 0.00277778" isn't apparently being charged correctly. Though perhaps I should state that I am making an assumption. In the case of ratePerCapacity and ratePerKerbal, the value listed in the amount per second that is being changed. So "ratePerCapacity = 0.00138889" is 0.08333334/minute and 5.000004/hour. I'm assuming that "rateBase = 0.00277778" is also the base ec rate per second. Maybe it's not? If it's not, I'm not sure what it is but still, it could be a bad assumption on my part.

One last thing I should note. The displayed 0.667/day (24 hours, remember) and the earlier displayed 5.028/hour doesn't mean the rateBase is being calculated doubly wrong. .028*24 = 0.672 so my guess is this is just rounding. In all of the tests I've included in this post, rateBase was only ever being charged at a rate of .028/hour (or likely closer to 0.0277778/hour or ten times what the listed rateBase should be).

Oh, and yes, I did try setting "rateBase = 1" and, yes, that did charge 1ec/second. Why did setting it to 1 have it charge correctly while setting it to 0.00277778 not? No idea. I tried several other values and got the following results:

"rateBase = 0.5" resulted in an ElectricCharge Rate: 15.000/min. 0.5*60=30 so that's only half the value it should be.

"rateBase = 0.25" resulted in an ElectricCharge Rate: 3.750/min. That's 1/4 what it should be with that value.

"rateBase = 0.01" resulted in an ElectricCharge Rate: 8.640/day. That's 1/100th what it should be.

And with the above three, I can now see where we're getting 0.028/hr from the default "rateBase = 0.00277778" setting. It seems as though the code is using rateBase*rateBase*timeFrame to calculate the electricCharge. I.E., 0.00277778 * 0.00277778 * 60 * 60 = 0.02777782222224 which would display as 0.028. So, again, maybe it's just a bad assumption on my part. Maybe rateBase is supposed to multiply itself to determine that actual per second charge. Though why that one rate is calculating differently then the others is beyond me.

Anyway, for all those that made it to the end of this post, again I want to state that I'm not trying to be argumentative or make waves or anything. But I do want it clear that I really am seeing two bugs (or at least what seem like bugs to me) in the default config. One is easily fixed. The other is likely as issue in the code itself.

Share this post


Link to post
Share on other sites
This next screen shots show the result which is still a 0.667/day ElectricCharge Rate.http://cloud-4.steampowered.com/ugc/67872130812981359/D231C87AF2AC82024A3B9D4A55DC0F6BB9CFC7EF/

So I've got no idea why "rateBase = 0.00277778" isn't apparently being charged correctly. Though perhaps I should state that I am making an assumption. In the case of ratePerCapacity and ratePerKerbal, the value listed in the amount per second that is being changed. So "ratePerCapacity = 0.00138889" is 0.08333334/minute and 5.000004/hour. I'm assuming that "rateBase = 0.00277778" is also the base ec rate per second. Maybe it's not? If it's not, I'm not sure what it is but still, it could be a bad assumption on my part.

One last thing I should note. The displayed 0.667/day (24 hours, remember) and the earlier displayed 5.028/hour doesn't mean the rateBase is being calculated doubly wrong. .028*24 = 0.672 so my guess is this is just rounding. In all of the tests I've included in this post, rateBase was only ever being charged at a rate of .028/hour (or likely closer to 0.0277778/hour or ten times what the listed rateBase should be).

Oh, and yes, I did try setting "rateBase = 1" and, yes, that did charge 1ec/second. Why did setting it to 1 have it charge correctly while setting it to 0.00277778 not? No idea. I tried several other values and got the following results:

"rateBase = 0.5" resulted in an ElectricCharge Rate: 15.000/min. 0.5*60=30 so that's only half the value it should be.

"rateBase = 0.25" resulted in an ElectricCharge Rate: 3.750/min. That's 1/4 what it should be with that value.

"rateBase = 0.01" resulted in an ElectricCharge Rate: 8.640/day. That's 1/100th what it should be.

And with the above three, I can now see where we're getting 0.028/hr from the default "rateBase = 0.00277778" setting. It seems as though the code is using rateBase*rateBase*timeFrame to calculate the electricCharge. I.E., 0.00277778 * 0.00277778 * 60 * 60 = 0.02777782222224 which would display as 0.028. So, again, maybe it's just a bad assumption on my part. Maybe rateBase is supposed to multiply itself to determine that actual per second charge. Though why that one rate is calculating differently then the others is beyond me.

Anyway, for all those that made it to the end of this post, again I want to state that I'm not trying to be argumentative or make waves or anything. But I do want it clear that I really am seeing two bugs (or at least what seem like bugs to me) in the default config. One is easily fixed. The other is likely as issue in the code itself.

Firstly, don't you dare apologize. I'd rather get bug reports and feedback then no bug reports and no feedback. Otherwise I'd only be doing this for myself and be less likely to expand it and work on it.

Ok, cutting to the last few paragraphs here because we've got some math that looks interesting.

This is the actual code that handles resource charges. (this is only for the part in the base config file we're talking about and only for the ION_SUPPORT_RESOURCE sections. The others are handled by collectors and generators which is separate code.


[FONT=Menlo][COLOR=#444444]resourceRequest[/COLOR][COLOR=#444444] = ([/COLOR][COLOR=#444444]supportResource[/COLOR][COLOR=#444444].[/COLOR][COLOR=#444444]RateBase[/COLOR][COLOR=#444444] * [/COLOR][COLOR=#444444]supportResource[/COLOR][COLOR=#444444].[/COLOR][COLOR=#444444]RateBaseMod[/COLOR][COLOR=#444444] + [/COLOR][COLOR=#444444]supportResource[/COLOR][COLOR=#444444].[/COLOR][COLOR=#444444]RatePerKerbal[/COLOR][COLOR=#444444] * [/COLOR][COLOR=#444444]supportResource[/COLOR][COLOR=#444444].[/COLOR][COLOR=#444444]RatePerKerbalMod[/COLOR][COLOR=#444444] * [/COLOR][COLOR=#444444]crew[/COLOR][COLOR=#444444] + [/COLOR][COLOR=#444444]supportResource[/COLOR][COLOR=#444444].[/COLOR][COLOR=#444444]RatePerCapacity[/COLOR][COLOR=#444444] * [/COLOR][COLOR=#444444]supportResource[/COLOR][COLOR=#444444].[/COLOR][COLOR=#444444]RatePerCapacityMod[/COLOR][COLOR=#444444] * [/COLOR][COLOR=#444444]crewCapacity[/COLOR][COLOR=#444444]) * [/COLOR][COLOR=#444444]deltaTime[/COLOR][COLOR=#444444];[/COLOR]
[/FONT]

rateBase is consolidated with ratePerCapacity and ratePerKerbal (*Mod defaults to 1 and is unused in most parts. I think the hitchhiker pod uses 0.5 as do a few others but the Mk1 Pod defaults to full rate on everything). Standard rules of precedence are followed: multiplication first then addition. deltaTime is Timewarp.deltaTime and is the amount of time in seconds that has passed between frames. (it can be less than 1 second and will be when not timewarping.)

And.... here is the problem...


[FONT=Menlo][COLOR=#009695]protected [/COLOR][COLOR=#3363a4]double [/COLOR][COLOR=#444444]rateBaseMod[/COLOR][COLOR=#444444];[/COLOR]
[COLOR=#009695]public [/COLOR][COLOR=#3363a4]double [/COLOR][COLOR=#444444]RateBaseMod[/COLOR][COLOR=#444444] { [/COLOR][COLOR=#009695]get[/COLOR][COLOR=#444444] { [/COLOR][COLOR=#009695]return [/COLOR][COLOR=#444444]rateBase[/COLOR][COLOR=#444444]; } }[/COLOR]
[/FONT]

If you don't understand programming, that says not to return the variables directly but instead to wrap them in a publicly accessible function that only gets and not sets.

And instead of returning rateBaseMod it's returning rateBase. Do you see that?

gorramit.

Simple enough, I'll do a hot fix on it.

Edited by Starwaster

Share this post


Link to post
Share on other sites

A simple fix for something that took a hell of alot of digging to find. :) Dontcha just love that?

So now you can work on fine tuning cause I have to say, with rateBase working and drawing 10/hour PLUS the 5/hour/capacity, that's going to make the life support system heavily power hunger compared to everything else. Especially if you've got more then 1 crew module on your ship. Or does rateBase only get counted once regardless of the number of modules on a ship? I'll have to test that later. :)

Share this post


Link to post
Share on other sites
A simple fix for something that took a hell of alot of digging to find. :) Dontcha just love that?

So now you can work on fine tuning cause I have to say, with rateBase working and drawing 10/hour PLUS the 5/hour/capacity, that's going to make the life support system heavily power hunger compared to everything else. Especially if you've got more then 1 crew module on your ship. Or does rateBase only get counted once regardless of the number of modules on a ship? I'll have to test that later. :)

It gets counted for each crewed part, so if you have a Mk1-2 pod and a Hitchhiker's pod then you're getting charged for both of them.

Might have to lower power consumption a bit... I'd like to base it off real life, but ElectricCharge is harder than anything else to peg down as to what it represents. Realism Overhaul has a good redefinition where each EC is 1 KWh and things that add EC do so in joules. (or was it kilojoules?). So batteries tend to have high capacity ratings but generators and panels replenish it more slowly. Works reasonably well although batteries have no concept of max power output

Share this post


Link to post
Share on other sites

I've read the same thing about Ec in a few places so that's more or less how I've been thinking about it recently. I came across a document with average power requirements for an ECLSS (Environmental Control and Life Support System) that is intended for a Mars mission (http://www.colorado.edu/ASEN/project/mob/MOBFinalReport.5.pdf). Can't say how accurate the numbers would be for the types of modules we have in Kerbal, but I figured it might be a place to start. 10.64Kw (per hour, presuamably) doesn't seem outrageous if 1 Kw = 1Ec, though I can't tell how large an area (or how many crew members) this system is intended for. You'll probably manage to find better details elsewhere, but figured I'd pass along what I'd come across after a breif search.

Share this post


Link to post
Share on other sites
I've read the same thing about Ec in a few places so that's more or less how I've been thinking about it recently. I came across a document with average power requirements for an ECLSS (Environmental Control and Life Support System) that is intended for a Mars mission (http://www.colorado.edu/ASEN/project/mob/MOBFinalReport.5.pdf). Can't say how accurate the numbers would be for the types of modules we have in Kerbal, but I figured it might be a place to start. 10.64Kw (per hour, presuamably) doesn't seem outrageous if 1 Kw = 1Ec, though I can't tell how large an area (or how many crew members) this system is intended for. You'll probably manage to find better details elsewhere, but figured I'd pass along what I'd come across after a breif search.

Thanks, I'll give that a look.

Edit: Actually it does give the volume covered by those power requirements as 27.186 m3

And if I'm reading that right it's the 5th document in the set so maybe the amount of crew is given on the preceding pages. I'm thinking 4-6 crew.... it mentions a 'standard habitat' so hopefully they actually defined what they considered standard somewhere else.

Edited by Starwaster

Share this post


Link to post
Share on other sites

After some distractions (Reflection Mod, others) working on update for Ioncross again

Here's some numbers I'm looking at for refactoring of resource volumes. Parts aren't the given part names, just my description of them. Volume is the total volume of compressed O2x200 in liters, based on similar parts as defined in Real Fuels. So, the small radial has a dimensional volume of 200, multiplied by a 200 compression factor for a total of 40,000 liters of pure O2. For reference, a scuba tank can have a compression factor of 250. The numbers I was getting were pretty large as is so I decided that the safety minded(!) Kerbal Engineers aren't filling the tanks to full capacity.

Days worth of oxygen are based on the assumption that Kerbals need about 80% of what humans need. (initially 75%, but bumped up a bit). I've hesitated on these numbers a bit because it seemed like not enough of an improvement where life support barely has meaning with a tank allowing durations of a year or more. But I've run and re-run these numbers over and over again and if you look at what a tank of pure O2 contains versus what a human actually needs in terms of O2 mass, they seem reasonable.

Example: A 200 liter tank at 250 atm =

71.45kg of O2. NASA says that a person performing typical astronaut duties requires 0.8 kg of O2 per day. That should last a single person 89.3125 days. Note that that doesn't count losses due to EVA, which typically vents atmosphere to space seeing as how it costs less to just send up more compressed air rather than install bulky equipment capable of recovering airlock air (I think the ISS does try to recover as much as possible though...). Nor does it count any other losses that I might not be thinking of right now.

So, here are the numbers by part. EVA resource usage isn't listed here (and is handled a little differently) but I think it should be bumped up a bit to reflect increased Kerbal activity.

[TABLE]

[TR]

[TD]Size[/TD]

[TD]Volume (liters, compressedx200)[/TD]

[TD]Days/1 Kerbal[/TD]

[TD]Days/3 Kerbals[/TD]

[/TR]

[TR]

[TD]Small Stack Tank[/TD]

[TD=align: right]100000[/TD]

[TD=align: right]238.10[/TD]

[TD=align: right]79.37[/TD]

[/TR]

[TR]

[TD]Large Stack Tank[/TD]

[TD=align: right]940000[/TD]

[TD=align: right]2238.10[/TD]

[TD=align: right]746.03[/TD]

[/TR]

[TR]

[TD]Small Radial[/TD]

[TD=align: right]40000[/TD]

[TD=align: right]95.24[/TD]

[TD=align: right]31.75[/TD]

[/TR]

[TR]

[TD]Large Radial[/TD]

[TD=align: right]150000[/TD]

[TD=align: right]357.14[/TD]

[TD=align: right]119.05[/TD]

[/TR]

[/TABLE]

Share this post


Link to post
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.