Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
Steve505

Output of Energy storage

Question

Hi there!

I was writing a program which monitors total energy consumption in period of time and I found a problem... None of Energy storages in our modpack (Energy Cell from TE, Capacitor Cell from EnderIO and Energy Cube from Mekanism) isn't sending data about actual energy output, so I've got stuck in my code.

Has anybody a solution to my problem?

Thanks,

Steve505

Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Hey,

I hope I interpreted your question correctly. You want to monitor how much energy your base actually consumes, the rf/t that leaves your energy storage device and not the relative difference between input and output, right?

I did some testing and I came up with a solution that give you exactly that, the rf/t output of the storage device (used TE energy cell), now matter how much you input. This will stop the output of the cell for a limited amount of time tho (this is needed to do the calculation), so it's best to put a small energy storage device between the actual energy storage where you do the monitoring and your grid feeding your machines.

Basically what I do is the following:

1. measure the relative energy difference in the device for a given period of time, divided by the amount of ticks waited --> the DIFFERENCE between input and output ( in rf/t)

2. disable the energy output of the device by applying a Redstone signal

3. measure the energy difference again and reenabling the output again (again divided by amount of ticks) --> the TOTAL input (in rf/t)

4. getting the difference between total input and relative change in rf --> the output (in rf/t)

local component = require'component'
local energyCell = component.energy_device
local rs = component.redstone
local side = 4      -- # side where your energy storage device is (relative to redstone i/o)
local wait = .5     -- # time waiting between checking the energy level

function getOutput()
  local init_rf = energyCell.getEnergyStored()  -- # rf base level
  os.sleep(wait)
  local rel_rf = (energyCell.getEnergyStored() - init_rf) / (wait + .05)  / 20 -- # rf difference
  rs.setOutput(side, 15)
  init_rf = energyCell.getEnergyStored()
  os.sleep(wait)
  local tot_rf_in = (energyCell.getEnergyStored() - init_rf) / (wait + .05)  / 20  -- # total rf input
  rs.setOutput(side, 0)
  local tot_rf_out = tot_rf_in - rel_rf  -- # total rf output
  return tot_rf_out
end

-- # apparently it takes one tick to read the rf level in the device, that's why I added .05 seconds
-- # to the time waited in the rf/t calculations
-- # the rf/t values are 100% correct, at least for TE energy cell

you have to set the Redstone behavior to disable output when a Redstone signal is applied

Link to post
Share on other sites
  • 0

Hey there! 

Yes, your interpretation is correct. In fact, I've got similar idea. But this solution is not very suitable because it's too much complicated. 

I want to monitor this energy consumption on our server at each user in the town. It'll be not very practical, if I had to build and configure this system 50 or more times. 

Yes, if it'll be a best solution and there will be not a straight way of reading I/O, I'll have to do it. 

I was just surprised that reading I/O is possible for reactors, generators, dynamos etc., but not for energy storages. 

Thanks for help, 

Steve505

Link to post
Share on other sites
  • 0

Well, more practical might be not the best way to put it, but it'll reduce the amount of components you need to hook up to your computer, so reading the energy consumption of a few energy cells or of hundreds doesn't really make a difference. But you need a central place to set this system up and each energy connection cannot connect with others from this point on. It also might require some more coding than using that simple approach.

2018-03-12_20_26_26.png.e3f91507d1b1c27341c34ca1b641f414.png

Basically you have an array of 2 energy cells for each base. The robot will move back and forth placing down the adapter and applying the Redstone signal to toggle the input for a second. Then it will remove the adapter again and moves to the next position. The computer then can read the energy consumption of each energy cell. Of cause this system is kinda complicated and might take some time to be set up, but it would be easy to extend that system. Biggest downside is all the energy lines cannot be interconnected after that point. You would need to run individual power lines to each base or use some means of wireless power transportation. Even though being somewhat strange looking and not that resource efficient in terms of energy cells/ cabling required it's certainly the most "practical" way I can come up with to solve your issue.

Link to post
Share on other sites
  • 0

Thanks for an idea. Maybe in the future, I'll use it. But I've figured out the probably simpliest solution.

Basically, at each plot, there'll be a small storage of energy, which I'll have to check each week and via OC measure consumed energy. After measure, I'll charge storage, which owner of the plot will be using for another week...

It's not a central controlled system, but that could be easily done. The most impotrtant thing is, that this is simple. And as once one smart man said; "There is beauty in simplicity."

Anyway, thanks for the help. Really appreciate it.

Link to post
Share on other sites

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
Answer this question...

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

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.