This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Umaroth's profile picture

Umaroth's Power Monitor

Started by Umaroth, 30 March 2015 - 04:58 AM
Umaroth #1
Posted 30 March 2015 - 06:58 AM
Description:

A script designed to monitor Energy Cells and Capacitor Banks and turn engines/reactors/turbines on/off depending on energy levels. This is designed to be fully configurable and expandable.

Requires Computronics or OpenPeripheralsIntegration!

Images:
SpoilerSimple setup with one full Energy Cell and one empty Capacitor Bank (in the back) and two different sized monitors.


Accepts as many storage cells as you can connect. Also, you can see here that peripherals can be connected either with a network or by touching the computer.


Here you can see it does the math correctly. 5 full cells and 5 empty cells at 80m Max RF each.


Accepts as many monitors as you can connect, either 1x2 or 2x3 in size.


My home setup:


Terminal output:


Also controls BigReactors Turbines and Reactors

Features:
  • Dynamically controls engines, turbines and reactors based on how much energy is stored in connected energy storage blocks.
  • Energy values at which to turn engines on and off are easily configurable.
  • Can output redstone to any side or no side with easy configuration. (For controlling engines)
  • Automatic detection of any peripherals connected to the computer, either through direct contact or through a wired network.
  • Automatically detects and controls connected Turbines/Reactors.
  • Accepts connections to as many monitors and energy storage cubes as the network can support. (I haven't found the limit yet, if there is one.)
  • Supports two monitors sizes: 1x2 and 2x3. (HxW)
  • Supports billions of RF. Anything less than 1 trillion RF will fit on the screen.
  • Features a capacity bar on the right side of the screen on 3v2 monitors.
Limitations:
  • Only officially supports Energy Cells and Capacitor Banks. Mekanism Energy Cubes work, but aren't officially supported because they don't use RF. (They also only work if you have Computronics)
  • Only officially reads RF, other types may be added in the future if there is demand.
  • Can only control one turbine and one reactor. I could add support for more but I doubt anyone uses more than one of each.
  • If you don't have Computronics then Capacitor Banks aren't fully supported. You must manually specify how many blocks are in the Capacitor Bank within the program and it only works properly for one Capacitor Bank. It may be inaccurate at times as well due to uneven RF distribution among the blocks of the Capacitor Bank.
  • Requires at least one monitor and all monitors must be either 1x2 or 2x3 in size. I could add support for no monitors if needed.
  • Can only output redstone to one side but I doubt that's an issue.
Suggestions:

I'm open to any and all suggestions, if there's a mod you want me to support or a new storage block or energy type you want it to read or feature you want me to add, please let me know.

Bugs:

I had to make a lot of changes to implement compatibility with both OpenPeripherals and Computronics and I haven't had time to fully test this version, so please consider version 1.3 beta until I've had time to fully test it. That being said I'm not currently aware of any bugs.

Planned Features:
  • Anything possible/feasible that is suggested.
Get the code here: http://pastebin.com/cA2TNNdH

Read the Changelog/Readme here: http://pastebin.com/erPf3t4t

Background:

This script is based on one posted here.

I liked the idea of that script but I found it extremely lack-luster. It only supported one monitor and one energy storage block at a time, it only supported one monitor size, the redstone output side wasn't configurable and anything over a billion RF didn't fit on the screen. Oh yeah, and it didn't even work anymore with the current mod versions.

Enjoy!

This script was developed using Minecraft v1.7.10, Thermal Expansion 4.0.0RC7, EnderIO v2.2.8, Computercraft 1.73, Computronics v1.4.4 ,OpenPeripherals 1.7.10-AIO-2 and BigReactors 0.4.2A2.
Edited by
Lyqyd #2
Posted 30 March 2015 - 04:30 PM
Shortened/redirecting links are not allowed. I've removed the tinyurl link and replaced it with a formatted link to the old link's final destination.
Kaidenyo #3
Posted 01 April 2015 - 12:41 PM
Says "No RF Storage found. Exiting Script!"

Setup Here: http://i.imgur.com/V6UTlOZ.png

These are normal Capacitor banks ( 5m Storage )
Edited on 01 April 2015 - 10:44 AM
Lupus590 #4
Posted 01 April 2015 - 02:20 PM
in the OP, the controlling computer has one modem, combine your cables and remove a modem, see if that works
Kaidenyo #5
Posted 01 April 2015 - 09:29 PM
in the OP, the controlling computer has one modem, combine your cables and remove a modem, see if that works

Does not work, sadly


I got it working by changing the code from "capacitor_bank" to "tile_blockcapacitorbank_name". I have the same Version of Mods as OP stated, so im not sure why its different. peripheralget also returned tile_blockcapacitorbank_name.

It also does not take more than the block it has the peripheralwrap on into consideration. My Capacitors have 185m RF Storage room, but the output only shows 5m RF ( which is one block )
Edited on 01 April 2015 - 08:16 PM
Umaroth #6
Posted 01 April 2015 - 11:07 PM
I got it working by changing the code from "capacitor_bank" to "tile_blockcapacitorbank_name". I have the same Version of Mods as OP stated, so im not sure why its different. peripheralget also returned tile_blockcapacitorbank_name.

It also does not take more than the block it has the peripheralwrap on into consideration. My Capacitors have 185m RF Storage room, but the output only shows 5m RF ( which is one block )

Let me make sure I have an official version of the program uploaded to Pastebin, I tend to upload testing versions to it for easy importing to Computercraft, I'll have to be sure to use a separate Pastebin upload for that from now on.

Also, I'd like to know why your peripheral name was different. I don't know what assigns those names. But that's why I posted all my mod versions, so people could compare theirs to mine and let me know so I can figure out which versions require a code change.

Also, it's strange that the program only counts the energy in one block of the Cap. Bank because it reads the entire thing for mine no matter what block I connect it to and no matter how large the capacitor bank is. Are you sure you're on the same mod versions? This problem is pretty bizarre.

Update: After some research it looks like it's OpenPeripherals that assigns types to everything aside from core Computercraft Peripherals, so that is what would have to be the same version as mine in order to work.

Let me test something: I'm going to install the standalone versions of OpenPeripherals instead of the AllInOne version and see if that makes a difference.

Update 2: It didn't make a difference, every peripheral still has the same peripheral.getType() return for me as it did before.

Also, I checked the version uploaded to Pastebin and it's a correct version, there shouldn't be any extraneous bugs in it.
Edited on 02 April 2015 - 03:17 AM
isaokirito #7
Posted 01 April 2015 - 11:16 PM
How do I actually get this onto a computer itself I am kinda newby maybe a video showing how idk I don't know how to do this and I really want this thanks.
Umaroth #8
Posted 02 April 2015 - 04:36 AM
How do I actually get this onto a computer itself I am kinda newby maybe a video showing how idk I don't know how to do this and I really want this thanks.

I put how to do it in the Changelog/Readme posted here: http://pastebin.com/erPf3t4t

Here is what is says:

To get this on your CC computer type/copy this into your Computercraft terminal:

pastebin get cA2TNNdH PowerMonitor

It should succeed if you are connected to the internet, then you can run the program by typing "PowerMonitor" into the computer.

Then, if you want the program to run automatically, type/copy this into the computer:

rename PowerMonitor startup

in the OP, the controlling computer has one modem, combine your cables and remove a modem, see if that works

I haven't tried more than one connected network (mostly because I can't think of a reason to have more than one), but theoretically it shouldn't make a difference, computers can connect to more than one network at a time, all device names should still be unique. There's nothing in the code limiting it to only one network.
Edited on 02 April 2015 - 02:45 AM
Umaroth #9
Posted 02 April 2015 - 04:46 AM
in the OP, the controlling computer has one modem, combine your cables and remove a modem, see if that works

