An animation facility for computer-aided design

An animation facility for computer-aided design

An animation facility for computer-aided design A. RICCI (CNIzN Centro dl Calcolo, V~a Mazzm~ 2, 40138-Bologna, Italy) An interactive graphic extensio...

2MB Sizes 1 Downloads 162 Views

An animation facility for computer-aided design A. RICCI (CNIzN Centro dl Calcolo, V~a Mazzm~ 2, 40138-Bologna, Italy) An interactive graphic extension of a continuous systems simulation language is discussed aimed at providing a general purpose support for ammatmn_ The interacuve commands available to the user are described together with an explanation of how the basic set of commands can be extended using commands statable for the particular design problem A selection of apphcations are described (Received in revised form on 23rd July 1974)

INTRODUCTION It is widely r e c o g n i z e d t h a t w h e n t h e o b j e c t o f a design process is a s y s t e m having a d y n a m i c f u n c t i o n t h e n a n i m a t i o n can be a great help to t h e designer_ T h e s i m u l a t i o n of t h e t i m e b e h a v i o u r o f t h e s y s t e m provides t h e designer with a large a m o u n t of t h e i n f o r m a t i o n n e e d e d t o o p t i m a l l y d e f i n e t h e s t r u c t u r e of t h e s y s t e m a n d d e t e r m i n e the b e s t values for m e a n i n g f u l p a r a m e t e r s This is p a r t i c u l a r l y t r u e w h e n this c a n n o t be d o n e w i t h o u t a c o m p l e t e k n o w l e d g e o f h o w i n t e r r e l a t e d s y s t e m q u a n t i t i e s vary vs. time_ O n e e x a m p l e is m t h e design o f m e c h a n i c a l linkages, t h e p u r p o s e of w h i c h IS t h e r e a h z a t m n o f p r e d e t e r m i n e d loci for o n e or m o r e o f the n o d e s In this case, s y n t h e s i s p r o c e e d s b y real a n d e r r o r a n d s i m u l a t i o n o f t h e linkage ~s very useful in evaluating the e f f e c t o n t h e o b t a i n e d loci resulting f r o m a c h a n g e in g e o m e t r i c a l q u a n t i t i e s in t h e system. In general, since the d y n a m i c b e h a v i o u r of c o n t i n u o u s s t a t e & s c r e t e systems can be d e s c r i b e d by a set o f o r d i n a r y differential e q u a t m n s , it is possible t o devise a general purpose a m m a t l o n facility to be used in c o n j u n c t i o n w i t h already d e v e l o p e d c a d a l g o n t h m s a n d techniques_ The ammation faclhty for both the system descriptmn and t h e d i f f e r e n t i a l e q u a t i o n s solution, p r e s e n t e d here is b a s e d o n t h e CSMP language for c o n t i n u o u s s y s t e m s slmulan o n T h e facility, CDp, I is i m p l e m e n t e d as an i n t e r a c t i v e graphic e x t e n s m n of CSMP

w h e r e X1, X2, _ _ , X M are t h e I n p u t variables a n d t h e Y1, Y2, _ , Y N t h e o u t p u t variables of t h e f u n c n o n a l block F In a d d i t i o n , s t a t e m e n t s are p r o v i d e d to define p a r a m e t e r s c o n s t a n t s a n d t h e initial value of t i m e d e p e n d e n t quantities. As a n example, m the case of t h e mass, spring a n d d a m p e r s y s t e m s h o w n In Figure 1, t h e c o r r e s p o n d i n g d i f f e r e n t i a l equation 1

Jc =

(-cx-

kx)

7ql

w h e r e x = d i s p l a c e m e n t f r o m t h e rest p o s l t l o n , m = mass. c = d a m p e r c o n s t a n t , k = spring c o n s t a n t

THE CDP S Y S T E ~ I COHtZnuous systems

modelhng

program

(CSMP)

T h e t i m e b e h a v l o u r o f a c o n t i n u o u s s y s t e m can be described by a set o f o r d i n a r y d i f f e r e n t i a l e q u a t i o n s with variable quantities, generally c o n t i n u o u s versus time_ S u c h s y s t e m s have b e e n s i m u l a t e d first using analogue a n d h y b r i d comp u t e r s a n d later using digital c o m p u t e r s , because o f t h e i r h i g h e r precision a n d easier p r o g r a m m i n g A t the p r e s e n t time, p o w e r f u l &gital c o m p u t e r languages are available a n d the m o s t widely used o n e is t h e c o n t i n u o u s s y s t e m s modelh n g p r o g r a m (CSMP) p r o v i d e d by IBM. In the CSMP language, t h e s t r u c t u r e of t h e s y s t e m t o be s i m u l a t e d is described b y m e a n s o f f u n c t i o n a l blocks, having t h e general f o r m Y1, Y2,

Volume 7

, Y N = F ( X 1 , X2,

Number 2

April 1975

, XM)

b F I G U R E l (a a n d b) S c r e e n *mages o f a ma~s, sprang and d a m p e r s y s t e m durzng a CDP Slnlulatton run

75

a~ R l c c l

FIGURE 2

This c a n be d e s c r i b e d m t h e CSMP language b y t h e following s t a t e m e n t s X = I N T G R L ( X O , XP) XP = INTGRL(XPO, X2P)

X 2 P = - ( C * X P + K*X)/3,I w h e r e X O a n d X P O are respectively t h e i m n a l c o n d i t i o n s for :, a n d k- To assign t h e desired values to t h e initial c o n d i t i o n s and o t h e r p a r a m e t e r s m the system, t h e f o l l o w i n g s t a t e m e n t s ,

