cocovila compiler compiler of visual languages mait harf institute of cybernetics, tut...

46
CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT [email protected]

Upload: emil-booker

Post on 24-Dec-2015

227 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

CoCoViLa

Compiler Compiler of Visual Languages

Mait Harf

Institute of Cybernetics, TUT

[email protected]

Page 2: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

CoCoViLa programming environment

CoCoViLa is platform independent Java based graphical programming environment.

CoCoViLa ( Compiler Compiler of Visual Languages) provides a framework for developing

visual specification languages.

Implemented in the Institute of Cybernetics at Tallinn University of Technology.

http://www.cs.ioc.ee/cocovila Main features:

• declarative object-oriented programming

• visual programming

• automatic program synthesis based on proof search in intuitionistic propositional logic.

• platform independent

• requires at least Java Runtime Environment 1.6.

CoCoViLa includes:

• class editor for composing classes

• scheme editor for composing schemes

• synthesizer for automatic generation of Java programs from the

scheme and the class specifications

Page 3: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

3

Motivation

● Simplify using computer for domain area experts.

● Create visual languages for formal describing models in different problem areas

● Create a tool for problem area experts for solving problems in their problem areas.

● Automate computing processes

Page 4: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

The first steps described in the figure are taken by the developer of the language who is responsible for writing the necessary Java classes, specifications and visual extensions. The language developer must understand the problem domain.

The language user need not be a software expert, but can work on the level of visual programming, arranging and connecting objects to create a scheme.

After a scheme has been built by the language user, the remaining steps: parsing, translating, planning and compiling are automatically taken by the computer.

Technology of visual programming

Page 5: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

5

Visuality and object orientation

● Classes as types of components● Class

● components● relations (methods)● constants

● Visual class● class● image● icon

● Schemes (models) as couples of objects ● objects● links between objects

Page 6: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

Automatic synthesis of programs is a technique for the automatic construction of programs from the knowledge available in specifications of classes. Having a specification of a class, we are, in general, interested in solving the following problem: find an algorithm for computing the values of components y1, ..., yn from the values of components x1, ..., xm.

The automatic synthesis of programs, is based on proof search in intuitionistic propositional logic.

SpecificationDescription of problem area (model, scheme)Known values x1, ..., xm (constants, initial values of components)Unknown values y1, ..., yn (components to be computed)

Computing tasksCompute required components valuesCompute all the components values that can be computed

Computing algorithm is synthesized automatically

Automatic program synthesis

Page 7: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee
Page 8: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee
Page 9: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

9

Creating a new package Creating visual class

Defining portsDefining visible components

Defining click area

Page 10: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

Class specification in Java

Page 11: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee
Page 12: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee
Page 13: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

13

Composing scheme and computing

Load package

Create elements

Link elements via ports

Input initial values

Draw specification (scheme)

Synthesize computing program( Compute All)

Perform calculations

Propagate values

Page 14: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

14

Specification Program

Result

Page 15: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

15

Page 16: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

Specification language1) Declaration of variables

type id, id, ...;

The type is a primitive type, a class, or a metaclass.

Examples: int i,step;

Boiler b;

2) Binding

a = b;

Binding is an equality, where a, b are variables.

3) Equation

Example: x = 2* y*sin(alpha);

3) Axiom

precondition -> variable{name-of-method}

Example: x,y -> z{P}

This axiom specifies that a method P can be used for calculating z

int P(int a, int b) {…}

4) Alias

alias name = (list of names);

Examples: alias state = (*.state);

alias in = (x1, x2);

Page 17: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

17

Classes:● And● Or● Gener● Delay● Not

Logic chains

Page 18: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

18

Classes:● Adder● Invertor● Integrator● Multiplier● Graph● Clock

Dif

Page 19: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

Modeling and simulation systems for fluid power systems developed in CoCoViLa environment

● Hydraulic elements (tubes, resistors, volume elasticities, interface elements) and hydraulic circuits

● Electro-hydraulic load-sensing systems

● Electro-hydraulic servo-valves and servo-systems

Library has been developed containing more than 100 CoCoViLa visual classes implementing multi-pole models of different components.

Page 20: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

Four forms (causalities) of six-pole models

for a hydraulic piston in cylinder

Hydraulic piston in cylinder with three pairs of variables:

p1, Q1; p2, Q2; x (or v), F,

where

p1, p2 pressures in the cylinder chambers,

Q1, Q2 volume flow rates in cylinder chambers,

x, v position and velocity of the piston rod,