I haven't tried more than one connected network (mostly because I can't think of a reason to have more than one), but theoretically it shouldn't make a difference, computers can connect to more than one network at a time, even across separate networks all device names should still be unique and there's nothing in the code limiting it to only one network, so the script should recognize and connect to everything.
Edited on 02 April 2015 - 02:48 AM
Kaidenyo #10
Posted 02 April 2015 - 08:36 AM
I got it working by changing the code from "capacitor_bank" to "tile_blockcapacitorbank_name". I have the same Version of Mods as OP stated, so im not sure why its different. peripheralget also returned tile_blockcapacitorbank_name.

It also does not take more than the block it has the peripheralwrap on into consideration. My Capacitors have 185m RF Storage room, but the output only shows 5m RF ( which is one block )

Let me make sure I have an official version of the program uploaded to Pastebin, I tend to upload testing versions to it for easy importing to Computercraft, I'll have to be sure to use a separate Pastebin upload for that from now on.

Also, I'd like to know why your peripheral name was different. I don't know what assigns those names. But that's why I posted all my mod versions, so people could compare theirs to mine and let me know so I can figure out which versions require a code change.

Also, it's strange that the program only counts the energy in one block of the Cap. Bank because it reads the entire thing for mine no matter what block I connect it to and no matter how large the capacitor bank is. Are you sure you're on the same mod versions? This problem is pretty bizarre.