T h e IBM 2 2 5 0 Dzsplay U m t

has to code the actual r e p r e s e n t a t m n of t h e s y s t e m from the o u t p u t variables available to h i m However, t h e user is con> pletely free of the graphic coding n e e d e d for p l o t t i n g t i m e d e p e n d e n t q u a n t i t i e s and for t h e s y s t e m r e p r e s e n t a t m n , a small set of graphic r o u t i n e s is m a d e available to t h e programmer All of the f e a t u r e s of the IBM 2 2 5 0 Display U m t are used b y the CDP system, the general o r g a n i z a n o n of w h i c h is d l u s t r a t e d in Figure 3 . As can be easily seen, CDP is an e x t e n s i o n to CSMP a n d c o m p r i s e s a p r e - c o m p d e r for processmg a s t a t e m e n t , special to CDP a n d a d d e d to t h e s y n t a x

1NCON X O = 1 0 , X P O = 0 P A R A M E T E R ~ 1 = 9 2, C = 1 5 , K = 3

l

are i n c l u d e d in the CSMP p r o g r a m T o c o n t r o l t h e simulation run, t o i n d i c a t e t h e w a n t e d m t e g r a t m n m e t h o d , t o edit t h e results o u t p u t , etc, suitable s t a t e m e n t s are p r o v i d e d in the CSMP language a n d s h o u l d also be i n c l u d e d in the program Because CSMP leaves t o the user t h e p r o b l e m of developmg his o w n d i f f e r e n t i a l e q u a t i o n s , ~t ~s n o t s t a t a b l e for s t u d y i n g very c o m p l e x s y s t e m s In this case, t h e code r e p r e s e n t i n g the e q u a t i o n s will c o m p r i s e m o s t of t h e code in the CSMP p r o g r a m and t h e size of the CSMP p r o g r a m wdl a p p r o a c h the size of a special p u r p o s e F o r t r a n p r o g r a m , b u t carry t h e disadvantage of a storage b u r d e n

I

r

r

CDP pr¢ -compiler

l

I

COP

'2 I

The CS,,IlP graphw extension (CDP)

76

I

L

I

A n a m m a t l o n s y s t e m c o n n e c t e d t o CSMP ~s t h e CDP s y s t e m ~'2 t h a t p e r m i t s t h e Interactive s i m u l a t i o n o f a cont i n u o u s s y s t e m described b y a CSMP p r o g r a m w i t h the possibility of the m o d i f i c a t i o n of the c u r r e n t values o f pred e t e r m i n e d variables and p a r a m e t e r s In the p r o g r a m during the s i m u l a t i o n r u n T h e t i m e b e h a v m u r of t i m e d e p e n d e n t q u a n t l t i e s can b e p l o t t e d or an a n i m a t e d , reahstlc or s c h e m a t i c , r e p r e s e n t a t i o n of the s y s t e m b e i n g s t u d i e d can be s h o w n o n t h e screen of an IBM 2 2 5 0 Display U n i t (Figure 2) CDP n a t u r a l l y applies to a very large class of p r o b l e m s , so autom a t i c g e n e r a t i o n o f graphic o u t p u t is impossible. T h e user

CDPICSMP program

t

CSMP s y s t e m

l

I

Progrom

~ )

CxecutlOIh

l

Work ) volumes

DbgLtal

Printed results

I

I

I

8K IBM 2250 dlsploy unit

' I I [

Alphonumeri¢ keyboard Progromm~zd function keyboard

FIGUR£ 3

l b e CDP s y s t e m orgamzat~on

COMPUTER AIDED DESIGN

An ammat~on fac~hty for c a d of the CSMP language in o r d e r to p e r m i t t h e d e f i m t i o n of m t e r a c t w e varmbles_ A h b r a r y IS also p r o v i d e d w h i c h contams all t h e r o u t i n e s n e e d e d to c o n t r o l the display u m t . Part of t h e r o u t i n e s in t h e library can be freely u s e d by t h e CDP p r o g r a m m e r in o r d e r to take over the c o n t r o l of the &splay u m t and thas p e r m i t s n n p r o v e m e n t of the p r o g r a m i n t e r a c t i o n capability b y e x t e n s i o n of t h e basac set o f CDP l n t e r a c t w e c o m m a n d s w i t h new a n d c o m p l e x c o m m a n d s o r i e n t e d to t h e partacular p r o b l e m to w h i c h t h e s y s t e m as applied. The direct use o f the CDP h b r a r y r o u t i n e s is m o s t conv e m e n t l y d o n e in t h e F o r t r a n s u b r o u t i n e s I M A G E and DISPLX, d u m m y versions o f w h i c h are c o m p r i s e d in t h e CDP s y s t e m The)- can be o p t i o n a l l y supplied to t h e CSMP p r o g r a m . T h e first r o u t i n e 1S a u t o m a t i c a l l y a n d l t e r a t i v e l y called b y t h e p r o g r a m d u r i n g t h e s i m u l a t i o n r u n xf the CDP s y s t e m has b e e n set in the I M A G E ( a n i m a t e d ) m o d e of o p e r a t i o n b y m e a n s o f a s u i t a b l e c o m m a n d in t h e basic set_ This s u b r o u t i n e s h o u l d be m a i n l y used t o d e s c r i b e t h e anim a t e d image to be & s p l a y e d . T h e s e c o n d s u b r o u t i n e IS called in r e s p o n s e to a c o r r e s p o n d i n g CDP c o m m a n d a n d can be e f f e c t w e l y used to i m p l e m e n t the desired n e w comm a n d s A d e t a i l e d i l l u s t r a t i o n of t h e I M A G E a n d D I S P L X r o u t i n e s is given in later sections. T h e CDP system, can also o p e r a t e in P L O T m o d e , in w h i c h the display u m t as controlled by the s y s t e m itself and t h e t i m e b e h a v a o u r o f )selected variables in the p r o g r a m as displayed. In a d d i t i o n , this m o d e of o p e r a t i o n can be e s t a b h s h e d b y the user b y m e a n s of a c o r r e s p o n d i n g CDP c o m m a n d .

