semantics of dynamic structure hybrid simulation models

42
Semantics of Dynamic Structure Hybrid Simulation Models Fernando J. Barros Dept. Informatics University of Coimbra, Portugal [email protected] November 27th, 2007

Upload: others

Post on 10-Jan-2022

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Semantics of Dynamic Structure Hybrid Simulation Models

Semantics of Dynamic Structure Hybrid

Simulation ModelsFernando J. Barros

Dept. Informatics

University of Coimbra, Portugal

[email protected]

November 27th, 2007

Page 2: Semantics of Dynamic Structure Hybrid Simulation Models

Introduction• Modeling and simulation of hybrid systems has been sub-

jected to intense research.

• The traditional trend in modeling and simulation of contin-

uous and hybrid systems rely on ideal continuous machines.

• The ODE solvers are usually hidden from the user and are

not explicitly represented.

• This approach does not encourage model interoperability.

• Semantics are commonly not well defined.

1

Page 3: Semantics of Dynamic Structure Hybrid Simulation Models

HFSS Formalism• The Heterogeneous Flow System Specification (HFSS) is a

modular formalism able to describe hybrid hierarchical models

with a time-varying structure.

• HFSS uses a traditional representation of discrete event sys-

tems but it introduces the new concept of generalized sam-

pling to achieve the description of continuous signals.

• HFSS treats sampling as a first order concept.

• Both time and component varying sampling are supported.

• The long accepted discrete time machines are limited to rep-

resent single and time-invariant sampling rate.

• Discrete-Time machines were superseded by HFSS machines.

2

Page 4: Semantics of Dynamic Structure Hybrid Simulation Models

HFSS Flows

3

Page 5: Semantics of Dynamic Structure Hybrid Simulation Models

Digital Computers• A digital computer can only represent a set of states S =

{(p, e)|p ∈ P, e ∈ R+0 } where P is a set of piecewise constant

partial states (p-states) and e the time elapsed in p-state p.

• All components that can be represented in a digital computer

are discrete since the number of changes in a component p-

state is finite during a finite time interval.

• Under this assumption the term discrete looses its discrimi-

nating expressiveness.

• models can be better categorized by the type of flow they

can handle.

4

Page 6: Semantics of Dynamic Structure Hybrid Simulation Models

Modeling Formalisms

5

Page 7: Semantics of Dynamic Structure Hybrid Simulation Models

HFSS Basic Model I

MB = (X,Y, P, ρ, ω, s0, δ, Λ, λ), for B ∈ B

X = X × X set of input flow values

X set of continuous input flow values

X set of discrete input flow values

Y = Y × Y set of output flow values

Y set of continuous output flow values

Y set of discrete output flow values

P set of partial states (p-states)

ρ : P → R+0 time-to-input function

ω : P → R+0 time-to-output function

6

Page 8: Semantics of Dynamic Structure Hybrid Simulation Models

HFSS Basic Model IIS = {(p, e)|p ∈ P,0 ≤ e ≤ ν(p)} state set

ν(p) = min{ρ(p), ω(p)}, time to transition function

s0 = (p0, e0) ∈ S initial state

δ : S ×X∅ → P the transition function

X∅ = X × X∅

X∅ = X ∪ {∅}∅ null value

Λ : S → Y continuous output function

λ : P → Y partial discrete output function

7

Page 9: Semantics of Dynamic Structure Hybrid Simulation Models

Atomic Component

8

Page 10: Semantics of Dynamic Structure Hybrid Simulation Models

Real-Time Intervals• t ∈ R, x > t→ [t,+∞)

• t ∈ R, x > t→ (t,+∞).

• We denote the left extreme of the interval (t,+∞) by t+.

• (t,+∞) ≡ [t+,+∞).

• ε = t+ − t.

9

Page 11: Semantics of Dynamic Structure Hybrid Simulation Models

Non-instantaneous Propagation IAssumption. A HFSS component performing a transition at

time t only changes its state at time t+.

• Gives an operational definition of causality by defining the

time between the cause and its effect.

