dr robert turner, r&d, abb napier. 10 may 2016 matlab ...€¦ · setting the scene we build...

22
MATLAB Conference Auckland 2016 MATLAB Simulink Code generation for industrial inverters: myths & techniques Dr Robert Turner, R&D, ABB Napier. 10 May 2016

Upload: others

Post on 10-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

MATLAB Conference Auckland 2016MATLAB Simulink Code generation forindustrial inverters: myths & techniques

Dr Robert Turner, R&D, ABB Napier. 10 May 2016

Page 2: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

AC 800PEC Product PresentationIntroduction

May 16, 2016 | Slide 2© ABB Group

§ Setting the scene

§ Control model development the “old way”

§ Its problems

§ Scaling up

§ Code generation for control models

§ Simulate all parts of system

§ Modelling philosophy

§ Code generation

§ What to expect

§ Myths

§ What we’ve achieved

Goal: Productivity gains through automation

Page 3: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

Setting the scene

We build large grid-connected inverter products byconnecting many smaller inverters in parallel

§ Each inverter is smart

§ System controller performs application control &interface

§ Each inverter is 250kVA @ 480VL-L, RMS

§ Systems can be further paralleled!

What we make and why we need code generation

May 16, 2016 | Slide 3© ABB Group

Page 4: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

May 16, 2016 | Slide 4© ABB Group

Page 5: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

May 16, 2016 | Slide 5© ABB Group

2 x HUB link (redundant)

SYSTEM 1

SYSTEM 2 SYSTEM 3 SYSTEM (n)

Ringed Master link Ringed Master link

Master Controller HUB Controller

SYSTEM I/O

PEBB (1,1)

PEBB (1,2)

PEBB (1,3)

PEBB (1,4)

PEBB (1,5)

PEBB (1,6)

PEBB (2,1)

PEBB (2,2)

PEBB (2,3)

PEBB (2,4)

PEBB (2,5)

PEBB (2,6)

PEBB (3,1)

PEBB (3,2)

PEBB (3,3)

PEBB (3,4)

PEBB (3,5)

PEBB (3,6)

PEBB (4,1)

PEBB (4,2)

PEBB (4,3)

PEBB (4,4)

PEBB (4,5)

PEBB (4,6)

LOCAL PEBB’s REMOTE PEBB’s

Page 6: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

Setting the scene

§ Smart PEBBs with best-in-industrycontrol algorithms§ High control bandwidth

§ Ensure all working together &accurately share current

§ Individual diagnostics & protections

§ Different operating modes

§ System controller§ Coordinate PEBBs coming & going

§ Application functionality

§ Inter-system application coordination

Many parts, many control algorithms

May 16, 2016 | Slide 6© ABB Group

2 x HUB link (redundant)

SYSTEM 1

SYSTEM 2 SYSTEM 3 SYSTEM (n)

Ringed Master link Ringed Master link

Master Controller HUB Controller

SYSTEM I/O

PEBB (1,1)

PEBB (1,2)

PEBB (1,3)

PEBB (1,4)

PEBB (1,5)

PEBB (1,6)

PEBB (2,1)

PEBB (2,2)

PEBB (2,3)

PEBB (2,4)

PEBB (2,5)

PEBB (2,6)

PEBB (3,1)

PEBB (3,2)

PEBB (3,3)

PEBB (3,4)

PEBB (3,5)

PEBB (3,6)

PEBB (4,1)

PEBB (4,2)

PEBB (4,3)

PEBB (4,4)

PEBB (4,5)

PEBB (4,6)

LOCAL PEBB’s REMOTE PEBB’s

Page 7: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

Translate• Discretise• Floating to fixed

point• Identify standard

blocks

Code• Write blocks• Copy-paste for

each phase

Debug• Identify

differencesbetweenimplementation& sim

• Update sim

Simulate• Develop & test

controlalgorithms

The “old way”Problems

May 16, 2016 | Slide 7© ABB Group

Prone tohuman error

Timeconsuming& redundant

Page 8: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

Simulation Productivity

§ For a simulation with closer match to hardware need tomodel all functional parts:

§ Controllers & communications – where codegeneration comes in

§ Interfaces (ADCs, PWM etc)

§ Plant (electrical, mechanical etc)

§ For simulation speed, component models can often besimplified for frequencies-of-interest. Potentially simplify:

§ Component parasitcs. Are they necessary?

§ “Really fast” blocks eg FPGA IP like PWMmodulators. For closed-loop control algorithms alinear modulator which accurately captures effectivedelays is sufficient and achieves a huge simulationspeed-up

§ ADCs. We probably don’t really need to model theinternals of a SAR ADC!

Simulation matching the hardware

May 16, 2016 | Slide 8© ABB Group

Page 9: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

Modelling Philosophy

