System Design (MPPT)

This document describes the current operating structure and system design of the Sunscatter Gen II PCB. It defines the tasks that should be run, the inputs and outputs of the device, and the necessary communication protocols to interface with other systems.


System design

graph TD;
    MCU-->GATE_DRIVER-->BOOST_CONVERTER
    MCU-->VOLTAGE_SENSORS
    MCU-->CURRENT_SENSORS
    MCU-->OTHER_SYSTEMS

The systems consists of a STM32 L432KC low power microcontroller sampling two pairs of voltage and current sensors at the Array input and Battery output. It gathers this data, processes it, and adjusts the PWM signal that drives a gate driver and controls the DC-DC Boost Converter. It also broadcasts and communicates sensor data to subscribed (pub-sub) participants.


Program execution

This device runs on a HLFSM, in which there are three states, STOP, RUN, and ERROR. Transition between these states depend on error occurrence and the latest SET_MODE and ACK_FAULT CAN messages, described further in section Communication.

Program execution:

  • 1 Hz cycle of HEARTBEAT LED to indicate liveliness
  • Messages for the Sunscatter are captured and interpreted asynchronously.
  • Voltage and Current sensors are measured at a fixed internal rate and broadcasted to other boards via CAN at a known external rate.
    • Default 1 Hz external rate.
    • Default 1 Hz internal rate, dependent on 0x608.

STOP mode:

  • Measurements are active.

RUN mode:

  • When in the RUN mode, TRACKING LED is ON.
  • Internal MPPT algorithm controller is tracking for optimal power conversion.

ERROR mode:

  • When in the ERROR mode, ERROR LED is ON.
  • The internal MPPT algorithm controller is disabled and PWM_EN is off. Converter is open circuit.
IS_ERROR = E
SET_MODE = M
ACK_FAULT = A
stateDiagram
    [*]   --> STOP
    [*]   --> ERROR:  E=1
    STOP  --> RUN:    E=0, M=1
    STOP  --> ERROR:  E=1
    RUN   --> ERROR:  E=1
    RUN   --> STOP:   E=0, M=0
    ERROR --> ERROR:  A=0
    ERROR --> STOP:   A=1

The overall system runs on an event queue; events are scheduled in this queue and run on demand. We have several event generators:

  • querying voltage and current sensors,
  • running the MPPT algorithm controller,
  • changing state machine state,
  • processing CAN messages.

EG stands for event generator.

TODO: add sequence diagram; see Blackbody A.


Communication

Sunscatter Version 0.2.0 is meant to be for three separate subarrays on the 2024 Solar Vehicle. As such, each Sunscatter is delineated by the second nibble in the CAN ID as follows:

  • Sunscatter A: 0x60X
  • Sunscatter B: 0x61X
  • Sunscatter C: 0x62X

CAN messages:

ADDRESSNAMEDIRECTIONNUM BYTESDESCRIPTION
0x6X0HEARTBEATOUT1Seconds/heartbeat cycles since startup.
0x6X1SET_MODEIN10x00 -> STOP, 0x01 -> RUN. BOARD OVERRIDE EN/DIS
0x6X2SS_FAULTOUT2Error code, see ERRORS
0x6X3ACK_FAULTIN10x01 -> Ack fault and return to STOP state
0x6X4SEN_CONF1IN5MSB: enabled sensors; LSB(3): Sensor filter type. LSB(2): Sensor filter length, in samples. LSB(0-1): Sensor sampling freq, in Hz.
0x6X5SEN_CONF2IN5MSB: enabled RTDs; LSB(4): Sensor slope correction, float
0x6X6SEN_CONF3IN5MSB: enabled RTDs; LSB(2): Sensor Y-int correction, V/A
0x6X7CON_CONFINN/AController configuration. RESERVED. Not yet Defined.
0x6X8DEB_CONFIN1Debug configure. See notes. Level of CAN debug output
0x6X9OP_SETOUT8MSW: Freq. Setpoint in Hz, float; LSW: Duty cycle Setpoint, float
0x6XAARRV_MEAOUT4Voltage in Volts, float
0x6XBARRI_MEAOUT4Current in Amps, float
0x6XCBATTV_MEAOUT4Voltage in volts, float
0x6XDBATTI_MEAOUT4Current in Amps, float

If a fault has occured, then the controller must acknowledge the fault (ACK_FAULT=1) and then restart sampling by setting the mode to RUN (SET_MODE=1). BPS shall use SET_MODE as the BOARD_OVERRIDE ENABLE/DISABLE command. This is highest priority signal. NOTE Default filter is median filter with 10 wide window. No current support for dynamic filter generation. LEAVE SEN_CONF1 UNUSED. NOTE CON_CONF is not implemented, LEAVE UNUSED.

The MSB of SEN_CONF1, SEN_CONF2, and SEN_CONF3 is a bit packed struct indicating which sensors are selected; e.g. for SEN_CONF1 MSB:

0bxxxx_0001

Battery current sensor selected. The ordering is left to right matching with top to bottom on the table.


ERRORS

NUMBERDESCRIPTION
000No fault.
100Input undervoltage lockout
101Input overvoltage lockout
102Input undercurrent lockout
103Input overcurrent lockout
104Output undervoltage lockout
105Output overvoltage lockout
106Output undercurrent lockout
107Output overcurrent lockout
108Input/Output voltage inversion
109PWM under duty cycle lockout
110PWM over duty cycle lockout