Update: After some research it looks like it's OpenPeripherals that assigns types to everything aside from core Computercraft Peripherals, so that is what would have to be the same version as mine in order to work.

Let me test something: I'm going to install the standalone versions of OpenPeripherals instead of the AllInOne version and see if that makes a difference.

Update 2: It didn't make a difference, every peripheral still has the same peripheral.getType() return for me as it did before.

Also, I checked the version uploaded to Pastebin and it's a correct version, there shouldn't be any extraneous bugs in it.

Hey we are using openperipherals from here http://www.openperipheral.info/ (3 seperate downloads). Modpack is here http://www.technicpack.net/modpack/sssserverpack.588534/mods

I dont know why its tile_blockblahblah instead of capacitor_bank. But having wrong information may come from the peripheralwrap itself, since its named "tile_blockcapablahlblah_nameX" and X indicates the number of the bank in the whole array with capabanks ( so it starts with 1 and ends with 38 in my example )
Umaroth #11
Posted 02 April 2015 - 09:54 AM
Hey we are using openperipherals from here http://www.openperipheral.info/ (3 seperate downloads). Modpack is here http://www.technicpack.net/modpack/sssserverpack.588534/mods

I dont know why its tile_blockblahblah instead of capacitor_bank. But having wrong information may come from the peripheralwrap itself, since its named "tile_blockcapablahlblah_nameX" and X indicates the number of the bank in the whole array with capabanks ( so it starts with 1 and ends with 38 in my example )

Hmm, can you check all of the peripheral names for me? Are you getting different types assigned to everything or just capacitor banks? The ones on my world are "powered_tile" (applies to both TE Energy Cells and Mekanism Energy Cubes, possibly others as well), and "BigReactors_Turbine".

Also, are you saying that if you have a 38 block capacitor bank, it's assigning a different network name to every block in the capacitor bank? That's very strange, especially since you have the exact same versions of Computercraft, OpenPI, and EnderIO as I do.

Oh, and I can't believe I didn't ask this earlier: Why does your capacitor bank have an Input/Output screen on it?
Edited on 02 April 2015 - 08:11 AM
Kaidenyo #12
Posted 02 April 2015 - 06:50 PM
Hey we are using openperipherals from here http://www.openperipheral.info/ (3 seperate downloads). Modpack is here http://www.technicpa...ack.588534/mods

I dont know why its tile_blockblahblah instead of capacitor_bank. But having wrong information may come from the peripheralwrap itself, since its named "tile_blockcapablahlblah_nameX" and X indicates the number of the bank in the whole array with capabanks ( so it starts with 1 and ends with 38 in my example )