IAIAGE

mode

W h e n t h e CDP s y s t e m IS set in I M A G E m o d e , a screen image is d i s p l a y e d a c c o r d i n g t o t h e d e s c r i p t i o n given in t h e F o r t r a n s u b r o u t i n e I M A G E c o d e d b y t h e s y s t e m user I M A G E can use the r o u t i n e s of DSP 3, a general package f o r l n t e r a c t w e c o m p u t e r graphics. DSP is available in t h e CDP h b r a r y T h e r o u t i n e s in the package t h a t can be used t o c o n s t r u c t the screen ~mage are briefly i l l u s t r a t e d here In t h e c o n s t r u c t i o n of an image, b e f o r e t h e d e f i n i t i o n o f ItS graphic elements, it is necessary t o s t a t e t h e scale corr e s p o n d i n g , an t h e p r o g r a m , to the p h y s i c a l size ( 1 2 x 12 in) o f t h e screen This can b e d o n e with t h e s t a t e m e n t C A L L N E W D S P ( X 0 , Y0, X1, Y1) w h e r e X0, Y0 are t h e f l o a t i n g p o i n t variable c o - o r d i n a t e s a s s u m e d in t h e p r o g r a m for t h e l o w e r l e f t m o s t p o i n t o f t h e screen and X1, Y1 t h o s e c o - o r d i n a t e s for t h e u p p e r rightm o s t p o i n t T h e scales are hnear_ A n a d d i t i o n a l f u n c t i o n o f t h e NEWDSP r o u t i n e is t h a t o f deleting a n y pre-existing Image a n d thls is t h e o n l y way a c o m p l e t e image can be d e l e t e d in DSP. T h e c h a n g e of s t a t u s o f a part of t h e image to a b l a n k e d one, w i t h o u t d e l e t i o n of t h e c o r r e s p o n d i n g i n f o r m a t i o n In the u n i t buffer, can be o b t a i n e d b y m e a n s o f graphic s e q u e n c e c o n t r o l l i n g r o u t i n e s T w o r o u t i n e s are p r o v i d e d in DSP for t h e deflmt i o n of the e l e m e n t s o f t h e image T h e first o n e IS called by the statement C A L L DSP(X, Y, K)

PLOT

mode

P r e d e t e r m i n e d variables m t h e CSMP p r o g r a m c a n be d e f i n e d as i n t e r a c t i v e w i t h a s t a t e m e n t a d d e d to t h e s y n t a x o f the CSMP language. This s t a t e m e n t , w h i c h m u s t have the f o l l o w i n g f o r m a t ,

* DISPLAY

variable

name

[S152]

defines t h e c o r r e s p o n d i n g variable as i n t e r a c t i v e If the t w o n u m e r i c a l values s 1 a n d s 2 are given, t h e n t h e variable m u s t be p l o t t e d versus tame, w h e n t h e CDP s y s t e m as m P L O T m o d e , w i t h a scaling f a c t o r derived f r o m s 1 a n d s 2 Scaling is e f f e c t e d m such w a y as to m a k e the screen left h m i t c o r r e s p o n d to t h e c u r r e n t value of the reserved v a n able * U * , t h e screen right limit to t h e c u r r e n t value o f the reserved variable F I N T I M , t h e u p p e r limit to (s 1 + s 2) a n d t h e l o w e r one t o (s 1 s2)_ Up to 100 variables m t h e program can be d e f i n e d a n t e r a c t w e a n d f o r each o f t h e m t h e vertical scaling f a c t o r is d e p e n d e n t o n t h e c o r r e s p o n d i n g p a r a m e t e r s s 1 a n d ~2 T h e s e p a r a m e t e r s can also be s u p p h e d a n d m o d i f i e d d u r i n g t h e s l m u l a u o n r u n b y m e a n s of approp r m t e CDP i n t e r a c t i v e c o m m a n d s _ Also, t h e value o f t h e reserved variables * U* a n d F I N T I M and t h e r e m a i n i n g reserved variables T I M E ( c u r r e n t time), D E L T ( i n t e g r a t i o n step), D E L M I N ( m i m m u m step f o r variable step i n t e g r a t i o n m e t h o d s ) and P R D E L ( p r i n t i n g step), can b e m o d a f m d mteractwely P l o t t i n g t h e t i m e b e h a v l o u r of a given variable can be s u s p e n d e d a n d restarted, t h e s c r e e n image can b e erased a n d t h e h o r i z o n t a l scaling changed, b y c h a n g i n g t h e value o f • U* a n d FINTIM, t h u s l e t t i n g t h e screen image r e p r e s e n t the desired p a r t of t h e p l o t

Volume 7

Number 2

Aprd 1975