F force on the piston rod.

Q 2 p 2 v

F

Q1 p 1

H h G h Q1 p1

Q 2 p 2 v

F

Q1 p1

Y g Q 2 p 2 v

F

Q1 p1

Y h Q 2 p 2 v

F

Q1 Q2 x,v

p1 p2 F

Multi-pole models

Multi-pole models enable to represent complex chain systems

Page 21: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

Functional scheme and multi-pole model of an electro-hydraulic load-sensing system

Pump with controller:

• PV - Variable displacement axial-piston

pump

• ME - Elektric motor

• CJh - Clutch

• VP - Control valve

• RVP, RVT - Throttle edges of the control

valve

• Res1, Res2, Res5, Res6 - Resistors • ZV - Positioning cylinder

Feeding circuit of hydraulic motor:

• Tube1, Tube2 - Tubes

• RIDW - Pressure compensator

• RVW - Measuring valve

• CV - Check valvel

• RSKZ - Meter-in throttle edge of

directional valve

• Res3, Tube3; Res4, Tube4 - Silencers

Hydraulic motor MH

Outlet circuit of the hydraulic motor:

• RSKA - Meter-out throttle edge of

directional valve

• CJhM - Clutch

Page 22: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

Components : • Spool valve• Spool valve inflow slot• Spool valve outflow slot• Constant resistor • Positioning cylinder • Swash plate with spring

Throttle edges :• Measuring throttle edge Rvw• Pressure compensator throttle edge Ridw• Meter-in throttle edge Rsk-zu• Meter-out throttle edge Rsk-r

Pump control device Valve block

Page 23: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

ZV - Positioning cylinder with pump swash plate

Static displacement of the swash plate spring

x = f0 - Fc / c where Fc = A*p1/krp - F – Ff;

A = P *D² / 4; Ff = Ff0 + kf *p1

Difference of the swash plate velocity in the spot of spring dv = delta*(Fc - (f0 - x)*c - (Ff0 + kf*p1)*signum(v) - h*v)/m

Difference of the swash plate displacement in the spot of spring dx = - delta*v

Displacement angle of the swash plate al = atan (x / rz)

Volumetric flow to the positioning cylinder Q1 = A*v

Parameters: f0 = 0.0265 m, c = 20874 N/m, D = 0.018 m, Ff0 = 0.5 N, kf = 5E-6 m², krp =0.833, rz = 0.065 m, almax = 0.3264 rad,

m = 0.5 kg, h = 10 N/(m/s).

Page 24: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

5.3.3 RVP – Meter-in throttle edge of the control valve

RVP – Meter-in throttle edge of the control valve

Output pressure

p2c = p1 - Q2² * TR * rho / 2,

where TR = 1 / (al*Ad1)² + 1 / (al*Ad2)²

longitudinal area of two slots:

Ad1 = (5e-08 + (lmax * R - amax * (R - hmax))) + 2 * (yS - hmax) * (amax + d) / 2

across area of two slots:

Ad2 = 5e-08 + 2*d*g

lmax = R *(180 - 2 * beta) * 2 * Pi / 360

hmax = R * (1 - cos ((90 - beta) * 2 * Pi / 360))

amax = 2 * sqrt (2 * hmax * R - hmax * hmax)

yS = y + l0

d = amax + 2 * (yS - hmax) * tan(beta * 2 * Pi/360)

Scheme of the valve slot

Output volumetric flow

Q1 = Q2

Parameters: D = 0.008 m, al = 0.81, R = 1.1E-4 m, beta = 0.3º, l0 = 5.6E-4 m, g = 0.001 m.

d R

beta beta

amax

l0 hmax

0.003 y

yS

Page 25: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

Description of positioning cylinder ZV in CoCoViLa

Page 26: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

Simulation process is organized by class “process”. State variables are introduced for every functional element to characterize the features of the element at each simulation step.

Simulation process starts from initial state (initstate) and includes calculation of next state (nextstate) from previous states (usually from prevstate and state). As a result of simulation final state (finalstate) is computed.

Computing process organization

For computing variables in case of loop dependencies iterations have been used. When starting the process, approximate values of such variables have been given as initials.

For example in the model a loop dependence

TM.th1 -> NF.th1 -> NF.Thd -> TM.Thd -> TM.th1

takes place. All the loop dependences can be solved if variables

TM.th1, TM.x1, SP.th2, SP.v

are split and calculated using built-in iteration method.

State variables and split variables must be described in component models.