Hmm, can you check all of the peripheral names for me? Are you getting different types assigned to everything or just capacitor banks? The ones on my world are "powered_tile" (applies to both TE Energy Cells and Mekanism Energy Cubes, possibly others as well), and "BigReactors_Turbine".

Also, are you saying that if you have a 38 block capacitor bank, it's assigning a different network name to every block in the capacitor bank? That's very strange, especially since you have the exact same versions of Computercraft, OpenPI, and EnderIO as I do.

Oh, and I can't believe I didn't ask this earlier: Why does your capacitor bank have an Input/Output screen on it?

Thermal Expansion Cells give "tile_thermalexpansion_cell_[category]_name" ( e.g. "tile_thermalexpansion_cell_basic_name" for leadstone cell )
Mekanism Cubes give "[category] Energy Cube" ( e.g. "Elite Energy Cube" for elite energy cube )

Capacitor banks do this now if you shift-rightclick them empty handed.
Umaroth #13
Posted 02 April 2015 - 10:42 PM
Thermal Expansion Cells give "tile_thermalexpansion_cell_[category]_name" ( e.g. "tile_thermalexpansion_cell_basic_name" for leadstone cell )
Mekanism Cubes give "[category] Energy Cube" ( e.g. "Elite Energy Cube" for elite energy cube )

Capacitor banks do this now if you shift-rightclick them empty handed.

Yours sounds like a much more reliable naming system, I wish mine worked like that. I've asked in a few places and nobody seems to have any idea why/how this could be happening. But I'll keep searching.

Update 1:

AHA! I figured it out! I removed three of the mods you didn't have on your server, immibis' peripherals, OpenCCSensors and Computronics and that fixed it. Now I just need to add them back in 1 by 1 to find out which mod it is that messes it up.

Update 2:

Yep, I found it. Look at this inside Computronics config file:


computercraft {

    ##########################################################################################################
    # multiperipheral
    #--------------------------------------------------------------------------------------------------------#
    # If all of these options are set to true, Computronics will fix almost every conflict with multiple mods adding peripherals to the same block
    ##########################################################################################################

    multiperipheral {
        # Set this to true to fix multiple mods adding peripherals to the same block not working [default: true]
        B:allMultiPeripherals=true

        # If this is true, the Computronics MultiPeripheral system will almost always be the one recognized by ComputerCraft [default: true]
        B:alwaysFirstPeripheral=true

        # Set this to false to disable MultiPeripheral compatibility with OpenPeripheral peripherals [default: true]
        B:openMultiPeripheral=true
    }

}

It looks like if I just set B:openMultiPeripheral=false it should fix the issue.

Update 3:

Nope, none of the config setting made a difference, you have to remove computronics entirely in order for the names to go back to normal. I'll just have to mark the script as incompatible with Computronics.

I'm currently working on rewriting the code to properly get the new types. It's a fair amount more difficult than before since there are more valid names. I could list all of them but I'd rather sort them by class which will require some pattern matching.
Edited on 02 April 2015 - 10:04 PM
Kaidenyo #14
Posted 03 April 2015 - 08:33 AM
Man, I gave you some work … but glad you could figure it out
Umaroth #15
Posted 04 April 2015 - 05:10 AM
Man, I gave you some work … but glad you could figure it out

Well, I got it working with the new names, but now I'm having the same problem you had. It only reads from the block it's connected to with the Capacitor Banks
Umaroth #16
Posted 06 April 2015 - 01:57 AM
Update: I spoke to the dev of Computronics and he informed me that the reason the script can't get the correct values for Capacitor Banks is because OpenPeripherals doesn't have support for the way Capacitor Banks handle RF values but Computronics does, which explains why it worked for me in the first place.

So what this means is that I'll have to require Computronics for the script to work properly with Capacitor Banks. I can code support for both Computronics and OpenPeripheral names but if anyone has OpenPeripherals without Computronics they won't be able to get the correct values from Capacitor Banks. In that event I'll put a variable in the code for someone to manually specify how many Capacitor Bank blocks are in their multiblock structure, which comes with obvious problems, but it's the best they can get without Computronics.

