Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - tincan

#1
Help / Re: Multicell objects and power transmission
January 21, 2016, 07:23:55 PM
Hm, ok sorry for not being more specific: i have the following problem;
I wanted to build a 1x2 object where the first cell is conducive all the time, so the object is always connected to the grid on that his side.
The conductivity of the other cell should be toggleable by program code.

I guess that won't be easy to achive.

The ultimate goal is to have a diode like switch, but I only got as far as to mod a power sensitive switch that's disconnects at a negative power production. But to check if the reconnecting requirements are fulfilled it will need to reconnect, which will result in a 50% duty cycle if the requirements are not met.

I just thought about this solution:
letting the object check the adjoining cell for power transmitters and if so, reading its grid status and then setting its own conductivity based on the results.

I will report of my findings, and thanks for the input.
#2
Help / Multicell objects and power transmission
January 20, 2016, 04:15:12 PM
Lets say I have a power transmitting object, e.g. the battery.
It's size is 1x2 and both cells can transmitting power to cardinal cells around them.
Is it possible to toggle the conductivity of each cell of the object individually?
#3
Unfinished / [A12d] [WIP] Power Grid improvements
January 20, 2016, 08:58:57 AM
Many People including me are thinking about improving their power grids by linking different important grids by means of a diode.
This would allow to use surplus power from a low priority grid in a higher priority grid.
At the moment I'm modding an automatic switch that can act depending on the grid status (power production positive or negative) to disconnect nonessentials.
This is not exactly what a diode does, but I think it's the easiest way to achieve priorities.
I stil have some bugs to fight but I hope I can give you a first version soon.

I also though about a object drawing that much power on one side to satisfy power needs on the other side, but the load distribution is giving me headaches. I will still try this one time.

And for the next project I'm planning to extend the switch to a UPS Controller that integrates blackout prevention, battery charger and surge protection.
Because Fuses only save batteries from blowing up but not from draining in a case of surge, and I'm sick of connecting fully charged backup batteries to the grid manually.
#4
Help / Re: How to get connected Rate?
November 12, 2015, 12:08:26 PM
My Code is not really finished, so I dont think it will help.

the thing is: stringBuilder.Append(base.GetInspectString()); is producing the Grid Status Text, but i only need the number.
So The Building_PowerSwitch lets it's parent class do the job. So I was looking in Building but no methode there, but another parent class 'ThingWithComps' and whoa:
public override string GetInspectString()
    {
      StringBuilder stringBuilder = new StringBuilder();
      stringBuilder.Append(base.GetInspectString());
      stringBuilder.Append(this.InspectStringPartsFromComps());
      return stringBuilder.ToString();
    }
protected string InspectStringPartsFromComps()
    {
      StringBuilder stringBuilder = new StringBuilder();
      for (int index = 0; index < this.comps.Count; ++index)
      {
        string str = this.comps[index].CompInspectStringExtra();
        if (!GenText.NullOrEmpty(str))
          stringBuilder.AppendLine(str);
      }
      return stringBuilder.ToString();
    }

ok first line produces a new empty string, second calls methode of parent again  :o , third calls the  InspectStringPartsFromComps methode of itself.
So i went to "thing" and: 
public virtual string GetInspectString()
    {
      return string.Empty;
    }

funny  ??? so i followed CompInspectStringExtra to CompPower and found:
public override string CompInspectStringExtra()
    {
      if (this.PowerNet == null)
        return Translator.Translate("PowerNotConnected");
      return Translator.Translate("PowerConnectedRateStored", (object) (this.PowerNet.CurrentEnergyGainRate() / CompPower.WattsToWattDaysPerTick).ToString("F0"), (object) this.PowerNet.CurrentStoredEnergy().ToString("F0"));
    }

eureka!
So i was able to use PowerNet.CurrentEnergyGainRate() but It just gives me 0 which actually was wiered in a running simulation(i used Dark matter generator mod), untill i checked non modded parts of the Power Grid with the debug inspector and they also show 0 created energy, stored energy and so on, the only thing which seems to work is haspowersource...
So what am i doing wrong, the infobox has to get it' numbers from somewhere else?  :o :'(
#5
Help / How to get connected Rate?
November 09, 2015, 02:13:10 PM
Hey there, can anyone tell me how to get the number of the connected rate (power grid) ?

I'm trying to build a diode like autoswitch, which disconnects at a negative rate splitting the grid. Afterwards connecting every few seconds for a tick, checking if the rate is positive so that the switch can stay connected again...

As far I've identified the code that produces the Inspect string of that Value(ingame info about Grid Status), but that just refers somewhere else in the code where the magic happens which i don't find at the moment  :(