• No results found

Verification by. Simulation. Verification by. Simulation. Verification by. Simulation / Model Check. Validation and Testing.

N/A
N/A
Protected

Academic year: 2021

Share "Verification by. Simulation. Verification by. Simulation. Verification by. Simulation / Model Check. Validation and Testing."

Copied!
9
0
0

Loading.... (view fulltext now)

Full text

(1)

Broenink et al Design of distributed embedded Systems – gCSP

1 University of Twente

Embedded Control System Implementation:

Method and Co-Simulation

Jan F. Broenink

, Pieter Maljaars

with contributions of

Marcel Groothuis, Peter Visser,

Bojan Orlic, Dusko Jovanovic, Gerald Hilderink

Control Engineering, CTIT, Faculty EE-M-CS, University of Twente, Enschede, Netherlands

e-mail: [email protected], web: www.ce.utwente.nl/bnk

2 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

gCSP – Course Overview

Introduction & Context

Setting the scene: embedded control systems software

Showcase: Production Cell

CSP and gCSP

Basics of the process algebra – practical point of view

gCSP the tool / techniques

Exercises I

gCSP, basics, simple control example

Method & CTC++

Design method

Underlying execution framework

Linkdrivers, timers

Exercises II

Control a robot

Wrap up

Lunch break

3 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Overview 3

rd

lecture: Design Method

Method & …

4 steps revisited and detailed

Focus on Embedded Software -> exercise

… Techniques

Co-simulationHardware-in-the-Loop Simulation

Cases

On Co-simulationOn Hardware-in-the-Loop Simulation

Overview

4 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Layered Structure of Controllers

Timing

Hardreal time

Safety,

Loop Controllers, Sequence Controllers (set point generators)Softreal time

Sequence Controllers, Supervisory Controller, User Interface

Computer I/O Plant

hard soft

(2)

5 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Design Approach

Integrated Models

Discipline-specific models connected

Total system (embedded + embedding!)

Virtual Prototyping = Simulation

Layered structure of controllers

Continuous time & discrete event

Stepwise Refinement

Physical Systems modeling

Control law Design

Embedded Control System Implementation

»Gradually enhance laws to code

Realization (software)

Tools needed

Extendable / updatable models & software

Total system (embedded + embedding!)

Physical System Modeling Control Law Design Embedded Control System Implementation Verificationby Simulation / Model Check Realization Validation and Testing Verification by Simulation Verification by Simulation recall

6 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Embedded Control System Implementation – Approach

Design method for ECS (software)

Stepwise Refinement »intrinsically iterative

Verification via

»Simulation / Co-Sim. / X-in-the-Loop Sim. (hardware / software) »Formal verification: model checking on deadlocks

Design Space Exploration

»To support decisions on design choices

Concurrent engineering / Mechatronic approach

“Doing first time right” -> as little test time on target machine as possibleStepwise Refinement

Physical Systems modelingControl law Design

Embedded Control SoftwareImplementation »Gradually enhance laws to code

Realization (software) Physical System Modeling Control Law Design Embedded Control System Implementation Verificationby Simulation / Model Check Realization Validation and Testing Verification by Simulation Verification by Simulation

ECS implementation

Design Trajectory

CTC++ 4C 20-Sim Matlab 20-Sim gCSP FDR POOSL

Focus on ECS Software

Model BasedStepwise Refinement Physical System Modeling Control Law Design Embedded Control System Implementation Verificationby Simulation / Model Check Realization Validation and Testing Verification by Simulation Verification by Simulation recall

Physical Systems Modeling / Control law Design

Physical Systems Modeling

Goals of Competent Model

»Understand dynamics »Derive control laws »Test system

Generate detailed model »Library blocks

Verifymodel by simulation »Model parts

»Tests suitable for validation

Validateby measurements

Control Law Design

Simplified Model » Model reduction » Model linearization

Verify Simplified Model » Compare to detailed model

Derive Control Law(s) » Use simplified model

Verify Control Law(s) » Use detailed model

Combine Control Laws

Controller I/O Plant

Physical System Modeling Control Law Design Embedded Control System Implementation Verification by Simulation / Model Check Realization Validation and Testing Verification by Simulation Verification by Simulation recall

(3)

9 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Embedded Control Software Implementation

Stepwise refinement

Gradually enhance laws to code

Gradually add implementation / realization details

Working order

Integrate control laws / sequences

»Loop control laws + Sequencers + Supervisors »Power up / power down sequences

»Reaction to external commands

»Implementation assumed idealSafety, error & maintenance facilities

»External events on safety (emergency stops) »Central or component wise

Capture non-ideal components »Non-idealness added:

»Relevantdynamic behavior »Signal processing: Estimators