• Plays a key role for ensuring determinist simulations by al-

lowing the existence of loops of zero-delay components.

• Enables determinism in time-warp simulations.

10

Page 12: Semantics of Dynamic Structure Hybrid Simulation Models

Non-Instantaneous Propagation II

11

Page 13: Semantics of Dynamic Structure Hybrid Simulation Models

Basic Component I

ΞB = (< sm, s >,T,∆,Λ), for B ∈ B

MB = (X,Y, P, ρ, ω, (p0, e0), δ, Λ, λ), component model

S = {(p, t)|p ∈ P, t ∈ R}, component state set

S∅ = S ∪ {∅}

< sm, s > with sm ∈ S∅ and s ∈ S∅, component state

sm, component past state

s = (p, t), component current state

p, component current p-state

t, time of component last transition action

T : {∅} → R, time limit for the next transition

12

Page 14: Semantics of Dynamic Structure Hybrid Simulation Models

T = t+ ν(p), where (p, t) ∈ s is the current state

∆ : R×X, component transition action

∆(t, x) ,

sm ← s

s← (δ((p, t− τ), x), t+ ε), assuming s = (p, τ)

Λ : R→ Y ∅, with Y ∅ = Y ∪ {∅}, component output function

Λ(t) =

(Λ(p, t− τ), λ(p)) if t− τ = ω(p)

(Λ(p, t− τ),∅) otherwise

(p, τ) =

(p1, τ1) if t ≥ τ1

(p2, τ2) if t < τ1

with (p1, τ1) = s and (p2, τ2) = sm, restricted to t ≥ τ2

Page 15: Semantics of Dynamic Structure Hybrid Simulation Models
Page 16: Semantics of Dynamic Structure Hybrid Simulation Models
Page 17: Semantics of Dynamic Structure Hybrid Simulation Models

PID Controller I

13

Page 18: Semantics of Dynamic Structure Hybrid Simulation Models

PID Controller II

MΠ = (X,Y, P, ρ, ω, s0, δ, Λ, λ)

X = R× {stop}

Y = R× R

P = {init,sample,out,stop} × R5

ρ(phase, α, β, int, der, x1) = α

ω(phase, α, β, int, der, x1) = β

s0 = ((init,0,∞,0,0,0),0)

δ(((init, α, β, int, der, x1), e), (x, x)) =

(sample,2,∞,0,0, x)

14

Page 19: Semantics of Dynamic Structure Hybrid Simulation Models

δ(((sample, α, β, int, der, x1), e), (x, stop)) =

