I am using custom hardware driven by a TIVA TM4C (specifically, EK-TM4C123GXL) to control a microgrid with battery energy storage, solar panels, four loads controlled by relay, and a SIM900 GSM GPRS module. Users can push buttons to toggle relays, or send an SMS to toggle relays.
Three ADCs are recording battery voltage, total load current, and total load power.
I want to periodically log the relay states and ADC voltages - say once per minute. Each time the user toggles a relay (either by switch or SMS) I want to log this as well.
Then, every hour or so, I will send this data as a packet of data points via GPRS to my server.
With all of this data I can compare to solar radiation databases to see if my microgrid management algorithm is performing optimally (allowing full use of power during the day, preserving enough power through the night, keeping the batteries healthy, acting on SMS input promptly, etc).
I am writing C code using Keil u4.
Here are the questions/concerns I have:
- Do these time intervals make sense? Should I log more or less often? Transmit more or less often? What questions should I ask to figure this out?
- Should I use EEPROM to do this, or just hold the values in memory for a while before transmitting? The system is in a lab environment so I'm not too concerned about external factors upsetting hardware.
- What's the best way to implement timers? I have several 32-bit timers with 16-bit subtimers, and several 64-bit timers with 32-bit subtimers. I'm unclear on how/why to use different timer arrangements for different tasks.
I've worked with each of these pieces individually, but wondering what the best means to implement them all together is.