Non-idealness Computer hardware »HW + SW architecture, Timing aspects »Optimization, scheduling

Mix of

Process StructuresControl Algorithms Physical System Modeling Control Law Design Embedded Control System Implementation Verification by Simulation / Model Check Realization Validation and Testing Verification by Simulation Verification by Simulation hard soft

10 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Physical System Modeling Control Law Design Embedded Control System Implementation Verification by Simulation / Model Check Realization Validation and Testing Verification by Simulation Verification by Simulation

Embedded Control Software Implementation

Models & Method Steps

Models

Controller (CSP) -> code on target

Plant (bond graphs) -> simulation

Co-simulation

Discrete Event & Continuous Time

Steps in the method

1. Physical Systems modeling 2. Control law Design

3. Embedded Control Software Implementation

A. Simulated Time B. Real Time

4. Realization

11 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Embedded Control Software Implementation

Some Details -> Exercise!

Step 3 in the method

Plant model OK; Control laws OK

Gradually enhance laws to code »Integrate control laws / sequences »Safety, error & maintenance facilities »Capture non-ideal components

Working Order

1. Internal checks

2. Formal Check process logic

3. Include (control) algorithms

4. Check target code

ECS Structure Formal Check FDR2 Configure, Connect, Compile, Command CTC++ lib 1 2 3 CSPm gCSP CTC++ Control Algorithms 4 Step 1, 2

Step 3

Physical System Modeling Control Law Design Embedded Control System Implementation Verification by Simulation / Model Check Realization Validation and Testing Verification by Simulation Verification by Simulation

12 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Co-Simulation

Co-Sim with

gCSP / 20sim

Formal checks via FDR2

Using CTC++ => can be combined with other code

Synchronization via separatetimer channels / ddlcalls

Co-Sim with POOSL / 20sim (+TU/e EE)

Abstract Syntax, CCS-like

SheSim as DT simulator: good timing, but busy waiting – 100% CPU

Synchronization between tools via ddlcalls

Co-Sim with

VDM++ / 20sim

(+RUN / Chess)

Distribution / load balancing can be checked

Analysis of computer architectures

Synchronization between tools via ddlcalls

Explicit simulation of the network

(4)

13 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Co-simulation gCSP – 20sim I

Test setup: plotter

Testing Embedded Software

Experiments:

Model based design

Multiple Views »Dynamic model »Controller view »Mechanical model

»Fault-tolerant parallel CSP based software

Code generation

»Controller to CPU (RTAI Linux) »Controller to FPGA

14 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Co-simulation gCSP – 20sim II

Software design

Verification by co-simulation with 20-sim model

3D representation

Simulation plots (20-sim) HPGL file Plotter software (gCSP) Bearing2 FrictionRelative2 FixedWorld2 m Mass2 TimingBelt2

Plant model (20-sim)

PID SP MV s Controller1 Controller (20-sim) Code generation

Co-Simulation VDM++ 20sim I

VDM++

object-oriented formal model-based specification language

concurrency through threads

round-trip engineering UML

formal analysis of static and run-time (type) correctness

model validation through prototyping & structured testing

industrial grade tool support http://www.vdmtools.jp/en

VICE extension*for real time, scheduling and deployment

* [ Verhoef, Larsen, Hooman, FM 2006, LNCS 4085, pp 145 - 162 ]

(5)

17 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Co-Simulation VDM++ 20sim II

18 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Non-ideal Network: Simulate it

CSP approach

Remote Channels couple to Fieldbus

Time increment via Timer Channel

Packet Simulator based on TrueTime

Towards real-time

Remote channel & SimTimer -> Real versions Process Process Channel Sim Channel Sim Network Simulator SimTimer Process Process Channel Channel Real Network Real Timer

19 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Network Simulator - Case

Simulator OK

compared with traditional

Network parameters

Influence behavior

Optimal via simulation

20 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Towards Realization

Stepwise refinement

Software-In-the-Loop Simulation

Hardware-In-the-Loop Simulation » Real-Time Simulation

Working order

Part wise towards realization » Others still simulated

Treatment I/O essential

» Where, Grouping of functions

Useful for

Concurrent engineering » Plant simulated

SW in time, Plant late

» Code simulated

SW in time, ASIC late

Test setup » Plant simulated » For training purposes

Physical System Modeling Control Law Design Embedded Control System Implementation Verification by Simulation / Model Check Realization Validation and Testing Verification by Simulation Verification by Simulation

(6)

21 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

X

-

i

n-the-

L

oop Simulation

Physical System Modeling Control Law Design Embedded Control System Implementation Verification by Simulation / Model Check Realization Validation and Testing Verification by Simulation Verification by Simulation A D PWM Controller Plant Z-1 Delay1 Encoder Sample1

MIL

SIL

PIL

RHIL

