Page 1 of 1

Circuit Network and storing values for accumulator display

Posted: Tue Mar 05, 2019 9:02 pm
by AlienRaven
Hey, guys. I was using curcuit network for long time, but only for simple things, like switching power on\off if conditions are met, etc.

Just for a note, I've read everything, that is available on wiki in terms of descriptions and guides, also watched guides on youtube, but I feel like I'm stuck with my learning project and I ask for help.

Recently I wanted to dig a little deeper in circuit network magic of a little more complex things, so I decided to create something slightly more complex than I usually did, specifically the accumulator display.

This post is not about me asking for a blueprint, I'm instead interested to understand how it works through building, so later I can built something else myself.

Here's list of requirements, I've put in front of myself (green - i did it, yellow - I did it, but it doesn't work perfectly, red - I'm stuck):
  • Battery shaped lamp display with segments, representing charge, lightning up accordingly to charge percentage.
  • Lighted up segments are painted to a specific color, based on charge (<=20% - red, <=40% - yellow, >40% - green), so at a single time whole battery is just displayed with one color.
  • When exactly at 0% first segment will flash red.
  • Battery border will blink, when charging or consuming charge.
  • If its charging it blinks green, if it consumes the charge it will blink red.
  • There's an indicator, that shows the lowest value overnight, that resets next time accums charge starts to go below 100.
This is the blueprint of where I got myself so far:

Number 1 (final design)


Number 2 (test stand)


One more thing to note, I think I have an idea how to do it in terms of programming, the issue I'm having is I'm not 100% sure how to create specific things using circuit network itself.

Here's a list of my questions, that possibly someone can help me understand better:
  • How to store a value, that will stay same, disregarding of the continious input value? Like, to let CN know that accums are losing charge, I can compare A and B, where A is current charge level and B is a charge level lets say a second ago. If A<B - it is loosing charge. I tried SR latches and memory cells from tutorials on wiki, but my B is always equal to A as it changes overnight.
  • How to force pulse machine to stop outputting the value if the initial condition is not met on first decider combinator? Please see the blueprint Number 2 for it - on the right a have a solution that forces lowest row of lamps to blink, if A(ccumulator charge)=0. It does so, but if A will raise above 0, when the pulse had negative value - it will continue to output that negative value, which will cause the lamps to be disabled due to enabled condition for A be greater or equal than 0 to light.
I was able to find this guide: https://www.youtube.com/watch?v=WtKIx-JKxtY, I even get the logic of the works, but the suggested blueprint is not working in 0.17.5, because as I can tell of the same issue - because somehow B value from charge is always equal A in the network.



This design, I've found on reddit seems to work, but its such a compact mess of combinators and wires, I'm just banging my head against the wall, trying to understand how it works.

Re: Circuit Network and storing values for accumulator display

Posted: Sun Mar 10, 2019 5:17 am
by AngledLuffa
How to store a value, that will stay same, disregarding of the continious input value? Like, to let CN know that accums are losing charge, I can compare A and B, where A is current charge level and B is a charge level lets say a second ago. If A<B - it is loosing charge. I tried SR latches and memory cells from tutorials on wiki, but my B is always equal to A as it changes overnight.
Each operation in the circuit network takes 1 tick, so you can simply connect a combinator to one of the accumulators and output A+0 -> B. The next combinator can connect to the accumulator and the first combinator and use B-A to get charging, discharging, or 0 as a pulse. Since the accumulators have a granularity of 100 on their charge meter, you'll have to flash based on any pulses you've seen in the last X ticks where X is some suitable number you can figure out.

Re: Circuit Network and storing values for accumulator display

Posted: Mon Mar 11, 2019 7:30 pm
by AlienRaven
AngledLuffa wrote: Sun Mar 10, 2019 5:17 am Each operation in the circuit network takes 1 tick.
Ok, after some brainstorming and further googling, I think I was able to make almost everything to work. Here's the description of what I've finally done:
  • Battery shaped lamp display.
  • Three indicators to display: current charge level (multicolor display inside), last night minimum charge level (purple display inside) and current battery state (border color).
  • Current charge level is represented by colors: green is > 52%, yellow is <= 52%, red is <= 24%, blinking red is 0%.
  • Current battery state is represented by colors: green is full charge, yellow is charging, red is consuming charge. I discarded blinking here as it was a bit too much of special effects.
  • After getting it to work I also compressed all combinators to look nice by the side of the display.
Important: The whole system requires at least 1 day\night cycle to pass to initialize and work properly.

The biggest benefit I was able to achieve compared to similar displays, that is does not use any timers, that have to be adjusted. Instead it resets everytime accumulators start to lose charge.

Known issues to fix for future:
  • Last night minimum charge level is 1-2 points above actual value.
  • When accumulators are losing charge red indication sometimes blinks yellow for a tick.
Here's resulting blueprint, if anyone will be interested:

Re: Circuit Network and storing values for accumulator display

Posted: Sat Mar 16, 2019 5:03 am
by AngledLuffa
I like it. Way too big, but that's part of the fun :)

Re: Circuit Network and storing values for accumulator display

Posted: Sat May 11, 2019 10:46 pm
by AlienRaven
I finally finished it with most problems now being solved. Posted the final version in Show Your Creations section. viewtopic.php?f=193&t=70715.