CoCoViLa

advertisement
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
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
3
Technology of visual programming
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.
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
5
Automatic program synthesis
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.
Specification
Description of problem area (model, scheme)
Known values x1, ..., xm (constants, initial values of components)
Unknown values y1, ..., yn (components to be computed)
Computing tasks
Compute required components values
Compute all the components values that can be computed
Computing algorithm is synthesized automatically
Creating a new package
Creating visual class
Defining ports
Defining visible components
Defining click area
9
Class specification in Java
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
13
Specification
Program
Result
14
15
Specification language
1) 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);
Logic chains
Classes:
●
And
●
Or
●
Gener
●
Delay
●
Not
17
Dif
Classes:
●
Adder
●
Invertor
●
Integrator
●
Multiplier
●
Graph
●
Clock
18
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.
Multi-pole models
Multi-pole models enable to represent complex chain systems
Q1
Q2
x,v
Q1
Gh
p1
p1
p2
F
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.
Q1
p1
Yg
Q2
Q1
p2
v
F
p1
Q2
Q1
p2
v
F
p1
Hh
Q2
p2
v
F
Yh
Q2
p2
v
F
Four forms (causalities) of six-pole models
for a hydraulic piston in cylinder
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
Pump control device
Components :
• Spool valve
• Spool valve inflow slot
• Spool valve outflow slot
• Constant resistor
• Positioning cylinder
• Swash plate with spring
Valve block
Throttle edges :
• Measuring throttle edge Rvw
• Pressure compensator throttle edge Ridw
• Meter-in throttle edge Rsk-zu
• Meter-out throttle edge Rsk-r
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).
RVP – Meter-in throttle edge of the control valve
5.3.3 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
beta
beta
amax
d
R
lmax = R *(180 - 2 * beta) * 2 * Pi / 360
hmax = R * (1 - cos ((90 - beta) * 2 * Pi / 360))
hmax
0.003
amax = 2 * sqrt (2 * hmax * R - hmax * hmax)
l0
yS = y + l0
yS
d = amax + 2 * (yS - hmax) * tan(beta * 2 * Pi/360)
y
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.
Description of positioning cylinder ZV in CoCoViLa
Computing process organization
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.
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.
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
Step
Impulse
Sine curve
Disturbances cause transient responses or continuous oscillations.
Simulating steady-state conditions
Simulating components
Multi-pole models:
RSKA – meter-out throttle edge
of a hydraulic motor
static Source – range of values for volumetric
flow Q1 and for position angle
of the pump swash plate y
const Source – constant pressure p2 in
pump outlet
static Process – simulation manager
Output pressure p1e, Pa
Output flow Q2, m3/s
Simulation task of meter-out throttle
edge of a hydraulic motor
Displacement of the control valve, m
Simulated graphs
Simulating a subsystem
Multi-pole models:
static Process - simulation manager
VP – control valve
RVP - meter-in throttle edge
of the control valve
IEH1-3 - hydraulic interface
element
RVT - meter-out throttle edge
of the control valve
ZV - positioning cylinder with
swash plate
ResY - hydraulic resistor
static Source - input values
constant Source - constant input
Simulation task of a
hydraulic-mechanical
controller
1 Pump control pressure, Pa
2 Swash plate position angel, rad
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
Displacement of control valve, m
Simulating steady-state conditions of a load-sensing system
Load moment of the hydraulic motor, Nm
1
2
3
4
3D simulation of steady-state conditions
Calculated 1000 x 1000 points
Calculation time 119 s
Pump volumetric flow, m3/s
Pump outlet pressure, Pa
Pump efficiency coefficient
Load-sensing system efficiency coefficient
Simulating dynamics of a 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/s
timesteps = 1.3E4
Simulation task of dynamics of the load-sensing system
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.
Results of simulation of a load-sensing system dynamics
Time, s
Time, s
1 Pump control pressure, Pa
2 Position angle of the pump swash plate, rad
3 Displacement of the pump control valve, m
1 Angle velocity of the drive mechnism, rad/s
2 Pressure at the hydraulic motor outlet, Pa
Conditions:
•
•
•
Time, s
1 Angle velocity of the pump, rad/s
2 Volumetric flow of the pump, m3/s
3 Outlet pressure of the pump, Pa
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
Electro-hydraulic servo-system
Simulation task
of servo system
dynamics
Feeding system
Safety valve
Servo-drive
Servo-valve
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
Time, s
1 Actuator position, m
2 Actuator velocity, m/s
3 Step disturbance of the
input voltage, V
4 Step disturbance of
the load force, N
1 Displacement of sliding spool, m
2 Displacement of flapper, m
Time, s
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.
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 the
time 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 Feeding volumetric flow, m3/s
2 Feeding pressure, Pa
3 Displacement of safety valve, m
Time, s
1 Pressure in left chamber, Pa
2 Pressure in right chamber, Pa
Time, s
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.
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 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.
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.
3 Safety valve reacts to changes of pressure.
Difference of pressures remains constant 12.2E6 Pa from
the time moment the load force reaches the value of step
disturbance 8E4 N.
Sizes and complexities
Load-sensing system
Servo-system
Model:
Number of components
26 (+4+11)
37 (+4+13)
Iterated variables
17
20
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
Simulation task of dynamics:
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
Computing 3D graphs of a transient response of an electro-hydraulic servosystem
History
Models
Computers
Software
Tasks
1970
four-pole models
of elements,
signal flow graphs
Minsk22
Fortran
Malgol
calculating of
frequency responses
of tubes
1975
four-pole models
and transfer functions
of valves
Minsk32
Fortran
calculating of
frequency responses
of valves
1985
multi-pole models
of components,
models of systems
EC
minicomputers
Labtam
PRIZ
C-PRIZ
calculations on
schemas
1995
visual
models
Sun workstations NUT
calculations on
visual schemas
personal
computers
sizable calculations
on large visual
schemas
2006-> visual models
of large systems
CoCoViLa
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
History of programming environments
●
SMP
●
PRIZ
●
ExpertPriz
●
NUT
●
CoCoViLa
40
An application in NUT system
Radar
calculations
41
Vertical coverage
42
Surface profile
43
Radar coverages
44
Concluding remarks
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
45
Thank you for attention
46
Download