None• No abstraction; everything at

the top level

Temporal• Grouped based on sample

rates

Domain• Grouped based on domain,

eg control and electrical

Functional• Parts of module are grouped

because they contribute to awell-defined task

Model cohesion

May 16, 2016 | Slide 9© ABB Group

Cohesion: the degree to which the elements of a module belong together

Page 10: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

Code Generation

§ Modelling philosophy underpins long-term maintainability andproductivity

§ Going beyond “little” Simulink models

§ Concepts from software engineering. Many can write c / c++,but not many can write good c / c++

§ Strive for functional cohesion

§ With effort, Simulink can achieve functional cohesion

§ Simulink Project nesting assists in organisation & reuse

§ Heavy use of libraries and model references

§ Careful consideration of physical domain modelling

Modelling Philosophy

May 16, 2016 | Slide 10© ABB Group

Page 11: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

Making code generation work for you

§ The big one: Code generation must be less efficient than hand written

§ By definition, substitution must be as good, so benchmark is that codegen is at least as good

§ Code gen can make optimisations that allow model verbosity butproduce optimum code

§ What about Fixed Point?

Myths

May 16, 2016 | Slide 11© ABB Group

Page 12: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

Making code generation work for you

§ Productivity gains, and not just from where you expect them§ Rapid change turn around

§ Good bye human errors!!!!!

§ There are still risks that simulation can’t capture!

What to expect

May 16, 2016 | Slide 12© ABB Group

Page 13: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

What we’ve achieved

§ Truly functional components

§ Library of functional components with same interfaces as hardwarecounterparts

§ Simulation harnesses targeting different aspects

§ Single & multiple inverter performance

§ Thorough inter-inverter communication tests

§ Automated regression tests

§ Single & multiple inverters in a product with different grid & load conditions

§ Typical product model has:

§ ~10 Simulink Projects

§ ~10 libraries (each with automated or manual test harnesses)

§ Many grid scenario harnesses

§ Developer productivity is easily order-of-magnitude higher

May 16, 2016 | Slide 13© ABB Group

Page 14: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

Code gen for controllers

May 16, 2016 | Slide 14© ABB Group

Transformer

Rectifier Inverter

MasterController

Transformer

Rectifier Inverter

MasterController

Bus 2eg Ship bus

Bus 1eg grid

Page 15: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

System simulation harnesses

§ Simulation and code geneneration of system & products.

§ Simulate integration with customer grid, load and other systems

May 16, 2016 | Slide 15© ABB Group

Transformer

Rectif ier Inverter

MasterController

Transformer

Rectifier Inverter

MasterController

Bus 2eg Ship bus

Bus 1eg grid

Page 16: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

§ Simulatable functional blocks include allfunctional parts. For example a PEBB, aPEBB cabinet, or complete product

§ Blocks have functionally equivalent portseg communications & electrical ports (andmonitoring)

§ Including:§ Code-generation model (Model Reference)

§ Interface (including FPGA sim)

§ Electrical circuit (Plecs / SimScape)

Modelling layoutFunctional cohesion

May 16, 2016 | Slide 16© ABB Group

Page 17: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

§ Nest functional blocks. For example PEBBsinside cabinet; PEBB cabinets & master &electrical in product; multiple products in asystem harness

Modelling layoutSystem functional cohesion

May 16, 2016 | Slide 17© ABB Group

System

Product

PEBB cabinet

Page 18: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

May 16, 2016 | Slide 18© ABB Group

Communicationsharness

Page 19: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

What we’ve achieved

§ Simulink is pretty good for developing communications protocols

§ Communications is fundamentally data flow

§ Area of Simulink getting development attention – some workflows neededmassaging to ensure efficiency

§ Invaluable being able to simulate bugs found on the hardware

§ Simulation of non-controller parts (eg FPGA) good for proving interface specs

§ For large & long-term developments, refactoring efficiency is key

§ Programmers have different abilities

§ Concepts evolve

§ Eases transition from rapid development to structured

Some unexpected awesomenesses

May 16, 2016 | Slide 19© ABB Group

Page 20: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

Simulink Code Generation

§ With careful modelling layout consideration, Simulink canachieve functional cohesion, which is key for large projects

§ Code generation offers huge productivity improvements

§ Safer than hand coding

§ More efficient than hand coding

§ Having 1-to-1 model of hardware is invaluable for rapidcontroller development

Conclusions

May 16, 2016 | Slide 20© ABB Group

Page 21: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel

Simulink Code Generation

Discussion

May 16, 2016 | Slide 21© ABB Group

Page 22: Dr Robert Turner, R&D, ABB Napier. 10 May 2016 MATLAB ...€¦ · Setting the scene We build large grid-connected inverter products by connecting many smaller inverters in parallel