w h e r e X a n d Y are t h e c o - o r d i n a t e s o f a p o i n t w h i c h is d e f i n e d as t h e n e w c u r r e n t p o s i t i o n o f t h e e l e c t r o n i c b e a m o n the screen T h e r e Is n o visible image of t h e p o i n t ff t h e value o f K = 0, t h e p o i n t will b e visible if K = I a n d a line will be d r a w n f r o m t h e p r e c e d i n g p o s i t i o n of t h e b e a m to t h e c u r r e n t l y d e f i n e d o n e if K = 2. T h e p o i n t c o - o r d i n a t e s are I n t e r p r e t e d a c c o r d i n g to t h e scales d e f i n e d by t h e last exec u t i o n of the N E W D S P r o u t i n e . T h e s e c o n d r o u t i n e available for the g e n e r a t i o n o f t h e image e l e m e n t s can display a s t n n g o f c h a r a c t e r s This r o u t i n e s h o u l d be used as follows C A L L W R T D S P (X, Y) WRITE(. FORMAT(

,

) _.

.

.

)

w h e r e X, Y are t h e c o - o r d i n a t e s o f the n e w c u r r e n t p o s i t i o n of t h e beam, u n d e r t h e same scaling c o n d i t i o n as f o r t h e DSP r o u t i n e T h e W R I T E a n d F O R M A T s t a t e m e n t s are used as d e f i n e d b y tiae F o r t r a n language w i t h t h e o n l y h m l t a t i o n t h a t t h e resulting string c a n n o t e x c e e d a l e n g t h of 72 characters By m e a n s o f the a b o v e s t a t e m e n t s e q u e n c e , a n y Inform a t i o n , n u m e r i c a l ~, literal, can be d i s p l a y e d s t a r t i n g at t h e p o s i t i o n X Y on the screen T h e logical n u m b e r in t h e W R I T E s t a t e m e n t has no m e a n i n g a n d it can b e a n y integer In general, as far as t h e DSP r o u t i n e s for t h e c o n s t r u c t i o n of t h e screen image are c o n c e r n e d , it is w o r t h n o t i n g t h a t n o p r o b l e m arises w h e n t h e i n d i c a t e d p o i n t c o - o r d i n a t e s c o r r e s p o n d to a p o s i t i o n o u t s i d e t h e physical screen area because a u t o m a t i c scissoring IS e f f e c t e d b y t h e r o u t i n e s G r a p h i c e l e m e n t s g e n e r a t e d b y t h e DSP and W R T D S P

77

