Designer’s Guide - Supporting Dimensional Analysis in ...École Polytechnique Fédérale de...
Transcript of Designer’s Guide - Supporting Dimensional Analysis in ...École Polytechnique Fédérale de...
Supporting Dimensional Analysis in SystemC-AMS
Torsten Mähne Alain Vachoux
Laboratoire de Systèmes Microélectroniques (LSM)École Polytechnique Fédérale de Lausanne (EPFL)
Lausanne, Suisse
Behavioral Modeling and Simulation Conference (BMAS) 200917 to 18 September 2009, Doubletree Hotel, San Jose, California, USA
Table of Contents
Introduction
Modeling of Multi-Domain Systems
Integrating Dimensional Analysis into SystemC-AMS
Application Example
Conclusions and Outlook
References
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 2 / 25
Introduction Heterogeneous SoCs Design Process Challenges
Heterogeneous SoCs Design Process Challenges
Processors
MOEMS sensors and actuators
Consumer peripherals
Copro-cessors
Memories:ROM, RAM,
FLASH,EEPROM,
FPGA Support devices:DMA, Timer, SPI,
PWM, UART,FPGA
Analog andmixed-signalcomponents:ADC, DAC,
Bandgap, VCO,OpAmp, radio
DSP
Clock:PLL,DLL
Businter-faces
I Component reuse and retargetingI Multiple engineering/physical domainsI Multiple Models of Computations (MoCs)I Conflicting naming conventions for (elec., mech., . . . ) quantities Strict interface specifications—not only value type Dimensional analysis: quantity<unit<dimension, system>, value_type> Check model assembly and calculation consistency
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 3 / 25
Introduction Heterogeneous SoCs Design Process Challenges
Heterogeneous SoCs Design Process Challenges
Processors
MOEMS sensors and actuators
Consumer peripherals
Copro-cessors
Memories:ROM, RAM,
FLASH,EEPROM,
FPGA Support devices:DMA, Timer, SPI,
PWM, UART,FPGA
Analog andmixed-signalcomponents:ADC, DAC,
Bandgap, VCO,OpAmp, radio
DSP
Clock:PLL,DLL
Businter-faces
I Component reuse and retargetingI Multiple engineering/physical domainsI Multiple Models of Computations (MoCs)I Conflicting naming conventions for (elec., mech., . . . ) quantities Strict interface specifications—not only value type Dimensional analysis: quantity<unit<dimension, system>, value_type> Check model assembly and calculation consistency
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 3 / 25
Introduction Motivation for Dimensional Analysis
Motivation (1/2): Loss of NASA’s Mars Climate Orbiter
Mars Climate Orbiter (MCO) was loston 23 September 1999 during its orbitentering maneuver.Details: http://marsprogram.jpl.nasa.gov/msp98/orbiter/
Statements by Arthur Stephenson(Chairman of MCO Mission FailureInvestigation Board, 10 November 1999):
I “The ‘root cause’ of the loss of thespacecraft was the failed translation ofEnglish units into metric units in asegment of ground-based,navigation-related mission software, asNASA has previously announced.”
I “The failure review board has identifiedother significant factors that allowedthis error to be born, and then let itlinger and propagate to the point whereit resulted in a major error in ourunderstanding of the spacecraft’s pathas it approached Mars.”
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 4 / 25
Introduction Motivation for Dimensional Analysis
Motivation (2/2): Usage of Multiple Systems of Units
q1 u1u2u3u4u5u6u7u8u9u10v1 v2 v3 v4 v5
ROM144
Yaw rate sensorin−plane q3
q4
u1u2u3u4u5u6u7u8u9u10v1 v2 v3 v4 v5
ROM144
Yaw rate sensorout−of−plane
q2
SI
µSI
µSI
µSI
µSI
µSI
µSI
µSI
µSI
µ
1r3
r4
1
r3
1
σr, y
σr, x
σr, z
2r2
12r2
1
FM, y, 5
FM, y, 7
2r2
12r2
12r2
12r2
1
∂t∂
∂t∂
Conservationof the
angularmomentum
σr
ωr
αr
σi ωi αi
Mx
My
Mz
3
3
3
3
σr ωr αr
σr, z
Fz, 5
Fz, 6
Fz, 7
Fz, 8
Structuralcoupling
effect
3
∫
∂t∂
3
3
3
3
3
3
σi
αi
ωi
ωi, x
ωi, y
ωi, z
ωi, x
ωi, y
ωi, z
FM, z, 5 FM, z, 7 FM, z, 6 FM, z, 8
FQ, z ,8
FQ, z ,7
FQ, z ,6
FQ, z ,5
GND KA KI K2K1 CM C2 C1 T2 T1 AGND
Yaw rate sensor, full model (µMKSV system of units)
Yaw rate sensor driving and detection circuit (SI system of units)
System of units converters
I MEMS yaw rate sensor behavioral model
I Sensor model using µMKSV system of units
I Control circuit model using SI system of units
Insertion of system of units converters
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 5 / 25
Introduction Motivation for Dimensional Analysis
State of the Art: Dimensional Analysis in HDLs
I VHDL-AMS: Unit specification with attributes purely for presentationsubtype VELOCITY is REAL tolerance "DEFAULT_VELOCITY";attribute UNIT OF VELOCITY : subtype is "meter/second";attribute SYMBOL OF VELOCITY : subtype is "m/s";
I Modelica: SI unit specification (+ scale factors) in attributes of RealReal(unit="m.s-1") v = 2.0;
I Tool-specific dimensional analysis solutions, e.g., Dymola, Simulator XI Efforts to formalize and generalize physical unit checking
I F#: Units part of language and dimensional analysis built in compiler[<Measure>] type kg[<Measure>] type N = kg m/s^2let gravity = 9.808<m/s^2>let metresToFeet (l:float<m>) = l * 3.28084<ft/m>
I Extensible by declaring new units and system of unitsI No notion of dimension (classes of measurement units)I Programing language without dedicated supported for system modeling
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 6 / 25
Introduction Motivation for Dimensional Analysis
State of the Art: Dimensional Analysis in HDLs
I VHDL-AMS: Unit specification with attributes purely for presentationsubtype VELOCITY is REAL tolerance "DEFAULT_VELOCITY";attribute UNIT OF VELOCITY : subtype is "meter/second";attribute SYMBOL OF VELOCITY : subtype is "m/s";
I Modelica: SI unit specification (+ scale factors) in attributes of RealReal(unit="m.s-1") v = 2.0;
I Tool-specific dimensional analysis solutions, e.g., Dymola, Simulator XI Efforts to formalize and generalize physical unit checking
I F#: Units part of language and dimensional analysis built in compiler[<Measure>] type kg[<Measure>] type N = kg m/s^2let gravity = 9.808<m/s^2>let metresToFeet (l:float<m>) = l * 3.28084<ft/m>
I Extensible by declaring new units and system of unitsI No notion of dimension (classes of measurement units)I Programing language without dedicated supported for system modeling
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 6 / 25
Introduction Motivation for Dimensional Analysis
State of the Art: Dimensional Analysis in HDLs
I VHDL-AMS: Unit specification with attributes purely for presentationsubtype VELOCITY is REAL tolerance "DEFAULT_VELOCITY";attribute UNIT OF VELOCITY : subtype is "meter/second";attribute SYMBOL OF VELOCITY : subtype is "m/s";
I Modelica: SI unit specification (+ scale factors) in attributes of RealReal(unit="m.s-1") v = 2.0;
I Tool-specific dimensional analysis solutions, e.g., Dymola, Simulator XI Efforts to formalize and generalize physical unit checking
I F#: Units part of language and dimensional analysis built in compiler[<Measure>] type kg[<Measure>] type N = kg m/s^2let gravity = 9.808<m/s^2>let metresToFeet (l:float<m>) = l * 3.28084<ft/m>
I Extensible by declaring new units and system of unitsI No notion of dimension (classes of measurement units)I Programing language without dedicated supported for system modeling
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 6 / 25
Introduction AMS Extensions to SystemC
AMS Extensions to SystemC
Goal: Simulation of heterogeneous SoCs using several synchronised MoCsOSCI standardisation effort: based on SystemC-AMS (Fraunhofer IIS/EAS)
SynchronousData Flow (SDF)• Modules• Ports• Signals
Electrical LinearNetworks (Elec)• Primitives• Terminals• Nodes
SchedulerLinear DAE solver
Synchronization layer
SystemCmethodology-
specificelements
• Transaction LevelModeling (TLM)
• Cycle/bit AccurateModeling
• SystemCVerificationLibrary (SCV)
• etc.
OSCI SystemC 2.2 language standard (IEEE Std. 1666-2005) and simulation kernel
User-definedAMS extensions• Modules• Ports• Signals
(e.g., additional MoCs,simulator couplings)
AMS methodology-specific elementsQuantity/units specification, dimensional analysis, generic block diagram SDF modules
This work’s extensions to Fraunhofer’s SystemC-AMS
Our contribution: New modeling capabilities for formal/consistent descriptionof energy conserving multi-domain systems at a high level of abstraction.
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 7 / 25
Modeling of Multi-Domain Systems
Modeling of Multi-Domain Systems (1/2)
1. “Classic” domain-specific conservative model:R1
m
d
k
x
Ctrans(x), Ftrans(q,x)
vdrive(t)
iR1
− Implementation ofprimitives per domain
− SystemC-AMS offers onlylinear electrical primitives
2. Equivalent generic bond graph model:
1 C
e3(q3,q4)e4(q3,q4)
: 1
R : R2
I : I1
C : C1
R : R1
f2e2
e1 e3
f3f1
e4
f4
e5
e6
f6
e7
f5
f7
Se : e1(t)
+ Primitives parametrizableto domain
+ Causality analysis extractscomputational structure
− Not (yet) supported bySystemC-AMS
I Check model assembly, consistent equations dimensional analysis
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 8 / 25
Modeling of Multi-Domain Systems
Modeling of Multi-Domain Systems (1/2)
1. “Classic” domain-specific conservative model:R1
m
d
k
x
Ctrans(x), Ftrans(q,x)
vdrive(t)
iR1
− Implementation ofprimitives per domain
− SystemC-AMS offers onlylinear electrical primitives
2. Equivalent generic bond graph model:
1 C
e3(q3,q4)e4(q3,q4)
: 1
R : R2
I : I1
C : C1
R : R1
f2e2
e1 e3
f3f1
e4
f4
e5
e6
f6
e7
f5
f7
Se : e1(t)
+ Primitives parametrizableto domain
+ Causality analysis extractscomputational structure
− Not (yet) supported bySystemC-AMS
I Check model assembly, consistent equations dimensional analysis
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 8 / 25
Modeling of Multi-Domain Systems
Modeling of Multi-Domain Systems (1/2)
1. “Classic” domain-specific conservative model:R1
m
d
k
x
Ctrans(x), Ftrans(q,x)
vdrive(t)
iR1
− Implementation ofprimitives per domain
− SystemC-AMS offers onlylinear electrical primitives
2. Equivalent acausal bond graph model:
1 C
Ctrans(x)Ftrans(q,x)
: 1
R : d
I : m
C : k
Se : vdrive(t)
R : R1
iR1vR1
vdrive vtrans
iR1iR1
Ftrans
vm
Fd
Fm
vm
Fk
vm
vm
+ Primitives parametrizableto domain
+ Causality analysis extractscomputational structure
− Not (yet) supported bySystemC-AMS
I Check model assembly, consistent equations dimensional analysis
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 8 / 25
Modeling of Multi-Domain Systems
Modeling of Multi-Domain Systems (1/2)
1. “Classic” domain-specific conservative model:R1
m
d
k
x
Ctrans(x), Ftrans(q,x)
vdrive(t)
iR1
− Implementation ofprimitives per domain
− SystemC-AMS offers onlylinear electrical primitives
2. Equivalent causal bond graph model:
1 C
Ctrans(x)Ftrans(q,x)
: 1
R : d
I : m
C : k
Se : vdrive(t)
R : R1
iR1vR1
vdrive vtrans
iR1iR1
Ftrans
vm
Fd
Fm
vm
Fk
vm
vm
+ Primitives parametrizableto domain
+ Causality analysis extractscomputational structure
− Not (yet) supported bySystemC-AMS
I Check model assembly, consistent equations dimensional analysis
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 8 / 25
Modeling of Multi-Domain Systems
Modeling of Multi-Domain Systems (1/2)
1. “Classic” domain-specific conservative model:R1
m
d
k
x
Ctrans(x), Ftrans(q,x)
vdrive(t)
iR1
− Implementation ofprimitives per domain
− SystemC-AMS offers onlylinear electrical primitives
2. Equivalent causal bond graph model:
1 C
Ctrans(x)Ftrans(q,x)
: 1
R : d
I : m
C : k
Se : vdrive(t)
R : R1
iR1vR1
vdrive vtrans
iR1iR1
Ftrans
vm
Fd
Fm
vm
Fk
vm
vm
+ Primitives parametrizableto domain
+ Causality analysis extractscomputational structure
− Not (yet) supported bySystemC-AMS
I Check model assembly, consistent equations dimensional analysis
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 8 / 25
Modeling of Multi-Domain Systems
Modeling of Multi-Domain Systems (2/2)
3. Derived block diagram:
g4
s1(t)
s3
s2
s5 s7
s11
s8
s10s13
∫∫
+−
f1(x,y) f2(x,y)
s4 s6
g1
+
g3
∫
∫
g2
s12
s9
s3(t)
−−−
+ Fully causal static scheduling procedural execution+ Simulatable with SystemC-AMS’s Synchronous Data Flow (SDF) MoC− Energy conservation emulated− Hard to reuse in other context with different input/output roles Annotated units resolve symbol conflicts
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 9 / 25
Modeling of Multi-Domain Systems
Modeling of Multi-Domain Systems (2/2)
3. Derived block diagram:
k
vdrive(t)
iR1
vR1
vtrans Ftrans
Fd
Fm
vmFk
∫∫
+− q
C(x) F(q,x)
q x
1R1
+
d
∫
∫
1m
xm
pm
i(t)
−−−
Electrostatic transducer
+ Fully causal static scheduling procedural execution+ Simulatable with SystemC-AMS’s Synchronous Data Flow (SDF) MoC− Energy conservation emulated− Hard to reuse in other context with different input/output roles Annotated units resolve symbol conflicts
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 9 / 25
Modeling of Multi-Domain Systems
Modeling of Multi-Domain Systems (2/2)
3. Derived block diagram:
k
vdrive(t)[V]
iR1 [A]
vR1 [V]
vtrans[V] Ftrans[N]
Fd [N]
Fm[N]
vm[m/s]Fk[N]
∫∫
+− q
C(x) F(q,x)
q[C] x[m]
1R1
+
d
∫
∫
1m
xm[m]
pm[Ns]
i(t)[A]
−−−
Electrostatic transducer[S] [Ns/m]
[kg−1][N/m]
[C/F] [N]
+ Fully causal static scheduling procedural execution+ Simulatable with SystemC-AMS’s Synchronous Data Flow (SDF) MoC− Energy conservation emulated− Hard to reuse in other context with different input/output roles Annotated units resolve symbol conflicts
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 9 / 25
Integrating Dimensional Analysis into SystemC-AMS Boost.Units C++ Library for Dimensional Analysis
Boost.Units: C++ Library for Dimensional Analysis
I unit<Dim, System> type: to represent arbitrary composite unitI Dim: Static type list of base dimensions raised to a rational powerI System: Set of base dimensions and their measuresI Example: Energy is [M]1[L]2[T]−2, in SI: kg m2 s−2 = N m = J
I quantity<U, V> type: composed of unit U and value V typesI Code example:// Current quantity with double valuequantity<si::current> i = 0.1 * si::ampere;// Complex impedance quantityquantity<si::resistance, complex<double> >Z = complex<double>(4.0, 3.0) * si::ohm;// Assignment of product only to a complex voltage quantityquantity<si::electric_potential, complex<double> >v = Z * i;
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 10 / 25
Integrating Dimensional Analysis into SystemC-AMS Boost.Units C++ Library for Dimensional Analysis
Boost.Units: C++ Library for Dimensional Analysis
I unit<Dim, System> type: to represent arbitrary composite unitI Dim: Static type list of base dimensions raised to a rational powerI System: Set of base dimensions and their measuresI Example: Energy is [M]1[L]2[T]−2, in SI: kg m2 s−2 = N m = J
I quantity<U, V> type: composed of unit U and value V typesI Code example:// Current quantity with double valuequantity<si::current> i = 0.1 * si::ampere;// Complex impedance quantityquantity<si::resistance, complex<double> >Z = complex<double>(4.0, 3.0) * si::ohm;// Assignment of product only to a complex voltage quantityquantity<si::electric_potential, complex<double> >v = Z * i;
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 10 / 25
Integrating Dimensional Analysis into SystemC-AMS Boost.Units C++ Library for Dimensional Analysis
Boost.Units Dimensional Analysis Examples (1/2)
I Accidental Summing of Different Quantity Types:quantity<si::electric_potential> v_1 = 5.0 * si::volt;quantity<si::velocity> v_2 = 3.0 * si::meter / si::second;// This won’t compile:quantity<si::electric_potential> v_tot = v_1 + v_2;
I Compiler error:fail_bmas2009_examples.cpp:16: error: no match for ‘operator+’ in ‘v_1 + v_2’
Cannot sum voltage quantity v_1 and speed quantity v_2
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 11 / 25
Integrating Dimensional Analysis into SystemC-AMS Boost.Units C++ Library for Dimensional Analysis
Boost.Units Dimensional Analysis Examples (1/2)
I Accidental Summing of Different Quantity Types:quantity<si::electric_potential> v_1 = 5.0 * si::volt;quantity<si::velocity> v_2 = 3.0 * si::meter / si::second;// This won’t compile:quantity<si::electric_potential> v_tot = v_1 + v_2;
I Compiler error:fail_bmas2009_examples.cpp:16: error: no match for ‘operator+’ in ‘v_1 + v_2’
Cannot sum voltage quantity v_1 and speed quantity v_2
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 11 / 25
Integrating Dimensional Analysis into SystemC-AMS Boost.Units C++ Library for Dimensional Analysis
Boost.Units Dimensional Analysis Examples (2/2)
I Wrong implementation of Ohm’s law:quantity<si::resistance> R = 5.0e3 * si::ohm;quantity<si::electric_potential> v = 10.0 * si::volt;// This won’t compile:quantity<si::current> i = R * v;
I Compiler error (simplified, using namespace boost::units):fail_bmas2009_examples.cpp:10: error: conversion from’quantity<unit<list<dim<length_base_dimension, static_rational<4l, 1l> >,
list<dim<mass_base_dimension, static_rational<2l, 1l> >,list<dim<time_base_dimension,
static_rational<-6l, 1l> >,list<dim<current_base_dimension,
static_rational<-3l, 1l> >,dimensionless_type> > > >,
si::system, void>,double>’
to non-scalar type ’quantity<si::current, double>’ requested
Cannot convert from [Ω V] = [m4 kg2 s−6 A−3] to [A]
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 12 / 25
Integrating Dimensional Analysis into SystemC-AMS Boost.Units C++ Library for Dimensional Analysis
Boost.Units Dimensional Analysis Examples (2/2)
I Wrong implementation of Ohm’s law:quantity<si::resistance> R = 5.0e3 * si::ohm;quantity<si::electric_potential> v = 10.0 * si::volt;// This won’t compile:quantity<si::current> i = R * v;
I Compiler error (simplified, using namespace boost::units):fail_bmas2009_examples.cpp:10: error: conversion from’quantity<unit<list<dim<length_base_dimension, static_rational<4l, 1l> >,
list<dim<mass_base_dimension, static_rational<2l, 1l> >,list<dim<time_base_dimension,
static_rational<-6l, 1l> >,list<dim<current_base_dimension,
static_rational<-3l, 1l> >,dimensionless_type> > > >,
si::system, void>,double>’
to non-scalar type ’quantity<si::current, double>’ requested
Cannot convert from [Ω V] = [m4 kg2 s−6 A−3] to [A]
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 12 / 25
Integrating Dimensional Analysis into SystemC-AMS Integrating Boost.Units into SystemC-AMS
Integrating Boost.Units into SystemC-AMS
1. Parametrize signals and ports to new quantity<U, V> type:I Supported by DE and SDF MoCs, as ports and signals are templatesI Example:// Quantity SDF signalssca_sdf_signal<quantity<si::current> > i_sig;sca_sdf_signal<quantity<si::electric_charge> > q_sig;
2. Keep implemented modules generic enough:I Don’t reimplement similar behavior for each quantity type Write module templates to parametrize ports and parametersI Demonstrated with generic module library library scax_block_diagramI Example:// Integrator instantiationscax_bd::scax_integ_trapez<quantity<si::current> >i_integ("i_integ", 0.0 * si::coulomb);i_integ.in(i_sig);i_integ.out(q_sig);
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 13 / 25
Integrating Dimensional Analysis into SystemC-AMS Integrating Boost.Units into SystemC-AMS
Integrating Boost.Units into SystemC-AMS
1. Parametrize signals and ports to new quantity<U, V> type:I Supported by DE and SDF MoCs, as ports and signals are templatesI Example:// Quantity SDF signalssca_sdf_signal<quantity<si::current> > i_sig;sca_sdf_signal<quantity<si::electric_charge> > q_sig;
2. Keep implemented modules generic enough:I Don’t reimplement similar behavior for each quantity type Write module templates to parametrize ports and parametersI Demonstrated with generic module library library scax_block_diagramI Example:// Integrator instantiationscax_bd::scax_integ_trapez<quantity<si::current> >i_integ("i_integ", 0.0 * si::coulomb);i_integ.in(i_sig);i_integ.out(q_sig);
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 13 / 25
Application Example Electromechanical Transducer with Mechanical Resonator
Electromechanical Transducer with ResonatorDomain-specific conservative model:
R1
m
d
k
x
Ctrans(x), Ftrans(q,x)
vdrive(t)
iR1
Derived block diagram:
k
vdrive(t)[V]
iR1 [A]
vR1 [V]
vtrans[V] Ftrans[N]
Fd [N]
Fm[N]
vm[m/s]
Fk[N]
+− q
C(x) F(q,x)
q[C] x[m]
1R1
+
d
∫
∫
1m
xm[m]
pm[Ns]
i(t)[A]
−−−
Electrostatic transducer[S] [Ns/m]
[kg−1][N/m]
[C/F] [N]
itrans[A] vtrans[m/s]
∫ ∫
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 14 / 25
Application Example Interface of the Electromechanical Transducer Model
Electromechanical Transducer Using double
struct elmech_transducer : public sc_core::sc_module // Electrical and mechanical portssca_sdf_in<double> i_in; // Current input [A]sca_sdf_out<double> v_out; // Voltage output [V]sca_sdf_in<double> v_in; // Velocity input [m/s]sca_sdf_out<double> F_out; // Force output [N]// Parametrize module// v_func: Transducer voltage [V] function v = f(q, x)// F_func: Transducer force [N] function F = f(q, x)// q_0: Initial charge [C]// x_0: Initial displacement [m]elmech_transducer(const sc_core::sc_module_name& name,function<double (double, double)> v_func,function<double (double, double)> F_func,double q_0 = 0.0,double x_0 = 0.0); // ...
;
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 15 / 25
Application Example Interface of the Electromechanical Transducer Model
Electromechanical Transducer Using quantity<U, V>
struct elmech_transducer : public sc_core::sc_module // Typedefs for common quantity typestypedef quantity<si::electric_potential> voltage_t;typedef quantity<si::force> force_t; // ...// Electrical and mechanical portssca_sdf_in<current_t> i_in;sca_sdf_out<voltage_t> v_out;sca_sdf_in<velocity_t> v_in;sca_sdf_out<force_t> F_out;// Parametrize moduleelmech_transducer(const sc_core::sc_module_name& name,function<voltage_t (charge_t, displacement_t)> v_func,function<force_t (charge_t, displacement_t)> F_func,charge_t q_0 = 0.0 * si::coulomb,displacement_t x_0 = 0.0 * si::meter); // ...
;
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 16 / 25
Application Example Parametrization of the Electromechanical Transducer Model
Transducer Voltage Function Defined in Testbench
I Version using double:// Transducer capacitance formula v_trans(q, x)// v_trans: Voltage [V]; q: Charge [F]; x: Displacement [m]function<double (double, double)>v_trans_func = _1 / (C_trans_0 * (1.0 - (_2 / overlap)));
Compiler cannot check formula consistency and parameter order!I Version using quantity<U, V>:typedef quantity<si::electric_potential> voltage_type;typedef quantity<si::electric_charge> charge_type;typedef quantity<si::length> displacement_type;// Transducer capacitance formula v_trans(q, x)function<voltage_type (charge_type, displacement_type)>v_trans_func = _1 / (C_trans_0 * (1.0 - (_2 / overlap)));
Compiler can fully check formula consistency and parameter order!
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 17 / 25
Application Example Parametrization of the Electromechanical Transducer Model
Transducer Voltage Function Defined in Testbench
I Version using double:// Transducer capacitance formula v_trans(q, x)// v_trans: Voltage [V]; q: Charge [F]; x: Displacement [m]function<double (double, double)>v_trans_func = _1 / (C_trans_0 * (1.0 - (_2 / overlap)));
Compiler cannot check formula consistency and parameter order!I Version using quantity<U, V>:typedef quantity<si::electric_potential> voltage_type;typedef quantity<si::electric_charge> charge_type;typedef quantity<si::length> displacement_type;// Transducer capacitance formula v_trans(q, x)function<voltage_type (charge_type, displacement_type)>v_trans_func = _1 / (C_trans_0 * (1.0 - (_2 / overlap)));
Compiler can fully check formula consistency and parameter order!
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 17 / 25
Application Example Simulation Results
Simulation Results
-2
0
2
4
6
v /
V
vdrive
-4
-2
0
2
4
v /
V
vR1
vtrans
-40
0
40
80
120
160
F /
µN
Ftrans
-800
-400
0
400
800
F /
µN
Fd
Fk
Fm
-8
-4
0
4
8
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
x /
µm
t / ms
xm
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 18 / 25
Application Example Compilation and Simulation Times Comparison
Compilation and Simulation Times Comparison
Language/Simulator Feature tcompile tsimulate
SystemC-AMS 0.15 RC5 quantity<U, V> 19.07 s 11.76 s(+ SystemC 2.2.0, g++ 4.3.2 -O2) double 9.69 s 11.38 s
VHDL-AMS free quantity 0.79 s 18.76 s(ADVance MS 2008.2) branch quantity 0.84 s 18.43 s
I Simulated time: 2.4 msI Fixed time step: 10 nsI Platform: Intel Pentium 4 3 GHz, 1 MB Cache, 2 GB RAM,
Debian Lenny, Linux 2.6.26 (i386)
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 19 / 25
Conclusions and Outlook
Conclusions and Outlook
Conclusions:I Quantities check model assembly and calculation consistencyI Boost.Units increases compilation time, not simulation timeI Generic block diagram library for SDF MoC enables high-level
description of analog behavior and keeps link to physical domain
Current work and outlook:I Scalability of demonstrated approach?I Filter Boost.Units compiler errorsI Develop Bond Graph MoC applying these techniques
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 20 / 25
Conclusions and Outlook
Conclusions and Outlook
Conclusions:I Quantities check model assembly and calculation consistencyI Boost.Units increases compilation time, not simulation timeI Generic block diagram library for SDF MoC enables high-level
description of analog behavior and keeps link to physical domain
Current work and outlook:I Scalability of demonstrated approach?I Filter Boost.Units compiler errorsI Develop Bond Graph MoC applying these techniques
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 20 / 25
References
References
Boost Library Documentation, 1998-2009.http://www.boost.org/doc/libs.
Broman, D., et al.: Design considerations for dimensional inference and unit consistencychecking in Modelica.In Proceedings of the 6th International Modelica Conference, Bielefeld, Germany, 2008.
IEEE: IEEE Standard 1666-2005, SystemC Language Reference Manual, Mar. 2006.http://standards.ieee.org/reading/ieee/std/dasc/1666-2005.pdf.
Karnopp, D.C., et al.: System Dynamics: Modeling and Simulation of Mechatronic Systems.Wiley, 4th ed., Jan. 2006.
Maehne, T., et al.: Development of a bond graph based model of computation for SystemC-AMS.In Proc. 4th IEEE PRIME 2008 Conference, Istanbul, Turkey, 2008. IEEE.
Mähne, T., et al.: Creating virtual prototypes of complex MEMS transducers using reduced-ordermodelling methods and VHDL-AMS.In Applications of Specification and Design Languages for SoCs. Springer, 2006.
OSCI: Draft Standard SystemC AMS Extensions Language Reference Manual, Dec. 2008.http://www.systemc.org/members/download_files/check_file?agreement=AMS_draft1_120308.
Vachoux, A., C. Grimm, and K. Einwich: Extending SystemC to support mixeddiscrete-continuous system modeling and simulation.In Proceedings of the IEEE International Symposium on Circuits and Systems (ISCAS) 2005.
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 21 / 25
The End
The End
Thank you for your attention!
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 22 / 25
Appendix AMS Extensions to SystemC
AMS Extensions to SystemC
Goal: Simulation of heterogeneous SoCs using several synchronised MoCsOSCI standardisation effort: based on SystemC-AMS (Fraunhofer IIS/EAS)
Open-source SystemC-AMS prototype byFraunhofer IIS/EAS
SynchronousData Flow (SDF)• Modules• Ports• Signals
Electrical LinearNetworks (Elec)• Primitives• Terminals• Nodes
SchedulerLinear DAE solver
Synchronization layer
SystemCmethodology-
specificelements
• Transaction LevelModeling (TLM)
• Cycle/bit AccurateModeling
• SystemCVerificationLibrary (SCV)
• etc.
OSCI SystemC 2.2 language standard (IEEE Std. 1666-2005) and simulation kernel
User-definedAMS extensions• SC networks• Conservative
non-lin. networks• Simulator
couplings
Proprietaryextensions
AMS methodology-specific elementsSDF module libraries, schematic entry
I White paper and Draft 1 LRM availableI Proof-of-concept implementation under way driven
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 23 / 25
Appendix AMS Extensions to SystemC
AMS Extensions to SystemC
Goal: Simulation of heterogeneous SoCs using several synchronised MoCsOSCI standardisation effort: based on SystemC-AMS (Fraunhofer IIS/EAS)
Timed Data Flow(TDF)
• Modules• Ports• Signals
Electrical LinearNetworks (ELN)• Primitives• Terminals• Nodes
SchedulerLinear DAE solver
Synchronization layer
SystemCmethodology-
specificelements
• Transaction LevelModeling (TLM)
• Cycle/bit AccurateModeling
• SystemCVerificationLibrary (SCV)
• etc.
Linear SignalFlow (LSF)
• Primitives• Ports• Signals
OSCI SystemC 2.2 language standard (IEEE Std. 1666-2005) and simulation kernel
User-definedAMS extensions• Modules• Ports• Signals
(e.g., additional MoCs,simulator couplings)
AMS methodology-specific elementsElements for AMS design refinement, etc.
OSCI AMS Extensions to SystemC LRM Draft 1Envisionedextensions
I White paper and Draft 1 LRM availableI Proof-of-concept implementation under way driven
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 23 / 25
Appendix Integrating Dimensional Analysis into SystemC-AMS
scax_block_diagram Library Overview (1/2)
Name Description
scax_source<T,TimeType> SDF samples source module using a waveformfunction: f : TimeType→ T
scax_sink<T> SDF samples sink module
scax_scale<T1,T2> Scale module
scax_sum<T> Summing module with variable input number
scax_mul<T1,T2> Multiplier module with two inputs
scax_integ_trapez<T> Trapezoidal integrator module
scax_dot_secant<T> Differentiator module using asymmetric evaluation ofNewton’s difference quotient
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 24 / 25
Appendix Integrating Dimensional Analysis into SystemC-AMS
scax_block_diagram Library Overview (2/2)
Name Description
scax_func1<T1,T2> Time-independent function module withone input: f : T1→ T2
scax_func2<T1,T2,T3> Time-independent function module with twoinputs: f : T1 × T2→ T3
scax_func3<T1,T2,T3,T4> Time-independent function module withthree inputs: f : T1 × T2 × T3→ T4
scax_func1t<T1,T2,TimeType> Time-dependent function module with oneinput: f : T1 × TimeType→ T2
scax_func2t<T1,T2,T3,TimeType> Time-dependent function module with twoinputs: f : T1 × T2 × TimeType→ T3
T. Mähne, A. Vachoux (EPFL/STI/IEL/LSM) Dimensional Analysis in SystemC-AMS BMAS 2009 25 / 25