Add 'current' command to the TA4 Electric Meter

This commit is contained in:
Joachim Stolberg 2023-05-21 17:54:38 +02:00
parent 301d20aaf1
commit 97936102c3
7 changed files with 40 additions and 31 deletions

View File

@ -1455,7 +1455,7 @@ techage.manual_DE.aText = {
"\n"..
"\n"..
"\n",
"Mit Hilfe eines Stromzählers können zwei Stromnetze zu einem größeren Netzwerk verbunden werden. Der Stromzähler leitet den Strom nur in eine Richtungen weiter (Pfeil beachten). Die Menge an Strom (in kud) wird gemessen und angezeigt. Die Strommenge kann auch über das Kommando 'consumption' durch einen Lua Controller abgefragt werden.\n"..
"Mit Hilfe eines Stromzählers können zwei Stromnetze zu einem größeren Netzwerk verbunden werden. Der Stromzähler leitet den Strom nur in eine Richtungen weiter (Pfeil beachten). Die durchgeleitete Menge an elektrischer Energie (in kud) wird gemessen und angezeigt. Dieser Wert kann auch über das Kommando 'consumption' durch einen Lua Controller abgefragt werden. Die aktuelle Stromstärke kann über 'current' abgefragt werden.\n"..
"\n"..
"Der Stromzähler kann bis zu 200 ku durchleiten. Der Maximalwert ist über das Schraubenschlüsselmenü einstellbar.\n"..
"\n"..

View File

@ -1468,7 +1468,7 @@ techage.manual_EN.aText = {
"\n"..
"\n"..
"\n",
"With the help of an electricity meter\\, two electricity networks can be connected to form a larger network. The electricity meter only transmits electricity in one direction (note arrow). The amount of electricity (in kud) is measured and displayed. The amount of electricity can also be queried by a Lua controller using the 'consumption' command.\n"..
"With the help of an electricity meter\\, two electricity networks can be connected to form a larger network. The electricity meter only transmits electricity in one direction (note arrow). The amount of electrical energy passed through (in kud) is measured and displayed. This value can also be queried by a Lua controller using the 'consumption' command. The current current can be queried via the command 'current'.\n"..
"\n"..
"The electricity meter can pass up to 200 ku. The maximum value is adjustable via the wrench menu.\n"..
"\n"..

View File

@ -137,7 +137,9 @@ techage.register_node({"techage:filler"}, {
end,
on_push_item = function(pos, in_dir, stack)
local inv = M(pos):get_inventory()
minetest.get_node_timer(pos):start(CYCLE_TIME)
if not minetest.get_node_timer(pos):is_started() then
minetest.get_node_timer(pos):start(CYCLE_TIME)
end
return techage.put_items(inv, "src", stack)
end,
on_unpull_item = function(pos, in_dir, stack)

View File

@ -215,7 +215,7 @@ Der Trenntransformator kann bis zu 300 ku übertragen. Der Maximalwert ist über
### TA4 Stromzähler / TA4 Electric Meter
Mit Hilfe eines Stromzählers können zwei Stromnetze zu einem größeren Netzwerk verbunden werden. Der Stromzähler leitet den Strom nur in eine Richtungen weiter (Pfeil beachten). Die Menge an Strom (in kud) wird gemessen und angezeigt. Die Strommenge kann auch über das Kommando `consumption` durch einen Lua Controller abgefragt werden.
Mit Hilfe eines Stromzählers können zwei Stromnetze zu einem größeren Netzwerk verbunden werden. Der Stromzähler leitet den Strom nur in eine Richtungen weiter (Pfeil beachten). Die durchgeleitete Menge an elektrischer Energie (in kud) wird gemessen und angezeigt. Dieser Wert kann auch über das Kommando `consumption` durch einen Lua Controller abgefragt werden. Die aktuelle Stromstärke kann über `current` abgefragt werden.
Der Stromzähler kann bis zu 200 ku durchleiten. Der Maximalwert ist über das Schraubenschlüsselmenü einstellbar.
@ -997,4 +997,4 @@ Die Verarbeitungsleistung beträgt ein Item alle 8 s. Der Block benötigt hierf
Die Funktion entspricht der von TA3.
[ta4_item_flow_limiter_pas|image]
[ta4_item_flow_limiter_pas|image]

View File

@ -212,7 +212,7 @@ The isolation transformer can transmit up to 300 ku. The maximum value is adjust
### TA4 Electric Meter
With the help of an electricity meter, two electricity networks can be connected to form a larger network. The electricity meter only transmits electricity in one direction (note arrow). The amount of electricity (in kud) is measured and displayed. The amount of electricity can also be queried by a Lua controller using the `consumption` command.
With the help of an electricity meter, two electricity networks can be connected to form a larger network. The electricity meter only transmits electricity in one direction (note arrow). The amount of electrical energy passed through (in kud) is measured and displayed. This value can also be queried by a Lua controller using the `consumption` command. The current current can be queried via the command `current`.
The electricity meter can pass up to 200 ku. The maximum value is adjustable via the wrench menu.

View File

@ -359,30 +359,33 @@ Please note, that this is not a technical distinction, only a logical.
- The result is block dependent (see table below)
| ident | returned data | comment |
| ------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| "state" | one of: "running", "stopped", "blocked", "standby", "fault", or "unloaded" | Techage machine state, used by many machines |
| "state" | one of: "red", "amber", "green", "off" | Signal Tower state |
| "state" | one of: "empty", "loaded", "full" | State of a chest or Sensor Chest |
| "state" | one of: "on", "off" | State of a TA4 Button |
| "fuel" | number | fuel value of a fuel consuming block |
| "depth" | number | Read the current depth value of a quarry block (1..80) |
| "load" | number | Read the load value in percent (0..100) of a accu, or battery block. |
| "load" | number | Read the load value in percent (0..100) of a tank or silo. <br />Silo and tank return two values: <br />The percentage value and the absolute value in units.<br /> Example: percent, absolute = $send_cmnd("223", "load") |
| "load" | number | Read the grid storage amount in percent (0..100) from a TA3 Power Terminal. |
| "delivered" | number | Read the current delivered power value of a generator block. A power consuming block (accu) provides a negative value |
| "flowrate" | Total flow rate in liquid units | Only for TA4 Pumps |
| "action" | player-name, action-string | Only for Sensor Chests |
| "stacks" | Array with up to 4 Stores with the inventory content (see example) | Only for Sensor Chests |
| "count" | number | Read the item counter of the TA4 Item Detector block |
| "count" | number of items | Read the total amount of TA4 chest items. An optional number as `add_data` is used to address only one inventory slot (1..8, from left to right). |
| "count" | number of items | Read the number of pushed items for a TA4 Pusher in "flow limiter" mode |
| "count" | number of units | Read the number of pumped liquid units for a TA4 Pump in "flow limiter" mode |
| "itemstring" | item string of the given slot | Specific command for the TA4 8x2000 Chest to read the item type (technical name) of one chest slot, specified via `add_data` (1..8).<br />Example: s = $send_cmnd("223", "itemstring", 1) |
| "output" | recipe output string, <br />e.g.: "default:glass" | Only for the Industrial Furnace. If no recipe is active, the command returns "unknown" |
| "input" | \<index> | Read a recipe from the TA4 Recipe Block. `<index>` is the number of the recipe. The block return a list of recipe items. |
| "name" | \<player name> | Player name of the TA3/TA4 Player Detector or TA4 Button |
| "time" | number | Time in system ticks (norm. 100 ms) when the TA4 Button is clicked |
| ident | returned data | comment |
| ------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| "state" | one of: "running", "stopped", "blocked", "standby", "fault", or "unloaded" | Techage machine state, used by many machines |
| "state" | one of: "red", "amber", "green", "off" | Signal Tower state |
| "state" | one of: "empty", "loaded", "full" | State of a chest or Sensor Chest |
| "state" | one of: "on", "off" | State of a TA4 Button |
| "fuel" | number | fuel value of a fuel consuming block |
| "depth" | number | Read the current depth value of a quarry block (1..80) |
| "load" | number | Read the load value in percent (0..100) of a accu, or battery block. |
| "load" | number | Read the load value in percent (0..100) of a tank or silo. <br />Silo and tank return two values: <br />The percentage value and the absolute value in units.<br /> Example: percent, absolute = $send_cmnd("223", "load") |
| "load" | number | Read the grid storage amount (state of charge) in percent (0..100) from a TA3 Power Terminal. |
| "delivered" | number | Read the current delivered power value of a generator block. A power consuming block (accu) provides a negative value |
| "flowrate" | Total flow rate in liquid units | Only for TA4 Pumps |
| "action" | player-name, action-string | Only for Sensor Chests |
| "stacks" | Array with up to 4 Stores with the inventory content (see example) | Only for Sensor Chests |
| "count" | number | Read the item counter of the TA4 Item Detector block |
| "count" | number of items | Read the total amount of TA4 chest items. An optional number as `add_data` is used to address only one inventory slot (1..8, from left to right). |
| "count" | number of items | Read the number of pushed items for a TA4 Pusher in "flow limiter" mode |
| "count" | number of units | Read the number of pumped liquid units for a TA4 Pump in "flow limiter" mode |
| "itemstring" | item string of the given slot | Specific command for the TA4 8x2000 Chest to read the item type (technical name) of one chest slot, specified via `add_data` (1..8).<br />Example: s = $send_cmnd("223", "itemstring", 1) |
| "output" | recipe output string, <br />e.g.: "default:glass" | Only for the Industrial Furnace. If no recipe is active, the command returns "unknown" |
| "input" | \<index> | Read a recipe from the TA4 Recipe Block. `<index>` is the number of the recipe. The block return a list of recipe items. |
| "name" | \<player name> | Player name of the TA3/TA4 Player Detector or TA4 Button |
| "time" | number | Time in system ticks (norm. 100 ms) when the TA4 Button is clicked |
| "consumption" | number | TA4 Electric Meter: Amount of electrical energy passed through |
| "countdown" | number | TA4 Electric Meter: Countdown value for the amount of electrical energy passed through |
| "current" | number | TA4 Electric Meter: Current flow of electricity (current) |

View File

@ -197,6 +197,8 @@ techage.register_node({"techage:ta4_electricmeter"}, {
return math.floor((nvm.units or 0) / techage.CYCLES_PER_DAY)
elseif topic == "countdown" then
return math.floor((nvm.countdown or 0) + 0.5)
elseif topic == "current" then
return math.floor((nvm.moved or 0) + 0.5)
else
return State:on_receive_message(pos, topic, payload)
end
@ -209,8 +211,10 @@ techage.register_node({"techage:ta4_electricmeter"}, {
if topic == 146 then
if payload[1] == 0 then -- Consumption
return 0, {math.floor((nvm.units or 0) / techage.CYCLES_PER_DAY)}
else -- countdown
elseif payload[1] == 0 then -- countdown
return 0, {math.floor((nvm.countdown or 0) + 0.5)}
else -- current
return 0, {math.floor((nvm.moved or 0) + 0.5)}
end
else
return State:on_beduino_request_data(pos, topic, payload)