routines can be collected in d i f f c r e n t sets, here called sequences, to w h i c h ldentffmrs can be assigned by t h e prog r a m m e r t o p e r m i t s u b s e q u e n t m o d i f i c a t i o n o f their display status With the s t a t e m e n t CALl. B G N S E Q ( K S ) a s e q u e n c e is m i t l a h z e d with the ldentffmr t ( S to w h i c h an integer value greater t h a n 0 can be assigned by the programmer_ The s e q u e n c e will c o m p r i s e all the graphic elem e n t s generated during the e x e c u t i o n o f the p r o g r a m until a statement (;ALL E N D S E Q is e n c o u n t e r e d B G N S E Q a n d E N D S E Q c a n b e c o n s l d e r e d as b r a c k e t s enclosing the graphic e l e m e n t g e n e r a t i n g statem e n t s No nesting is allowed, t h a t ~s, no n e w s e q u e n c e can be i n m a h z e d b e f o r e the preceding o n e is t e r m i n a t e d . Graphic e l e m e n t s g e n e r a t e d outside any s e q u e n c e are c o n s i d e r e d c o r r e l a t e d by an xdennfier 0 and thmr d~splay status c a n n o t be c h a n g e d To change the status of a s e q u e n c e two r o u t i n e s are p r o v i d e d The first, called b y the s t a t e m e n t C A L L OMTSEQ(KS) is used to blank the s e q u e n c e KS, while the s e c o n d , called by the s t a t e m e n t C A L L INCSEQ(KS)

V A L = D I S P L V ( ' V A R ' , 3) V A L = D I S P L E ( ' V A R ' , 3, K) w h e r e the first a r g u m e n t c o r r e s p o n d s to the n a m e o f t h e m t e r a c n v e variable, the s e c o n d to the n u m b e r o f characters in it and the t h i r d t o the i n d e x of the w a n t e d e l e m e n t , in this case the variable Is an array. The CDP library r o u t i n e s illustrated m the p r e s e n t section are s u f f i c i e n t to c o m p l e t e l y describe any desired image in t h e IMAGE s u b r o u t i n e that, being iteratively called, will p r o d u c e the r e q u i r e d result o f an a n i m a t e d r e p r e s e n t a t i o n o f the d y n a m i c behavxour o f the s y s t e m u n d e r s t u d y As an e x a m p l e , in the a p p e n d i x t h e c o m p l e t e CDP p r o g r a m for the mass, spring and d a m p e r s y s t e m is s h o w n .

CO/H'HANDS

The CDP m t e r a c n v e c o m m a n d s m u s t be e n t e r e d by the user t h r o u g h the a l p h a n u m e r i c k e y b o a r d of the display u n i t T h e y can be free f o r m a t keyed-in and consist o f the followmg items o p e r a t i o n code [variable [n 1 In2] ] ] t h a t m u s t be separated f r o m each o t h e r by at least one

78

R + t h e s i m u l a t i o n run ts r e s t a r t e d with t h e initial value o f TIME C u r r e n t values of the interactive variables arc used in the n e w run C + - t h e s n n u l a t m n run is r e s u m e d with t h e c u r r e n t value of TIME

IS used to u n b l a n k the sequence, that is, let it be visible In o r d e r t o be a n i m a t e d , the screen ~mage m u s t d e p e n d on t ~ m e - d e p e n d e n t variables This ~mplies the need f o r a m e a n s of f e t c h i n g t h m r value at a n y i n s t a n t during t h e simulation run. This means is p r o v i d e d by the r o u t i n e s DISPLV and DISPLE t h a t can be used, for e x a m p l e , as follows

THE CDP INTERACTIVE

blank_ ' l h c x ~ a n t e d o p c r a u o n i s m d i c a t e d l i v thc opvc,tn,~, c o d e , the variable n a m e and one or t w o of the numerical values n 1 and n 2 arc possibly r e q u i r e d d e p e n d i n g on the o p e r a t i o n T o m i n i m i z e data p r e p a r a t i o n errors, making a c o m m a n d that is n o t clearly mtelhgible to the (,DP s y s t e m will lead to no o p e r a t i o n A few c o m m a n d s require i n t e r v e n t i o n on the part ot the s y s t c m user w h o is asked to c o n f i r m the o p e r a t i o n or to cancel it by r e s p e c t w e l y pressing any o n e o f the b u t t o n s 1 to 31 or the b u t t o n II ot the IBM 2250 Display U m t pr~r g r a m m e d f u n c t i o n s k e y b o a r d Such c o m m a n d s , given it', the cxample, will be labelled with '+' O t h e r c o m m a n d s require t h e m d l c a t l o n o f a p o i n t on the screen w h e r e ~nform a n o n p e r t i n e n t to t h e relevant o p e r a t i o n will be displayed The p o i n t can be i n d i c a t e d by means of a cross-hair cursor The d i s p l a c e m e n t o f the cross-hair can be c o n t r o l l e d by the p r o g r a m m e d f u n c t i o n s k e y b o a r d as illustrated in Figure 5 Such c o m m a n d s will be labelled 'O' in the f o l l o w m g In addition, the p r o g r a m m e d f u n c t i o n s k e y b o a r d can also be used, after a restart or c o n t i n u e c o m m a n d , t o sus p e n d and resume t h e s i m u l a t i o n run, b u t t o n s 1 to 31, t~r t o r e t u r n to the c o m m a n d waiting status, b u t t o n II The f o l l o w i n g ~s a hst of the i n t e r a c n v e c o i n m a n d s avadable in the CDP basic set, t o g e t h e r with a s h o r t e x p l a n a t i o n of thmr meaning

5 + - t h e s~mulatlon sessmn ~s e n d e d N the s y s t e m is set in the PLOT m o d e o f o p e r a t i o n screen ~mage ~s erased

Th<

I the s y s t e m is set in the IMAGE m o d e o f o p e r a t i o n F o r t r a n s u b r o u t i n e IMAGE m u s t have b e e n c o d e d and added to the CSMP p r o g r a m . 9 ° variable SlS 2 - t h e variable is m a d e available for p l o t t i n g w h e n t h e s y s t e m is m PLOT m o d e . s 1 and s 2 are u s e d to d e t e r m i n e the scaling f a c t o r as illustrated for the * D I S P L A ~ statement ,/° variable t h e c u r r e n t values o f s 1 and s 2 for the variable are displayed F variable

B

the variable is u n a v a d a b l e for p l o t t i n g

all the mteractxve varmbles are unavailable f o r p l o t t i n g

a digital p l o t t e r h a r d c o p y o f the c u r r e n t screen image is p r o d u c e d .

11

P° variable [n l] the c u r r e n t value of the [ e l e m e n t with i n d e x n 1 o f the array] variable is displayed ,~1° variable n 1 [ * / 2 ] the [ e l e m e n t with i n d e x n 2 o f the arrayl variable is assigned the value n l ~,l*U*nl~/2 - the c u r r e n t screen image is erased and the reserved variables * U* and FINT1M are respectively assxgned t h e valnes n l and */2 V °° [variable] - If the s y s t e m is m PLOT m o d e and the variable is available for p l o t t i n g , t h e c o - o r d i n a t e s , r e f e r r e d to the variable scale, o f t h e first p o s m o n o f t h e cross-hair are displayed at the s e c o n d one (Figure 4) If the s y s t e m is in IMAGE m o d e , t h e variable n a m e is ignored a n d t h e dis-

COMPUTER AIDED DESIGN

An anJmauon fac,hty for c a d

p l a y e d c o - o r d i n a t e s r e f e r to t h e scale d e f i n e d In t h e I M A G E subrou tme T ° t e x t -- t h e t e x t , c o m p r i s i n g up to 70 c h a r a c t e r s ( b l a n k s included), is displayed_

graphic e l e m e n t s e q u e n c e is r e t u r n e d in KO as d e t e c t e d b y t h e light-pen I n f o r m a t i o n can be I n p u t b y i n t e r r o g a t i n g t h e a l p h a n u m e r i c k e y b o a r d w i t h the following s t a t e m e n t s CALL RDDSP

X [ a r g l [ a r g z [ a r g 3 ] ] ] - t h e D I S P L X s u b r o u t i n e is called. It m u s t have b e e n s u p p h e d b y the user t o g e t h e r w i t h t h e CSMP p r o g r a m a n d s h o u l d begin w i t h t h e s t a t e m e n t

READ(

,.

)

..

FORMAT(

_..

)

S U B R O U T I N E D1SPLX [(arg 1 [,arg 2 [,arg3] ] )] m a g r e e m e n t w i t h t h e f o r m a t d e c i d e d b y t h e p r o g r a m m e r for the c o m m a n d

w i t h t h e same c o n d i t i o n s , illustrated above, for t h e display o f c h a r a c t e r strings_ W h e n the c o n t r o l e n t e r s the R D D S P r o u t i n e , t h e e x e c u t i o n of the p r o g r a m is s t o p p e d whilst waitIng for t h e i n p u t o p e r a t i o n to be t e r m i n a t e d The statement

A D D I T I O N OF N E W C O M M A N D S

C A L L JSTK(X, Y) As i l l u s t r a t e d above, t h e CDP s y s t e m user can call t h e subr o u t i n e D I S P L X b y m e a n s o f t h e m t e r a c t w e CDP c o m m a n d X a n d D I S P L X allows the user to take c o n t r o l o f t h e display u n i t b y m e a n s o f the r o u t i n e s available in t h e CDP library_ F o u r o f t h e m are c o n t r o l t h e u n i t m t e r a c u o n sources, n a m e l y t h e p r o g r a m m e d f u n c t m n s k e y b o a r d ( r o u t i n e PUSH), the alphanumeric keyboard (routine RDDSP), the hght-pen ( r o u t i n e L P E N ) a n d t h e s o f t w a r e s i m u l a t e d cross-hair cursor (routme JSTK) The statement

allows use o f the cross-hair cursor (Figure 5) a n d r e t u r n s t h e X Y c o - o r d i n a t e s of t h e r e q u i r e d p o i n t o n the screen, referring to t h e scale d e f i n e d b y t h e last e x e c u u o n o f t h e NEWDSP routine T h e CDP library p e r m i t s the p r o g r a m m e r t o e x t e n d the basic set o f CDP l n t e r a c u v e c o m m a n d s b y the a d d i t i o n of n e w ones, c o n v e n i e n t for h a n d l i n g t h e p r o b l e m being studied_ As an e x a m p l e , the f o l l o w i n g coding of t h e s u b r o u t i n e DISPLX, S U B R O U T I N E D I S P L X ( O P , A 1, ,42) D A T A T B L O P / ' O P I ' , 'OP2'/ D I M E N S I O N T B L O P (2) DOlE=l, 2 IF(UP EQ TBLOP(K))GOTO2

C A L L PUSH(K, KO) is used to call t h e P U S H r o u t i n e a n d the a r g u m e n t K is assigned t h e value 1 or 2 by t h e p r o g r a m m e r while t h e value o f t h e a r g u m e n t K O is r e t u r n e d b y t h e r o u t i n e Since t h e p u s h - b u t t o n s o p e r a t i o n s are q u e u e d , t h e integer variable K can be used to s t a t e t h a t t h e p r o g r a m , In t h e case o f an e m p t y queue, has t o walt for a b u t t o n o p e r a t i o n (K = 2) or n o t (K = 1) T h e value assigned b y t h e r o u t i n e to t h e integer variable K O is 0 f o r an e m p t y queue, 1 for button 0 and n for button n > 0 The statement

/ •"

I

I I I I

C A L L LPEN(K, K O )

1 1

has the s a m e m e a n i n g as t h e p r e c e d i n g one, e x c e p t t h a t t h e value assigned b y the p r o g r a m m e r t o t h e i d e n t i f i e r o f t h e

I 1

J\

\



.

_.

0

F I G U R E 4 A n example o f a P L O T m o d e zmage f o r the s y s t e m s h o w n zn Fzgure 1

Volume 7

Number 2

April 1975

Step/2 FIGURE 5

/

@

O

Stepx2

-

@

"-_' (!)

Tbe cross-hazr cursor operatzon

79

1 (]ONTINUb RETURN 2 GO TO (3, 4), K 3

parai]]cters l h e CDP systcin can bc used Xli extinct i'LkJ 1 m o d e or m o r e e o n v c n l c n t h , in IM:\GI, m~dc to dlspla~ l n [ o r n l a t l o n Ill a m o r e concise fornl In t, igure 6, a m o w n g surface IS sho~vn x~hich r e p r e s e n t s the tlmv b e h a v i o u r o f t e m p e r a t u r e d i s t r i b u t i o n In a nuclear r e a c t o r fuel e l e m e n t during a thermal t r a n s i e n t g e n e r a t e d by a c o o l a n t loss a c c i d e n t 4