When building a particular simulation task model and performing simulations state variables and split variables are handled and used automatically.

Page 27: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

Processes in mechatronic systems

Processes in mechatronic systems:

Static – caused by static inputs

Steady-state – caused by steady-state inputs

Dynamic – caused by inputs depending on time (disturbances)

Main disturbances of dynamic responses:

theoretical practical

Disturbances cause transient responses or continuous oscillations.

Step

Impulse

Sine curve

Page 28: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

Simulating steady-state conditions

Simulating components

Simulation task of meter-out throttle edge of a hydraulic motor

Simulated graphs

Output pressure p1e, Pa

Output flow Q2, m3/s

Displacement of the control valve, m

Multi-pole models:

RSKA – meter-out throttle edge of a hydraulic motorstatic Source – range of values for volumetric flow Q1 and for position angle of the pump swash plate yconst Source – constant pressure p2 in pump outletstatic Process – simulation manager

Page 29: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

Simulating a subsystem

Intervals of changing:

Control valve displacement: 0…0.0028 m

Pump control pressure: (3.3…19) E5 Pa

Displacement angle of the pump swash plate:

0.3264…0 rad

Multi-pole models:

static Process - simulation managerVP – control valveRVP - meter-in throttle edge of the control valveIEH1-3 - hydraulic interface elementRVT - meter-out throttle edge of the control valveZV - positioning cylinder with swash plateResY - hydraulic resistorstatic Source - input valuesconstant Source - constant input

1 Pump control pressure, Pa2 Swash plate position angel, rad

Displacement of control valve, m

Simulation task of a hydraulic-mechanical controller

Page 30: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

Simulating steady-state conditions of a load-sensing system

1 Pump volumetric flow, m3/s2 Pump outlet pressure, Pa3 Pump efficiency coefficient4 Load-sensing system efficiency coefficient

3D simulation of steady-state conditions

Calculated 1000 x 1000 points

Calculation time 119 s

Load moment of the hydraulic motor, Nm

Page 31: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

Multi-pole models: VP – Displacement of the pump control valve; RVP – Meter-in throttle edge of the pump control valve; IEH – Hydraulic interface elements; RVT – Meter-out throttle edge of the pump control valve; ResG, ResH, ResY – Hydraulic resistors; ZV – Positioning cylinder with swash plate; PV – Variable displacement pump; ME – Electric motor; CJh – Clutch with rotor of the pump; RIDVWlin – Measuring valve with pressure compensator; TubeH – Tubes; Tubeg – Tubes with closed end; RSKZ – Check valve and meter-in throttle edge of the hydraulic motor; MH – Hydraulic motor; RSKA – Meter-out throttle edge of the hydraulic motor; CJhM – Clutch with rotor of the hydraulic motor and drive mechanism.

Inputs: dynamic Source – Values of the hydraulic motor load moment M and the directional valve displacement y;

constant Source – Constant values.

Simulation task of dynamics of the load-sensing system

Inputs:

dynamic Source y: mean = 0.0045 m,step = - 0.0015 m

dynamic Source M2: mean = 65 Nm,step = 20 Nm

constant Source: RVP: p1 = 6E6 Pa,RVT, ResY, TubeH: p2 = 2E4 Pa

Simulating conditions:

tau = 1/delta = 1E6 1/stimesteps = 1.3E4

Simulating dynamics of a load-sensing system

Page 32: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

Results of simulation of a load-sensing system dynamics

1 Pump control pressure, Pa2 Position angle of the pump swash plate, rad3 Displacement of the pump control valve, m

1 Angle velocity of the pump, rad/s2 Volumetric flow of the pump, m3/s3 Outlet pressure of the pump, Pa

1 Angle velocity of the drive mechnism, rad/s 2 Pressure at the hydraulic motor outlet, Pa

Conditions:• Both a step change +10 Nm to the load moment of the drive mechanism 65 Nm and step change 0.0015 m to the displacement of the directional valve 0.0045 m were applied simultaneously (during 0.01 s).• Time 1.3 s, timestep10 μs. • Results have been calculated for 130 000 points.

Observations:

• Dynamic responses damp in 1.3 s.

• Natural frequences are about 5 Hz.

• Pressure at the outlet of the hydraulic motor carries frequency ~40Hz because no hydraulic silencer is used at the outlet tube

Time, s Time, s

Time, s

Page 33: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

Electro-hydraulic servo-system

Simulation task of servo system dynamics

Feeding system

Safety valve

Servo-drive

Servo-valve

Page 34: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