HIL

Rapid

Prototyping

Simulation

Co–Simulation

Co

Simulation

A D PWM Controller Plant Z-1 Delay1 Encoder Sample1

Realization

1 2 3A 3A 3A 3B 3B 4

22 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Overview 3

rd

lecture: Design Method

Method & …

4 steps revisited and detailed

Focus on Embedded Software -> exercise

… Techniques

Co-simulationHardware-in-the-Loop Simulation

Cases

On Co-simulationOn Hardware-in-the-Loop Simulation

Overview

Physical System Modeling Control Law Design Embedded Control System Implementation Verificationby Simulation / Model Check Realization Validation and Testing Verification by Simulation Verification by Simulation

Case 1 – HILS setup

FPGAs as programmable I/O

Design I/O functionality as if it were software

Easy prototyping

Enables Concurrent Engineering

Tool Chain

Effectively download, run, control code

Anything

AnythingI/O FPGA boardI/O FPGA board

CAN board

CAN board

Seco

SecoPC/104+ CPU boardPC/104+ CPU board

RTOS

Embedded Linux, uClibC, RTAI 6 MB

Our Test Set Up

Signal

conditioning Controller

Embedded Control System

Hardware-In-the-Loop simulator

A/D, PWM, etc. D/A, encoder, etc.

Sensor simulation

Electrical interface Electrical interface

Output driver Model of the plant Actuator simulation FPGA PC104 PC

(7)

25 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Experiments

Controller Controller Quantize A D PWM Linix Plant

20-sim

PID Controller PC/104 I/O FPGA Plant HIL-Sim PC I/O FPGA I/O FPGA Controller PC/104 Sim – Sim Real – RT-Sim Real – Real Code Generation Code Generation

26 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Comparison

Real – RT-Sim I/O Plant HIL-Sim Controller PC/104 I/O

27 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Conclusions Case 1 – HILS setup

FPGA as I/O is really versatile

1 board: 4 functions: PWM out; Encoder in; PWM in; Encoder out

HIL-Simulation supports Concurrent Engineering

Tests

Check details

Performance

Refine Design trajectory

Optimally benefit from flexibility of FPGAs

Analogue extension to the FPGA board

28 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Case Study 2 – A/D converter

Refinement of A/D

Essential behavior only » Time discretization

Functional behavior

» Quantization (real -> integer)

Add non-linearities » Windowing

» Nonlinear conversion

Add conversion times

» A/D conversion time considerable

SetPoint Controller IO Scara steerIn DA DA1 Actuation Measurement A D AD1 DataOut

(8)

29 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Case 3 – Production Cell revisited

gCSP + 20-sim

Event driven discrete behavior modeled in gCSP + CT library

20-sim

6 Controllers & 12 Motion Profiles modeled & generated (c-code)

Event based selection motion profiles

Controllers run always

Manual coding

Hardware interfacing; c-code in gCSP code blocks

30 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Production Cell in gCSP

Top level implementation in gCSP

gCSP stress test

Conclusions – Case 3 – Production Cell

Prototype tool chain functions rather smoothly

Shortening design time not (yet) significant

Continue working on the tools

(Try to) combine benefits of all three DT-CT combinations

Use larger cases in cooperation with Industry

MovieMinOCW

MoviePOOSL

(9)

33 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Production Cell with POOSL software

34 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Overview 3

rd

lecture: Design Method

Method & …

4 steps revisited and detailed

Focus on Embedded Software -> exercise

… Techniques

Co-simulationHardware-in-the-Loop Simulation

Cases

On Co-simulationOn Hardware-in-the-Loop Simulation

Overview

Physical System Modeling Control Law Design Embedded Control System Implementation Verificationby Simulation / Model Check Realization Validation and Testing Verification by Simulation Verification by Simulation

35 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Overview

Method & Techniques

Use the structured design process: 4 steps »Stepwise refinement – Intrinsically Iterative »Design Space Exploration

»“Doing first time right” -> as little test time on target machine as possible

»Supports Concurrent Engineering

Use integrated models

» Port-based parts, based on bond graphs and CSP

Use Simulation as verification means »Co-simulation »Hardware-in-the-Loop Simulation

Cases

On Co-simulationOn Hardware-in-the-Loop Simulation Physical System Modeling Control Law Design Embedded Control System Implementation Verificationby Simulation / Model Check Realization Validation and Testing Verification by Simulation Verification by Simulation

36 Broenink et al Design of distributed embedded Systems – gCSP, method University of Twente

Topics Design ECS part

9

Use the structured design process

9

Use integrated models

Port-based parts, based on bond graphs and CSP

9

Use Simulation as verification means

9

Use CSP / gCSP to design Embedded Control Software

Apply tools and methods on real setup

References

Related documents