Jump to content

z08840

Members
  • Posts

    4
  • Joined

  • Last visited

Reputation

4 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. [quote name='Torgo']Is it possible to write a script for a probe that would sense the current battery level, then switch a fuel cell on based on that level? I'd like to have the fuel cell kick on when the battery gets to 10%, then switch off when the battery gets to 90%.[/QUOTE] [CODE] list RESOURCES in res. local capacity is 0. local amount is 0. for r in res { if r:NAME = "ElectricCharge" { lock capacity to r:CAPACITY. lock amount to r:AMOUNT. break. } } local isON is false. until false { local p is 0. if capacity > 0 { set p to amount/capacity. } if p <= 0.1 and not isON { list PARTS in pp. for part in pp { if part:NAME = "FuelCell" or part:NAME = "FuelCellArray" { local module is part:GETMODULE("ModuleResourceConverter"). if module:HASEVENT("start fuel cell") { module:DOEVENT("start fuel cell"). } } } set isON to true. } else if p >= 0.9 and isON { list PARTS in pp. for part in pp { if part:NAME = "FuelCell" or part:NAME = "FuelCellArray" { local module is part:GETMODULE("ModuleResourceConverter"). if module:HASEVENT("stop fuel cell") { module:DOEVENT("stop fuel cell"). } } } set isON to false. } wait 5. } [/CODE] you can optimize it by taking parts' listing out of until loop
  2. [quote name='Steven Mading']The default CPU speed is deliberately throttled back severely for two reasons:[/QUOTE] I have an idea for such kind of problems - it would be nice to add some kind of "hardware calculation modules" or coprocessors to kOS CPU. Such modules can be programmed separately in C#/C++ or other language and compiled into shared library and consist of functions. Every such module can be added to kOS CPU at the expense of price+weight+power consumption, providing fast (maybe even parallel) calculations.
  3. [quote name='Steven Mading'] set CONFIG:IPU to nnnn.[/QUOTE] yes, it helped, thank you
  4. This is really wonderful mod (except not very convenient language syntax , but I found it really slow on calculations - I'm trying to implement calculation for suicide burn through numerical integration (integral seems to be too complex for analytical approach), and it takes about 3-4 second for ~300 iterations of pretty simple calculations - I've made some tests and seems just every couple of math operations takes ~1ms. Is there any way to optimize it somehow?
×
×
  • Create New...