((stop,∞,∞, int+ e · (x+ x1)/2, (x− x1)/e, x)

δ(((stop, α, β, int, der, x1), e), (x, x)) =

(stop, α, β, int, der, x1)

δ(((sample, α, β, int, der, x1), e), (x, x)) =

(out,∞,0, int+ e · (x+ x1)/2, (x− x1)/e, x)

δ(((out, α, β, int, der, x1), e), (x, x)) =

(sample,2,∞, int, der, x1)

Λ(((phase, α, β, int, der, x1), e)) =

P · x1 + I · int−D · der

λ((phase, α, β, int, der, x1)) =

P · x1 + I · int−D · der

Page 20: Semantics of Dynamic Structure Hybrid Simulation Models

Adaptive Step-Size Integrator I

M∫ = (X,Y, P, ρ, ω, s0, δ, Λ, λ)

X = R× R

Y = R× {detect}

P = {(α, β, x, y, par)|α, β, x, y ∈ R, par ∈ R4}

ρ(α, β, x, y, par) = α

ω(α, β, x, y, par) = β

s0 = ((0,∞, x0, y0, (min,max,K,L)),0)

δ(((α, β, x, y, (min,max,K,L)), e), (der, x)) =

(α′, β′, der, y′, (min,max,K,L))

15

Page 21: Semantics of Dynamic Structure Hybrid Simulation Models

α′ =

min if K · |der|−0.5 6 min

K · |der|−0.5 if K · |der|−0.5 ∈ (min,max)

max if K · |der|−0.5 > max

β′ =

(L− y′)/der if (L− y′)/der > 0

∞ otherwise

y′ = y + e · x

Λ(((α, β, x, y, par), e)) = y + e · x

λ((α, β, x, y, par)) = detect

The discrete flow value detect is produced whenever the con-

tinuous output flow reaches the threshold L.

Page 22: Semantics of Dynamic Structure Hybrid Simulation Models

Adaptive Step-Size Integrator II

16

Page 23: Semantics of Dynamic Structure Hybrid Simulation Models

Network Model

MN = (X,Y, η), N ∈ N

N , network name

X = X × X, set of network input flows

X, set of network continuous input flows

X, set of network discrete input flows

Y = Y × Y , set of network output flows

Y , set of network continuous output flows

Y , set of network discrete output flows

η ∈ η, name of the dynamic structure network executive

17

Page 24: Semantics of Dynamic Structure Hybrid Simulation Models

Executive Model

Mη = (Xη, Yη, P, ρ, ω, s0, δ, Λ, λ, Σ, γ), η ∈ η

Σ, set of network structures

γ : P → Σ, structure function

The network structure Σα ∈ Σ, corresponding to the p-state

pα ∈ P is given by:

Σα = γ(pα) = (Cα, {Ii,α}∪{Iη,α, IN,α}, {Ei,α}∪{Eη,α, EN,α}, Fi,α∪{Fη,α, FN,α})

Cα, set of names associated with the executive state pα

for all i ∈ Cα ∪ {η}

Ii,α, sequence of asynchronous influencers of i

18

Page 25: Semantics of Dynamic Structure Hybrid Simulation Models

Ei,α, set of the synchronous influencees of i

Fi,α, input function of i

IN,α, sequence of network influencers

EN,α, set of synchronous network influencees

FN,α, network output function

For all i ∈ Cα

Mi = (Xi, Yi, Pi, ρi, ωi, s0,i, δi, Λi, λi) if i ∈ B

Mi = (Xi, Yi, ηi) if i ∈ N

Page 26: Semantics of Dynamic Structure Hybrid Simulation Models

Constraintsfor every pα ∈ Pα

N 6∈ Cα, N 6∈ IN,α, η 6∈ Cα

N 6∈ Ei,α for all i ∈ Cα ∪ {η,N}

FN,α : ×k∈IN,αYk → Y ∅

Fi,α : ×k∈Ii,αVk → X∅i

Vk =

Y ∅k if k 6= N

X∅ if k = N

FN,α((vk1,∅), (vk2

,∅), ...) = (yN ,∅)

Fi,α((vk1,∅), (vk2

,∅), ...) = (xi,∅)

19

Page 27: Semantics of Dynamic Structure Hybrid Simulation Models

Dynamic Structure Networks I• HFSS networks offer a general framework for defining struc-

tural changes:

• components can be added/removed;

• input functions, influencers and influencees can be modi-

fied during the lifetime of a component.

20

Page 28: Semantics of Dynamic Structure Hybrid Simulation Models
Page 29: Semantics of Dynamic Structure Hybrid Simulation Models
Page 30: Semantics of Dynamic Structure Hybrid Simulation Models

Transitions I• A transition is defined as the application of the transition

function to a component.

• Transitions can be caused by three conditions:

• a non-null discrete flow is presented at component input;

• the component reaches the maximum time allowed in the

current p-state;

• a component belongs to the set of synchronous influ-

encees of another component that is undergoing a tran-

sition;

• We use the term transition instead of event since the latter

is ambiguous having usually different meanings.

21

Page 31: Semantics of Dynamic Structure Hybrid Simulation Models

Transitions II

22

Page 32: Semantics of Dynamic Structure Hybrid Simulation Models

Executive Component

Ξη = (< sm, s >,T,∆,Λ,Γ), η ∈ η

Mη = (Xη, Yη, P, ρ, ω, s0, δ, Λ, λ, Σ, γ), model of the executive

Γ : R→ Σ, executive component structure function

Γ(τ) = γ(p)

(p, t) =

(p1, t1) = s if τ ≥ t1(p2, t2) = sm if τ < t1

restricted to τ ≥ t2

23

Page 33: Semantics of Dynamic Structure Hybrid Simulation Models

Network Component

ΞN = (T,∆,Λ), N ∈ N

with MN = (X,Y, η),Mη = (Xη, Yη, P, ρ, ω, s0, δ, Λ, λ, Σ, γ)

T : {∅} → R, maximum time allowed in the current state

T = min{Ξk.T|k ∈ C ∪ {η}}, with (C, {Ii}, {Ei}, {Fi}) =

Ξη.Γ(t)

∆ : R×X, component transition action

∆(t, x) ,

H ← {k|k ∈ C ∪ {η}, xk 6= ∅ ∨ t = Ξk.T}L←transitive-closure(H ∪ EN)

for all k ∈ L do Ξk.∆(t, xk)

24

Page 34: Semantics of Dynamic Structure Hybrid Simulation Models

for all c ∈ C′ \ C do create-component(c, t+ ε)

for all c ∈ C \ C′ do destroy-component(c)

xk = (xk, xk) = Fk(×i∈Ikvi)

vi =

Λi(t) if i 6= N

x if i = N

(C, {Ii}, {Ei}, {Fi}) = Ξη.Γ(t) and

(C′, {I ′i}, {E′i}, {F

′i}) = Ξη.Γ(t+ ε)

Λ : R→ Y , network component output function

Λ(t) = FN(×i∈INΛi(t)), with (C, {Ii}, {Ei}, {Fi}) = Ξη.Γ(t)

Page 35: Semantics of Dynamic Structure Hybrid Simulation Models

Switching System I

25

Page 36: Semantics of Dynamic Structure Hybrid Simulation Models

Switching System II

26

Page 37: Semantics of Dynamic Structure Hybrid Simulation Models

Switching System III

27

Page 38: Semantics of Dynamic Structure Hybrid Simulation Models

Step Sizes

28

Page 39: Semantics of Dynamic Structure Hybrid Simulation Models

(A)Synchronous Systems• Partitions can be easily established in many systems

• In highway systems traffic is organized around platoons

• in each platoon vehicles have a strong interaction and

decisions made by a car of may influence the decisions of

the other drivers (synchronous)

• interactions may not exist between platoons (asynchronous)

• Many real systems, specially, when regarded at a global scale,

like aircraft systems, have clusters of locally interacting en-

tities with no relationship between clusters

• To effectively exploit the loose coupling it is necessary the

ability to dynamically change the interaction relationships be-

tween integrators

29

Page 40: Semantics of Dynamic Structure Hybrid Simulation Models

Currently Supported Models• Explicit adaptive-step Adams solvers

• Adaptive sampling PID controllers

• Adaptive sampling alpha-beta filters

30

Page 41: Semantics of Dynamic Structure Hybrid Simulation Models

Conclusions• HFSS semantics provide an algorithm description of HFSS

components enabling their unambiguous simulation.

• Semantics definition enables component interoperability.

• HFSS provides a base for multi-paradigm modeling.

• As a future work we plan to extend HFSS to support non-

causal models.

31

Page 42: Semantics of Dynamic Structure Hybrid Simulation Models

For More Information• F.J. Barros. ”A Formal Representation of Hybrid Mobile

Components.” SIMULATION: Transactions of The Societyfor Modeling and Simulation International, Vol. 81, No. 5,pp. 381-393, 2005.

• F.J. Barros. ”Dynamic Structure Multi-Paradigm Modelingand Simulation.” ACM Transactions on Modeling and Com-puter Simulation. Vol. 13, No. 3, pp. 259-275, 2003.

• F.J. Barros. ”Modeling and Simulation of Dynamic StructureHeterogeneous Flow Systems.” SIMULATION: Transactionsof The Society for Modeling and Simulation International,Vol. 78, No. 1, 18-27, 2002.

• F.J. Barros. ”Towards a Theory of Continuous Flow Mod-els.” International Journal of General Systems, Vol. 31, No.1, 29-39, 2002.

32