RETURN

RETURN END

Orzented

programs

A n o t h e r kind o f CDP a p p l i c a t i o n is t o s l m p h f y t h e definition o f d y n a m i c systems belonging to a specml class_ In this case, CDP can be u s e d as a s u p p o r t for an o r i e n t e d interactive graphic p r o g r a m with an e x t e n d e d c o m m a n d set and f i x e d coding of the CSMP program_ The user of the interactive p r o g r a m can even ignore t h e e x i s t e n c e of t h e CSMP p r o g r a m and t h e s t r u c t u r e o f t h e c o r r e s p o n d i n g differential e q u a n o n system_ As an e x a m p l e , CDP has b e e n used as a basis f o r an Interactive program, ECOLO s, for the s t u d y of e c o s y s t e m s d y n a m i c s . In this application, the CSMP program is fixed and capable o f h a n d l i n g up to 20 d i f f e r e n t ecological species with up to 80 relations a m o n g t h e m Since the d y n a m i c s o f an e c o s y s t e m can be d e s c n b e d by reactions quite similar t o t h a t o f chemical kinetics 6, t h e ECOLO p r o g r a m can also be used to s t u d y the time b e h a v t o u r o f chemical reactions Nine .\ s u b - c o m m a n d s have been a d d e d to the CDP basic set, solne o f t h e m p e r m i t t i n g t h e d e f i n i t i o n and inodl f i c a t t o n o f the species, o f the reactions describing the strtt~ ture of the e c o s y s t e m and o f t h e related initial values and velocity constants_ The remaining s u b - c o m m a n d s c o n t r o l