I'll work on the rewrite tonight and should have it done within a few hours.
Umaroth #17
Posted 06 April 2015 - 06:09 AM
Alright, I'm done, the rewrite is complete and I did a few testing rounds. I updated the Changelog and program Pastebin uploads and I updated the main post (still need to take new pictures). Everything should be up to date and operational. Please let me know if you encounter any further problems or have any suggestions.
Edited on 06 April 2015 - 04:10 AM
isaokirito #18
Posted 08 April 2015 - 03:37 AM
I typed pastebin get cA2TNNdH PowerMonitor into my computer and it says No Such program.
Lupus590 #19
Posted 08 April 2015 - 10:22 AM
the http api is disabled, if you are on a server, ask the owner to, if you are in singleplayer, change the config
pugsx #20
Posted 12 April 2015 - 03:43 PM
Loving the script so far but cant figure the connection between the computer and the reactor (noob here)
Umaroth #21
Posted 15 April 2015 - 10:21 PM
Loving the script so far but cant figure the connection between the computer and the reactor (noob here)

The name just might not be right depending on what mods you have installed. If you tell me the network name of the reactor then I can change the script to match. I actually never tested the reactor, I just know it follows the same rules as the Turbine and I tested a Turbine.

Also, make sure it's not just connected to the Reactor itself, it has to be connected to a Reactor Computer Port.
Edited on 15 April 2015 - 08:21 PM
pugsx #22
Posted 01 May 2015 - 01:51 PM
The name just might not be right depending on what mods you have installed. If you tell me the network name of the reactor then I can change the script to match. I actually never tested the reactor, I just know it follows the same rules as the Turbine and I tested a Turbine.

Also, make sure it's not just connected to the Reactor itself, it has to be connected to a Reactor Computer Port.

Sorry been afk for few days, I managed to sort it in the end was too late at night and I wasnt paying enough attention lol.

Cheers.
luminaryfive #23
Posted 31 October 2015 - 07:24 PM
I would love to see integration with mekanism and Draconic Evolution energy cores
JaRyCu #24
Posted 29 November 2015 - 06:46 AM
I searched for hours tonight…at first, I attempted to write a program myself, but I couldn't get my Computer to do anything. I could run all of the commands successfully from the LUA interface, but when I put the exact same commands into a program, I just got errors.

After literally 6-7 hours of searching Google, I came across Umaroth's program and I love it. It worked instantly, hooked up 25 reinforced energy cells with no issues at all.

Now my goal is this: I'm also running a steam boiler from Railcraft, a turbine from the steam boiler, two gigantic steel tanks full of raw oil and another steel tank that's slowly filling with refined fuel. I would like to add lines to monitor each of those devices/storage tanks.

I also devoted an entire wall to my display screen and was disappointed to find I had to shrink it for this program to work. Is there any way that the display can be expanded? I literally have a 5 high by 10-12 wide wall I had covered in monitors.
grazazel #25
Posted 14 December 2015 - 04:30 PM
Hi I am trying this on ftb infinity evolved v2.2.2 I have connected up to my computer, reactor computer port and capacitor bank but when I run the program it says no rf storage found. it works with TE cell but not the capacitor bank any ideas?
CodenameGenji #26
Posted 02 September 2016 - 08:46 AM
Hi, I love your script but being a noob at computer craft I need your help to adapt your script to my set up.

What I plan to do is set up like 5 big reactors for five different buildings. This would require a lot of monitoring to make shure it all works and powers stuff well. So what I want to do is make a display board which tells me which power grid is working right. For example:
"Room 1: Good
Room 2: Bad"
So basically what I'm saying is: can I get rid of the part that counts the RF and just edit it a bit so that it detects if there is any RF.
Sorry if I worded things wrong and stuff but my knowledge of computer craft is limited.
Thanks