1 Actuator moves almost linearly from 0 to 0.03 m in time interval 0…0.27 s. Precise analysis shows that lack 155 μm of desired actuator position 0.03 m takes place at time moment 0.30 s.

2 Actuator velocity oscillates with high frequency 900 Hz until thetime moment 0.03 s, then increases to maximum 9E-2 m/s, thereafter decreases to zero at time moment 0.30 s.

3 Step disturbance of the input voltage is 3 V.

4 Step disturbance of the load force is 8E4 N.

1 Sliding spool moves rapidly from zero to 6.7E-5 m during 0.03 s. After 0.18 s the sliding spool moves to final position 3E-5 m.

2 Flapper jumps out to 7.5E-7 m and then moves to the position zero at time 0.3 s.

Conditions: step disturbance 3 V of input voltage U during 0.01 s and step disturbance 8E4 N of load force F during 0.01 s

1 Actuator position, m2 Actuator velocity, m/s3 Step disturbance of the input voltage, V4 Step disturbance of the load force, N

1 Displacement of sliding spool, m2 Displacement of flapper, m

Time, sTime, s

Page 35: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

1 Feeding volumetric flow achieves the maximum value 6.2E-4 m3/s. After 0.18 s the feeding volumetric flow decreases to 5E-6 m3/s at time moment 0.3 s.

2 At the beginning the feeding pressure decreases to 15.6E6 Pa during the time 0.06 s. Then the feeding pressure increases to 21.7E6 Pa, after which damps at 21.5E6 Pa.

3 Safety valve reacts to changes of pressure.

1 Pressure in left chamber of the hydraulic cylinder rapidly increases from 10.5E6 Pa to 17.1E6 Pa. Pressure stabilizes at 17.6E6 Pa.

2 Pressure in right chamber of the hydraulic cylinder rapidly decreases from 10.5E6 Pa to 4.8E6 Pa. Thereafter the pressure stabilizes at 5.4E6 Pa.

Difference of pressures remains constant 12.2E6 Pa from the time moment the load force reaches the value of step disturbance 8E4 N.

Time, s1 Feeding volumetric flow, m3/s2 Feeding pressure, Pa3 Displacement of safety valve, m

1 Pressure in left chamber, Pa2 Pressure in right chamber, Pa

Time, s

Page 36: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

Sizes and complexities

Load-sensing system Servo-system

Model:

Number of components 26 (+4+11) 37 (+4+13)

Iterated variables 17 20

Simulation task of dynamics:

Java code lines 5113 8920

Time step 1E-5 s 1E-6 s

Number of simulation steps 130 000 700 000

Simulation time (3.2 GHz processor ) 7 min 31 min

Difficulties:

1 Short time step and large number of simulation steps are required

2 Parameters of working fluid must be recalculated at each simulation step

Page 37: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

Computing 3D graphs of a transient response of an electro-hydraulic servo-system

Page 38: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

History

Models Computers Software Tasks

1970 four-pole models Minsk22 Fortran calculating of of elements, Malgol frequency responses

signal flow graphs of tubes

1975 four-pole models Minsk32 Fortran calculating ofand transfer functions frequency responses of valves of valves

1985 multi-pole models EC PRIZ calculations on of components, minicomputers C-PRIZ schemas

models of systems Labtam

1995 visual Sun workstations NUT calculations on models visual schemas

2006-> visual models personal CoCoViLa sizable calculationsof large systems computers on large visual

schemas

Page 39: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

Observations

● Avoiding large equation systems:

- multilevel calculations

- iterative recomputing (on scheme) using subtasks

● Multi-pole models are very suitable in CoCoViLa applications

● First it has been possible to model and simulate real-life hydraulic systems.

● Large applications need cooperation both domain area experts and system experts

Page 40: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

40

History of programming environments

● SMP● PRIZ● ExpertPriz● NUT● CoCoViLa

Page 41: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

41

Radar calculations

An application in NUT system

Page 42: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

42

Vertical coverage

Page 43: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

43

Surface profile

Page 44: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

44

Radar coverages

Page 45: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

45

Advantages:● Language of the problem area can be used● Visuality● Structuring

To keep in mind:

● Non-traditional approach● Consistency of the model must be guaranteed

Possible problems:

● Lack of information in specifications ● Nonsolvability of equations● Nonsolvability of equation systems

Concluding remarks

Page 46: CoCoViLa Compiler Compiler of Visual Languages Mait Harf Institute of Cybernetics, TUT mait@cs.ioc.ee

46

Thank you for attention