can be used to add the n e w c o m m a n d s

X OP1 In I [iv/2] ] X OP2 In 1 In2] ] w h e r e the p r e s e n c e or absence o f n I and n 2 d e p e n d s o n w h e t h e r or n o t t h e variables A1 and A 2 are used in the c o r r e s p o n d i n g s e g m e n t o f t h e s u b r o u t i n e D I S P L X Comm u n i c a t i o n b e t w e e n the CSMP program, the IMAGE subr o u t i n e and D I S P L X s u b r o u t i n e can be easily established by labelled COMMON areas.

E X A M P L E S O F CDP A P P L I C A T I O N S A mma ted representatwn computatzon results

tntenwtzve

of

A typical use o f t h e CDP s y s t e m is the interactive slmulan o n o f s y s t e m s to d e t e r m i n e t h e best value for u n k n o w n

%

:~.f

7,(-

.2~. ¸

~

",,

a

F I G U R E 6 (a c) lost acczdent

80

b

o

e

The t e m p e r a t u r e dtstrlbutzon tn a nuclear ~eactor f u e l elemeJ~t durlng a t h e r m a l tran~wnt ,tollow~ng ~ ool,;nt

COMPUq

|, R A I I ) t , I )

1)1 ~ ' M ( , N

An ammat~on fac~hty for c a d

_

I-:-

_-~57L

/\ °ia¢

g

v2'&'':"

~

~.,ae~{

o,

a

b

FIGURE 7 (a) (c)

The simulation o] an ecosystem

the display o f the species and reactions lists and the slmul i t t o n results Figure 7 shows the species and reactions for an e c o s y s t e m comprising grass (GRS) generated by roots (RTS) and a rabbits population, any rabbit being either starved (SRB) or fed ( F R B )

Mechamcal hnkage design Most i m p o r t a n t for a c_a.d e n w r o n m e n t is the class of CDP applications that uses the graphic information i n p u t capabthty of the CDP library routines By giving online graphic information, the g e o m e t r y of the system being studmd can be too&fled. The CDP system has been used to support an interacuve program, LKG 7, for the study of planar mechanical linkages The g e o m e t r y of the linkage is described in the CSMP program and the geometrical parameters can be interactive[y modified_ It is possible, on o n h n e request, to visualize the real m o t i o n of the linkage or to display the loci generated by selected linkage nodes In LKG the subroutines IMAGE and D1SPLX have been coded as a t w o e n t r y points subroutine which implements eight new c o m m a n d s In the following list, the initial co-ordinates for the linkage nodes are indicated by XO, YO, while the corresponding t i m e d e p e n d e n t co-ordinates are Indicated by X, }

FIGURE 8 Loc~ f o r two nodes o f a five-bar linkage

X ,4 -- the program is set in animation m o d e L ° - - the program is set in loci plotting m o d e and informed that the locus generated by the node nearest to the cross-hair p o s m o n can be plotted

X

In Figure 8 there Js shown the screen mlage, in loci plotting mode, for a five-bar linkage, while m Figure 9 a sequence of images during the animated simulation of a typical hftmg linkage s'9 is shown

X

F ° l l 1 -- the screen linkage representation is displayed and/or enlarged or reduced with a z o o m i n g factor, ~*1

\" S - a hnkage representation according to the initial coordinates XO, YO is displayed X T the rime d e p e n d e n t (X, Y) representation is displayed

X pOO

the current co-ordinates of the linkage node that is the nearest to the first cross-hair position are displayed, with a pointing arrow indicating the node.

X R ° n I *~2 the initial c o n & n o n linkage representation is displayed and n l , n 2 are assigned to XO, YO for the node nearest to the cross-hair cursor p o s m o n . X 'U °° - the Initial c o n d m o n linkage representation IS displayed and the node nearest to the first position of the crosshair cursor is m o v e d to the second one with a corresponding modification of XO, YO for the node

Volume7

Number2

April 1975

Statw apphcatzons The CDP system lends ~tself to realize oriented static graphics systems, because of the general purpose capabilities of the CDP library routines In a d d m o n , the dynatom capability of the CSMP language could be used to let a continuous v i t i a t i o n of the value of parameters be effected during the object design For example in the case of the design of s m o o t h surfaces, either defined polntwlse I° or analytically ~l, the possibility of continuous variation of meaningful parameters can lead to a faster object design

SUMII.tRY A description is given of an Interactive graphic version, of the continuous systems s~mulatlon language using the

81

t) b

a

F I G U R E 9 (a)

(c)

C

Tbe s z m u l a n o n o f the m o t m n o f a car-hood h f t m g m echan ~stn 4

