G
G
Georgy Pelageikin2015-06-18 18:12:51
Programming
Georgy Pelageikin, 2015-06-18 18:12:51

Algorithm for the distribution of "energy" from the "generator"?

Hello. There is, say, a spaceship. It has some equipment that consumes energy and a generator that produces it. The equipment can be changed, the distribution of energy also needs to be regulated. I think how it is logical and universal to implement this - so that the condition consumption <= generation, etc. is always observed. I don’t even know how to approach, I need some general idea.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Stalker_RED, 2015-06-18
@Stalker_RED

The general idea: periodically calculate the total consumption, and if it is lower than the generation ... then options are possible, depending on how realistic you want to do everything.
You can simply turn off a certain number of consumers.
You can reduce the "quality" of electricity (voltage, frequency). Some appliances may run on reduced power while others will shut down.

V
Vitaly Pukhov, 2015-06-19
@Neuroware

It is not clear in the context of what the task is, in general it is easiest to implement on cellular automata.
An array of objects of a certain class is created, in which some objects can "generate" energy, others can "consume", third ones can "transmit", and still others can "regulate the supply". The whole "difficulty" will be only in finding a way from the "consumer" to the generators and checking in on them saying "I eat so much from you", the next "consumer" when he looks for a "generator" will look to see if the generator has available energy, if everyone is "crammed to the eyeballs" the consumer is left without energy. This, in theory, needs to be done every time the amount of "generated energy" is changed,
I can even throw off the "framework" with a ready-made cellular automaton and rendering.

A
Alexey Yeletsky, 2015-06-19
@Tiendil

Play FTL, this moment is revealed there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question