michael nist. system software design mcu (2): cy8cplc20 8-bit 32 kb flash, 2 kb sram bus...

21
HOME AUTOMATION CONTROL OVER POWER LINE SOFTWARE SYSTEM DESIGN Michael Nist

Upload: constance-singleton

Post on 18-Jan-2016

226 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

HOME AUTOMATION CONTROL OVER POWER LINE

SOFTWARE SYSTEM DESIGNMichael Nist

Page 2: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

System Software Design

MCU (2): CY8CPLC20 8-bit 32 KB Flash, 2 KB SRAM

Bus Frequency: 24 MHz Memory requirements:

Main Controller: 24 KB Flash, 2 KB SRAM Outlet Controller: 24 KB Flash, 2 KB SRAM

Resources Used: Main Controller: 13 GPIO, PLC Outlet Controller: 5 GPIO, PLC

Page 3: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

MAIN CONTROL UNIT

Page 4: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

Timeslice Kernel - Tasks

Start Task Key Task User Interface Task Transmit/Receive Task WaitForSlice

Page 5: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

Start Task

Initializes the system on startup and sets initial registers.

Execution Time: 100 mS

Period: Runs only on startup

Page 6: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

Key Task

Recognizes key presses on the push buttons and changes to the state of the user switches

Performs switch de-bouncing Execution Time:

<5 uS Period

20 mS (Sporadic)

Page 7: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

UI Task

Handles the user inputs Maintains the current state of the system Writes to the LCD Execution Time:

5 mS Period

100 mS

Page 8: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

Transmit/Receive Task

Handles the communication between controllers

Receives power measurement calculations Transmits instructions to turn the appliance

on/off Execution Time:

10 mS Period

1 Sec

Page 9: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

WaitForSlice Task

Fills time between slice periods

Page 10: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

CPU Load

L = 5uS/20mS + 5mS/100mS + 10mS/1S = 6.03%

Page 11: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

ModulesModule Task Public Functions and Data

Main.c Start TaskWaitForSliceUI Task

CurrentPower

PLC.c TX/RX Task TogglePower()

Button.c Key Task ButtonUpButtonDownButtonLeftButtonRightButtonOKSwitchEn

Page 12: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

Data Flow

Buttons

LCD

TX/RX Task

Key Task

UI Task

ButtonUpButtonDow

nButtonLeftButtonRigh

tButtonOK

SwitchEn

TogglePower()CurrentPow

er

Hardware

Powerline

PLC.c

Main.c

Button.c

Page 13: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

OUTLET CONTROL UNIT

Page 14: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

Kernel – Outlet Control Unit

Start Task Key Task WaitForSlice Transmit/Receive Task Power Measurement Task Switch Task

Page 15: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

Transmit/Receive Task

Handles the communication between controllers

Transmits power measurement calculations Receives instructions to turn the appliance

on/off Execution Time:

10 mS Period

1 Sec

Page 16: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

Power Measurement Task

Acquires data from ADC sensing current Acquires data from ADC sensing voltage Performs calculations to determine power

usage then stores the value Execution Time:

150 mS Period:

1 sec

Page 17: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

Switch Task

Activates or deactivates the relay to switch the outlet on/off if register set

Execution Time: 10 uS

Period 1 sec

Page 18: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

CPU Load

L = 5uS/20mS + 10mS/1S + 150mS/1S + 10mS/1S = 17.03%

Page 19: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

ModulesModule Task Public Functions and Data

Main.c Start TaskWaitForSlice

PLC.c TX/RX Task SendPower()

Button.c Key Task SwitchEnSwitchOverride

Power.c Power Measurement Task VrmsIrmsPowerGetPower()

Switch.c Switch Task TogglePower()GetState()PowerState

Page 20: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

Data Flow

Current ADC

Voltage ADC

Hardware

Powerline

Power Task

Switch Task

TX/RX Task

Relay

Key TaskSwitch

es

SendPower()

Vrms

Irms

Power

SwitchOnSwitchOverri

de

PowerState

GetPower()

TogglePower()

GetState()

PLC.c

Power.c

Button.c

Switch.c

Page 21: Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:

QUESTIONS?