Circuit Logger 0.16 Update

by Gentz
For logging circuit network signals on each tick.
1 year, 3 months ago
0.16
524
Owner: Gentz
Source: N/A
Homepage: N/A
License: MIT
Created: 1 year, 3 months ago
Latest Version: 0.16.8 (1 year, 3 months ago)
Factorio version: 0.16
Downloaded: 524 times

Circuit Logger - 0.16 Update

Update of this mod.

Adds an entity that allows log circuit network signals in wires connected to that entity.

Features:

  • Writes the values of all the signals connected to the circuit logger (via either red wires and/or green wire) into a csv file.
  • Allows you to specify signals that will not be logged either globally for all loggers or individually for some loggers or both.
  • Includes the ability to aliases signals of your choice and the ability to name loggers.
  • Allows parsing of "binary" signals and logging specified bits to separate columns.
  • Includes the ability to set up triggers that will turn logging on/off automatically after certain time or based on some circuit condition.

How to use it:

  1. Build the circuit loggers and connect them to the network.
  2. Click on the logger and specify what to log.
  3. Either setup some triggers or start logging manually (or both!)
  4. When logging stops (either due to a trigger or due to manual intervention), a csv file called "<start tick>-<end tick>.csv" will be saved to the folder "script-output/circuit_logger"

Description of the Circuit Logger Settings window:

  • Name: the name of the logger that will be visible in the output file
  • Column #: the logger's place in the output file
  • Start trigger: If we should or should not start logging as soon as a condition is met
  • Stop trigger: If we should or should not stop logging as soon as a condition is met. Will be ignored if logging is on is set.
  • Logging is on: If set, logging will continue as long the condition is met, regardless of any "stop trigger" events. Logging will stops when the condition is not met any more.
  • Log red wire: Logs all signals from the red wire connected to this logger separately.
  • Log green wire: Logs all signals from the green wire connected to this logger separately.
  • Log both combined: Logs the sum of all signals from the green wire and all signals from the red wire.
  • Ignored signals: A comma separated list of all the signals which you want ignored by this logger. See section bellow for more details.
  • Signal aliases: A list of custom names for the specified signals and the ability to configure binary types. See section bellow for more details.
  • Update: Click to update this logger's settings.

Description of the Global Circuit Logger Settings window:

  • Status: Status of logging; the logger that triggered the last status change is displayed in parentheses.
  • Logged records: Number of records in the current log
  • Stop trigger after... (ticks): If checked, it will stop logging after a specified number of ticks from the last "start trigger" event. Each "start trigger" event during logging will reset counter of remaining ticks.
  • Ignored signals: A comma separated list of all the signals which you want ignored by all loggers. See section bellow for more details.
  • Update: click to update the logger settings.
  • Start trigger: press to start logging (regardless of any triggers defined).
  • Stop trigger: press to stop logging (will not work if a "logging on" condition is met for any logger).

Ignore Signals

In this field, you should list all the signals you want ignored. You MUST use Factorio's internal signal name, not the localized name. You MUST NOT use any spaces. This field is case sensitive.

Examples - Valid

signal-red,signal-A,diesel-locomotive
signal-cyan

Examples - Invalid

signal-red, signal-A (extra space)
cyan (localized name)
Signal-red (capitalization)

Signal Aliases

A comma separated list of all signal aliases you want. You MUST use Factorio's internal signal name, not the localized name. You MUST NOT use any spaces around the signal names. You MUST NOT include the following characters in your alias: "{},;=:" This field is case sensitive.

Examples - Valid

signal-red=Beep,signal-A=Roman apples,diesel-locomotive=Happpppy!!
signal-cyan=Die

Examples - Invalid

signal-red=Hiii, signal-A=Tomato (extra space)
red=Line Busy (localized name)

Binary signals:

Binary signals are special aliases which tell as to interpret certain signals as binary values.

Format:

They shall be formatted as follows: iname={b1:dname1;...;bn:dnamen}
- The order of bits is not important. It is not necessary to specify all 32 bits.
- iname: the internal Factorio name for the signal.
- b: The index of the bit. Starts at 0 (LSB) and goes to 31 (MSB).
- dname: the alias for this bit.

Example:

signal-A={1:Require items;2:Items sent};signal-B={3:Minutes tick;1:Seconds tick}

Change log:

0.16.8: Sneaky fix
0.16.7: Fixed a bug. Saves with a version before 0.16.3 might be broken. Upgrading to any version between 0.16.3 and 0.16.7 (inclusive) before upgrading to this version will get around that.
0.16.6: Started counting bits from 0 plus other random changes.
0.16.5: Some refactoring
0.16.4: Added the ability to specify the column #. Now you can reorder your loggers without tearing them up and replacing them.
0.16.3: Fixed one bug where when setting a circuit condition and you had an empty wire it would cause it to crash.
Also reformatted the code.
0.16.2: This one should work
0.16.1: Lol, I fucked up...
0.16.0: Updated to work for 0.16
1.0.0: Circuit Logger was created

Ideas for future development:

  • "pretrigger" - logs also signals from a specified time frame before the current logging was triggered (either manually or because a condition had been met)
  • in case of longer logs, write data to the file in chunks so that lags in the game are avoided when logging is finished
  • make the logger's settings be copyable via blueprints and/or shift clicking