IBM 2 2 5 0 T h e g r a p h i c s l e n d s i t s e l f t o be u s e d as a g e n e r a l purpose support for ammatlon systems. The graphic outp u t is d e f i n e d b y t h e u s e r b y a s e t o f g r a p h i c r o u t m e s a n d t h e s y s t e m o p e r a t i o n is c o n t r o l l e d b y m e a n s o f a basic set of mteracuve commands T h i s s e t c a n be e x t e n d e d b y t h e u s e r m o r d e r to r e a h z e s p e c m l p u r p o s e a m m a t l o n s y s t e m s C a p a b i l i t i e s o f t h e g r a p h i c s v e r s i o n are r e v i e w e d b r i e f l y and a few examples of appheatlon are given

5

6

7

REFERENCES 1

2_

3

8

Rlcci, A and Teohs, A , 'CDP a CSMP extension for animated dynamic analysis', Proceedings of the SEAS (SHARE European Associauon) 72 Meeting, Gothenburg, ( 2 5 - 2 9 September 1972) Rlccl, A and Teohs, A , 'CDP - slmulatore graflco mterattivo per l'anahsl dmamlca d, sistemi c o n t i n m Manuale d'uso', CNEN RT/EDP(73)5, 1973 Rlcci, A_, 'DSP - a package for mteracnve c o m p u t e r graphics', Proceedings of the SEAS (SHARE European Association) XVI meeting, Pisa, (27 September 1 October 1971) (also CNEN RT/FIMA(72)4, 1972)

9

10

11

A P P E N D I X CDP p r o g r a m f o r the mass, spring a n d d a m p e r s h o w n zn Figure l PARAM M = 100., K = 10000 , D = 100. INCONHO=0, VO = 0 . * D I S P L A Y H 0 25 * D I S P L A Y HP *DISPLAY M *DISPLAY K *DISPLAY D *DISPLAY HO * D I S P L A Y VO DYNAMIC t t = I N T G R L ( H O , liP) liP = INTGRL(VO, ( K * H + D*HP)/.~I) TIMER DELT = 0.01, DELMIN = 0 00001, PRDELN F I N T I M = 10 P R I N T H, ltP, ~, K, D, flO, V O END STOP SUBROUTINE IMAGE CALL NEWDSP (0,-4., 15., 11 ) X = D I S P L V ( ' H ' , 1) C A L L D S P ( 3 , 1 0 . 1 , O) C A L L D S P ( 1 2 . , 1 0 . 1 , 2) C A L L D S P ( 5 , 8_, 0) C A L L D S P (5., 1 0 . 1 , 2) C A L L D S P (10_, 10_1, O) C A L L D S P (10_, 6 , 2 )

82

= 1,

Morlcl, A , Prmc~pe, D_, bantarossa, G , 'ARIEL ~odlce per L'anallsi termica di un elemento dl combustible', CNEN RT/PROT(73)28, 1973 Dal Bono, I , Farnedi, S , Rlcci, A , ECOLO un apphca :louc graflca lntcrattwa per l'anahsi dlnamlca tit sLsteml ecologacl', CNEN RT/EDP(73)6, 1973 Garfinkel, D, "qunulatlon of ecological systems' in ¢'omputer~ in Hzomedlcal Research, pp 205 211, Academic Press 1 ondor (1965) Dal Bono, I , and Rtccl, A , 'An interactive c o m p u t e r graphics m e t h o d for the study of the m o t i o n of mechanical linkages' Proceedings of the 1973 S u m m e r Computer Slmulauon Conference, Montreal, 17 19 July 1973 (alsoCNEN RT/EDP(73)2, 1973 Chace, M A_ and Korybalski, M E , ' C o m p u t e r graphlLs m the dynamic analysis of mechanical networks' in Advanced Computer GrapMcs, Plenum Press, London, ( 1971 Chace, M A and Sheth, P N 'Adaptation of c o m p u t e r techtuques to the design of mechanical dynamic machinery' Presented at the Americ Soc Mech Eng conference entitled Design Engineering Techmcal Conference, Cinc|nnat~, O h m 9 t h - 1 2 t h September 1973

Curved Surface~ in bngmeemng Computer Methods/or [)es~gn and Manufacture, Cambridge, 15 17 March 1972, IPC Science and TeLhnology Press Ltd, Gufldford, (1972) Rlccl, A , 'A constructwe geometry for c o m p u t e r graphics', Comput J, Vol 16, No 2, pp 157- 160 (1973) ( : A L L D S P ( 9 . 8 , 6., O) C A L L D S P ( 1 0 . 2 , 6 , 2) C A L L D S P (9 6, 8 + X , 0) C A L L D S P (9 6, 4 + N , 2) C A L l . D S P (10_4, 4 + . \ , 2) C A L L D S P ( 1 0 4, 8 + X , 2) CALLDSP(10,4 + X , 0) CALLDSP(10,2 + X , 2) CALI~DSP(5, 2 + X , 2) CALLDSP(5,4 + Y, 2) C A L L D S P ( 7 5, 2 + \ ' , 0 ) C A L L D S P (7 5, 1.5 + X, 2) C A L L D S P (6 5, 1.5 + Y, 2) C A L L D S P (6-, X, 2) C A L l . DSP (9 , X, 2) C A L L D S P (8 5, 1_5 + X, 2) C A L L D S P (7 5, 1 5 + X, 2) CALL DSP(5,4 +.k,O) A1) = (4 \)/7

B - 4 + \" + t l ) / 2 C= 5 DOIJ=I, C= C

7

C A L L D S P ( 5 + C , B, 2) B = B +AD C A L L D S P ( 5 , 8 , 2) RETURN END END JOB

COMPUTER AIDED DESIGN