文档库 最新最全的文档下载
当前位置:文档库 › ZonotopeHyperplane Intersection for Hybrid Systems Reachability Analysis

ZonotopeHyperplane Intersection for Hybrid Systems Reachability Analysis

ZonotopeHyperplane Intersection for Hybrid Systems Reachability Analysis
ZonotopeHyperplane Intersection for Hybrid Systems Reachability Analysis

Zonotope/Hyperplane Intersection for Hybrid Systems Reachability Analysis

Antoine Girard1and Colas Le Guernic2

1Laboratoire Jean Kuntzmann,Universit′e Joseph Fourier

Antoine.Girard@imag.fr,

2VERIMAG,Universit′e Joseph Fourier

Colas.Le-Guernic@imag.fr

Abstract.In this paper,we are concerned with the problem of comput-

ing the reachable sets of hybrid systems with(possibly high dimensional)

linear continuous dynamics and guards de?ned by switching hyperplanes.

For the reachability analysis of the continuous dynamics,we use an e?-

cient approximation algorithm based on zonotopes.In order to use this

technique for the analysis of hybrid systems,we must also deal with

the discrete transitions in a satisfactory(i.e.scalable and accurate)way.

For that purpose,we need to approximate the intersection of the con-

tinuous reachable sets with the guards enabling the discrete transitions.

The main contribution of this paper is a novel algorithm for comput-

ing e?ciently a tight over-approximation of the intersection of(possibly

high-order)zonotopes with a hyperplane.We show the accuracy and the

scalability of our approach by considering two examples of reachability

analysis of hybrid systems.

1Introduction

Reachability analysis has been a major research issue in hybrid systems over the past decade[1–9].This research has been motivated by the fact that a successful reachability analysis makes it possible to extend approaches,initially developed in the?eld of computer science for discrete systems,for analysis and control of hybrid systems[10–13].This work resulted in several methods for computing approximations of the reachable sets using,for instance,polytopes[2,3],ellip-soids[4,9]or level sets[5].The next step was to improve the scalability of these approaches in order to be able to handle larger hybrid systems.Various scalable approaches have been proposed for the reachability analysis of continuous(essen-tially linear)systems based on classes of polytopes such as hyper-rectangles[6] and zonotopes[7,8],or on ellipsoids[9].However,in order to use these tech-niques for the analysis of hybrid systems,we must also deal with the discrete transitions in a satisfactory(i.e.scalable and accurate)way.For that purpose, we need to approximate the intersection of the continuous reachable sets with the guards enabling the discrete transitions.

In this paper,we present a new technique for reachability analysis of hybrid systems with(possibly high dimensional)linear continuous dynamics and guards

de?ned by switching hyperplanes.The reachable set is approximated using zono-topes.The reachability analysis of the continuous dynamics is processed using the algorithm presented in[8].We handle discrete transitions of the hybrid sys-tems by proposing two new algorithms for computing tight over-approximations of the intersection of a zonotope with a hyperplane.The paper is organized as follows.In section2,we present brie?y the algorithm for reachability analysis of linear systems proposed in[8]and discuss the needs for its extension to hy-brid systems reachability.Section3is the main contribution of the paper,we ?rst show that the problem of computing a tight over-approximation of the in-tersection of a zonotope with a hyperplane can be reduced to the problem of computing the intersection of a two dimensional zonotope with a line.Then,we present two e?cient algorithms that solve this problem.In section4,we show the accuracy and the scalability of our approach by considering two examples of reachability analysis of hybrid systems.

2Reachability of hybrid systems

We de?ne informally the class of hybrid systems we consider.The system has several discrete modes;in each mode q,the continuous dynamics of the system is given by a linear di?erential equation of the form:

˙x(t)=A q x(t)+B q u(t),u(t)∈U q,

where x(t)∈R d is the continuous state and u(t)∈R p is the continuous input of the system.The system switches from a mode q to mode q′when the continuous state reaches a guard G e?R d where e=(q,q′).We shall assume that the guards are given by switching planes:

G e={x∈R d:x·n e=γe}where n e∈R d andγe∈R.

For simplicity we assume that the reset maps are the identity map,and that there are no Zeno behaviours.In the following,we discuss the over-approximation of the reachable set of the hybrid system by the union of zonotopes.

2.1Zonotopes

A zonotope is a polytope which can be de?ned as the Minkowski sum of a?nite set of segments.Equivalently it can be seen as the image of a cube by an a?ne transformation.Formally,a zonotope is a subset of R d represented by a center c∈R d and a list of generators g1,...,g r∈R d:

Z= c;g1,...,g r = c+r i=1αi g i:?i,?1≤αi≤1 .

Each zonotope is a centrally-symmetric convex polytope.Hyper-rectangles and parallelotopes are zonotopes with d generators.The class of zonotopes is closed

under arbitrary linear transformations and under the Minkowski sum.The image of a zonotope Z= c;g1,...,g r under a linear transformationΦis the zonotope

ΦZ= Φc;Φg1,...,Φg r .

The Minkowski sum of two zonotopes Z= c;g1,...,g r and Z′= c′;g′1,...,g′r′ is the zonotope

Z⊕Z′= c+c′;g1,...,g r,g′1,...,g′r′ .

Further,it is to be noted that these two operations can be implemented e?-ciently even in high dimension.This makes the class of zonotopes suitable for reachability analysis.

2.2Continuous reachability

We?rst explain how we handle the continuous dynamics of the hybrid systems. In the following,the results on reachability analysis of linear systems are very brie?y described.Details on our approach can be found in[7,8].Let us consider a linear system of the form:

˙x(t)=Ax(t)+Bu(t),x(0)∈I,u(t)∈U.

We want to over-approximate the set of states that are reachable by the linear system within a time interval[0;T]for some initial state in I and admissible input function u:[0;T]→U.We assume that the sets I and U are given by zonotopes.We choose an integration stepτ=T/(N+1)and compute a sequence of zonotopes?0,...,?N such that?i contains all the states reachable within the time interval[iτ,(i+1)τ].We do not detail how the?rst zonotope of the sequence,?0,is computed(see[7]).Then,the other elements of the sequence can be computed from a recurrence relation of the form:

?i+1=Φ?i⊕V,i=0,...,N?1(1) where the matrixΦ=eτA and V is a zonotope that depends onτ,A,B and U(see again[7]).Algorithm1is taken from[8]and implements e?ciently the computation of the zonotopes?1,...,?N.The time and memory complexities of Algorithm1are O(Nd3)and O(Nd2)respectively.

2.3Hybrid reachability

We now discuss the use of Algorithm1for reachability analysis of a hybrid system.Again,we keep the discussion informal;our algorithm is similar to the algorithms for reachability analysis of hybrid systems using polytopes[11,2].Let us assume that the initial discrete mode is q and that the set of initial continuous states is I q.We start by computing an over-approximation of the reachable set by the continuous dynamics associated with mode q using Algorithm1;we stop after a zonotope?i has completely crossed a switching plane G e with e=(q,q′)

Algorithm1Reachability of linear time-invariant systems.

Input:The matrixΦ,the sets?0and U,a positive integer N.

Output:The?rst N terms of the sequence de?ned in equation(1).

1:X0←?0

2:V0←U

3:S0←{0}

4:for i from0to N?1do

5:X i+1←ΦX i?X i+1=Φi+1?0 6:S i+1←S i⊕V i?S i+1=Φi U⊕···⊕U 7:V i+1←ΦV i?V i+1=Φi+1U 8:?i+1←X i+1⊕S i+1??i+1=Φi+1?0⊕Φi U⊕···⊕U 9:end for

10:return{?1,...,?N}

or after a speci?ed number of steps is reached.Then,for all transition e of the form e=(q,q′)we need to compute a zonotope I q′which over-approximates the intersection of the reachable set with the hyperplane G e:

(?0∪···∪?N)∩G e?I q′.

Then,we start over with the discrete mode q′and the set of initial continuous states I q′.Hence,we can see that the computation of a good over-approximation of the intersection of a zonotope with a hyperplane is required in order to extend Algorithm1for reachability analysis of a hybrid system.

3Intersection of a zonotope and a hyperplane

It is known that detecting the intersection between a zonotope and a hyperplane is an easy problem[7].Given a zonotope Z= c;g1,...,g r and a hyperplane G={x∈R d:x·n=γ},we have

Z∩G=???c·n?

r

i=1|g i·n|≤γ≤c·n+r i=1|g i·n|.

Furthermore,in the context of reachability analysis,this can be done e?ciently while computing the reachable sets[8].However,computing this intersection (when it is not empty)is actually a much more complicated problem.

This intersection might not be a zonotope,thus a larger class of sets needs to be considered for this computation.Obviously,we can express the zonotope Z as a polytope,and then compute the intersection between the polytope and the hyperplane G.The good news is that computing a H-representation[14]of a zonotope can be done polynomially in the number of its facets[15],the bad news is that a zonotope with r generators in dimension d might have up to 2 r d?1 facets[16].Even for relatively small zonotopes,this can be prohibitively large.Further,the zonotope?k computed by Algorithm1typically has about

kd generators.Thus,it is clear that this approach is untractable.Another ap-proach is to over-approximate the zonotope before computing the intersection. However,even if the over-approximation of the zonotope is tight(i.e.the over-approximation touches the zonotope in several points),the over-approximation of the intersection is generally not.We propose a third approach which allows to compute a tight over-approximation of the intersection of a zonotope and a hyperplane.Most of the operations are done in two dimensional spaces,thus leading to e?cient computations.

3.1From dimension d to dimension2

Finding a tight polyhedral over-approximation P of a set X can be done by bounding this set using several hyperplanes with normal vectors in a given?nite set D={?1,...,?p}.The computation involves determining,for each?∈D, the in?mum m?and supremum M?of the sets{x·?:x∈X}.Then,the over-approximation P is given by

P={x∈R d:??∈D,m?≤x·?≤M?}.

In our case3,X is the intersection of the zonotope Z and the hyperplane G.For the reasons we already explained,we can not expect to solve this problem in the full dimensional state-space R d.The following proposition will allow us to reduce this problem to a two-dimensional problem.

Proposition1.Let G be a hyperplane,G={x∈R d:x·n=γ},Z a set,and ?a vector.LetΠn,?be the following linear transformation:

Πn,?:R d→R2

x→(x·n,x·?)

Then,we have the following equality

{x·?:x∈Z∩G}={y:(γ,y)∈Πn,?(Z)}

Proof.Let y belongs to{x·?:x∈Z∩G},then there exists x in Z∩G such that x·?=y.Since x∈G,we have x·n=γ.Therefore(γ,y)=Πn,?(x)∈Πn,?(Z) because x∈Z.Thus,y∈{y:(γ,y)∈Πn,?(Z)}.Conversely,if y∈{y:(γ,y)∈Πn,?(Z)},then(γ,y)∈Πn,?(Z).It follows that there exists x∈Z such that x·n=γand x·?=y.Since x·n=γ,it follows that x∈G.Thus,y=x·?with x∈Z∩G and it follows that y∈{x·?:x∈Z∩G}.

This proposition states that we can reduce the problem of computing a tight polyhedral over-approximation of the intersection of a set Z and a hyperplane G to the problem of projecting Z on a plane and then computing the intersection of the2-dimensional setΠn,?(Z)and the line Lγ={(x,y)∈R2:x=γ}.This must be done for each vector?∈D.Algorithm2implements this idea.

3The results presented in section3.1hold for an arbitrary set Z(not only a zonotope).

Algorithm2Dimension reduction

Input:A set Z,a hyperplane G={x∈R d:x·n=γ}and a?nite set D of directions. Output:A polytope approximating tightly Z∩G in directions given by D.

1:for?in D do

2:Sπn,?←Πn,?(Z)

3:[m?;M?]←BOUND INTERSECT2D(Sπn,?,Lγ)

4:end for

5:return{x∈R d:??∈D,m?≤x·?≤M?}

In our case,the set Z is a zonotope,then the projectionΠn,?(Z)is a two-dimensional zonotope which can be computed e?ciently:

Πn,?( c;g1,...,g r )= Πn,?(c);Πn,?(g1),...,Πn,?(g r) .

Remark1.For each generator g of the zonotope Z,one has to computeΠn,?(g) for all?in D,but instead of computing these projections independently,which would lead to2|D|scalar products,one can observe that all theΠn,?(g)involves computing the scalar product n·g,thus only|D|+1scalar products are necessary for each generator of Z.The projections can thus be done by computing the product of a(|D|+1)×d matrix by a d×(r+1)matrix.

The computation of the intersection ofΠn,?(Z)and the line Lγis investigated in the next subsection where two algorithms are proposed to solve this problem.

3.2Intersection of a zonogon and a line

Algorithm2requires the computation of the intersection of a two dimensional zonotope,with a line.In a two dimensional space,a zonotope is called a zono-gon and its number of vertices,as its number of edges,is two times its num-ber of generators.Thus,it is possible to express a zonogon as a polygon(two dimensional polytope)which can easily be intersected with a line.For the sim-plicity of the notations,we now denote by Z= c;g1,...,g r the zonogon that we want to intersect with Lγ={(x,y):x=γ}.An extremely naive way of determining the list of vertices of a zonogon is to generate the list of points {c+ r i=1αi g i:?i,αi=?1orαi=1}and then to take the convex hull of this set.This is clearly not a good approach since we need to compute a list of2r points.

Scanning the vertices.It is known that the facets of a zonotope c;g1,...,g r are zonotopes whose generators are taken from the list{g1,...,g r}.Then,we can deduce that the edges of a zonogon are segments of the form[P;P+2g]where P is a vertex of the zonogon and g a generator.Therefore,it is su?cient to scan the generators in trigonometric(or anti-trigonometric)order to scan the vertices of the zonogon in a way that is similar to the gift wrapping algorithm[17].This idea is implemented in Algorithm3.

Algorithm3BOUND INTERSECT2D

Input:A zonogon Z= c;g1,...,g r and a line Lγ={(x,y):x=γ}

Output:A segment[m;M]such that{γ}×[m;M]=Z∩Lγ.

1:P←c?current position 2:m←∞,M←?∞

3:for i from1to r do

4:if y g

i <0or(y g

i

=0and x g

i

<0)then?g i=(x g

i

,y g

i

)

5:g i←?g i?Ensure all generators are pointing upward 6:end if

7:P←P?g i?Drives P toward the lowest vertex of Z 8:end for

9:g i

1,...,g i

r

←SORT(g1,...,g r)?Sort the generators in trigonometric order

10:for j from1to r do

11:if[P;P+2g i

j ]intersects Lγthen

12:(x,y)←[P;P+2g i

j ]∩Lγ

13:m←min(m,y)

14:M←max(M,y)

15:end if

16:P←P+2g i

j

17:end for?Only half of the vertices of the zonogon have been scanned 18:for j from1to r do

19:if[P;P?2g i

j ]intersects Lγthen

20:(x,y)←[P;P?2g i

j ]∩Lγ

21:m←min(m,y)

22:M←max(M,y)

23:end if

24:P←P?2g i

j

25:end for?we are back in P=e 26:return[m;M]

All the generators are taken poiting upward for simplicity,this does not change the zonogon since replacing a generator g by it opposite?g does not modify the shape of a zonogon.Then,we compute the lowest vertex of Z,and sort the generators according to the trigonometric order.Scanning the generators in that order allows us to scan the vertices of Z.While scanning these vertices, we check for the intersection with the line Lγ.This leads to an algorithm for the intersection between a line and a zonogon with r generators whose complexity is O(r log r).The most time consuming part is to sort the generators.

In practice,the number of generators r can be very large(remember that the zonogon we want to intersect comes from the reachable set?k computed by algorithm1;?k has about kd generators).Further,each time a discrete transition occurs,this procedure is called several times by algorithm2(one call for each direction of approximation).Thus,we need it to be as fast as possible.Hence, instead of scanning all the vertices of Z,we look directly for the two edges that intersect the line Lγwith a dichotomic search.

Dichotomic search of the intersecting edges.We start again from the low-est vertex of Z.At each step of the algorithm,P is a vertex of the zonogon repre-

senting the current position and G is a set of generators.We know that the seg-

ment[P;P+ g∈G2g]intersects the line Lγ.We choose a pivot vector s and split the generators in G into two sets G,the set of generators respectively

smaller and bigger(according to the trigonometric order)than s.Then,it is clear

that Lγintersects either[P;P+ g∈G<2g]or[P+ g∈G<2g;P+ g∈G2g]. We continue either with P and G.When the lowest vertex of the intersection is found,we start again from the highest vertex of Z in order to?nd the highest vertex of the intersection.Algorithm4implements this approach.Figure1illustrates the execution of the algorithm,both from the lowest and the highest point at the same time.

Algorithm4BOUND INTERSECT2D

Input:A zonogon Z= c;g1,...,g r and a line Lγ={(x,y):x=γ}

Output:A segment[m;M]such that{γ}×[m;M]=Z∩Lγ.

1:P←c?current position P=(x P,y P) 2:m←∞,M←?∞

3:for i from1to r do

4:if y g

i <0or(y g

i

=0and x g

i

<0)then?g i=(x g

i

,y g

i

)

5:g i←?g i?Ensure all generators are pointing upward 6:end if

7:P←P?g i?Drives P toward the lowest vertex of Z 8:end for

9:if x p<γthen

10:G←{g1,...,g r}∩(R+×R)?We should look right 11:else

12:G←{g1,...,g r}∩(R?×R)?or left 13:end if

14:s←P g∈G2g

15:while|G|>1do

16:(G1,G2)←SPLIT PIVOT(G,s)

17:s1←P g∈G12g

18:if[P;P+s1]intersects Lγthen

19:G←G1

20:s←s1

21:else

22:G←G2

23:s←s?s1

24:P←P+s1

25:end if

26:end while?Only one generator remains 27:(x,y)←[P;P+s]∩Lγ

28:m←y

29:...?Same thing for M,starting from the upper vertex of Z 30:return[m;M]

Fig.1.Dichotomic search of the intersecting edges.

With a good pivot selection algorithm[18],the dichotomic search has a linear

complexity.For our problem,we choose the sum of the remaining generators as

the pivot.Even though this leads to a quadratic theoretical worst case complex-

ity,it improves the practical behavior.Indeed,the sum of the remaining genera-

tors is already available and it has a nice geometric interpretation,as illustrated

in Figure2.At each step,P and P+ g∈G2g are both the closest computed vertex to the line{(x,y):x=γ},each on a di?erent side of this line,thus de?n-

ing the best computed under-approximation of the interval[m;M]at this step.

A pivot s de?nes a vertex Q=P+ g∈G<2g between P and P+ g∈G2g.The line of direction s going through Q is“tangent”to Z and its intersection with Lγde?nes an over-approximation of the interval[m;M].Choosing s= g∈G g as the pivot ensures that the distance between the over-approximation and the under-approximation of the interval[m;M]is not correlated withγ,the position of the intersecting line.

Fig.2.A good choice for the pivot allows a smart enclosure of the intersection point.

Remark2.Algorithm4is similar to Bamas and Zemel’s algorithm for the frac-tional Knapsack problem[19].Eppstein4suggested in a talk[20]that one could 4The authors wish to thank an anonymous reviewer for pointing out this reference.

maximize a linear function on the intersection of a zonotope and a hyperplane by adapting the greedy algorithm for the fractional Knapsack problem.This is actually what algorithm3does.

3.3Intersection of the reachable set and a guard

Now that we know how to intersect a zonogon with a line,we can approximate the intersection of a zonotope with a hyperplane,using Algorithm2.In the context of reachability analysis,the intersection between the reachable sets?0,...,?N with a guard G generally occurs at several steps.Let I G be the set of indices i for which?i intersects the guard G.One can approximate the intersection between each?i and G independently,and then compute the union of these intersections in order to get an approximation of the intersection of the reachable set with the guard https://www.wendangku.net/doc/0f14244233.html,ing this approach,we do not exploit the fact that the reachable sets?i have a special structure.They actually share a lot of generators.Let us assume that I G is a set of k+1consecutive integers i,i+1,...,i+k.With the notations of Algorithm1,the zonotopes intersecting the guards are:

?i=X i⊕S i,

?i+1=X i+1⊕V i+1⊕S i,

..

.

?i+k=X i+k⊕V i+k⊕...⊕V i+1⊕S i

They all share the generators in S i.Actually each zonotope?j shares all its gen-erators but the ones in X j with the zonotopes of greater index.Consequently, when approximating the intersection at step j in I G,it is possible to reuse most of the computations already done for smaller indices.Not only the projections of most of the generators of?j have already been computed,but they are also partially sorted.Moreover,at each step of Algorithm4,one can easily compute an under-approximation and an over-approximation of the intersection,as ex-plained at the end of the previous subsection and on Figure2.It is then possible to modify Algorithm4in order to compute all the intersection concurrently.

Since we are interested in(∪i∈I

G ?i)∩G and not in each?i∩G,we can,at each

step,drop the computation of the?i∩G whose over-approximation is included in the under-approximation of(∪i∈I

G

?i)∩G.

3.4From Polytopes to Zonotopes

Let us remark that the tight over-approximation of the intersection between the reachable set and the guard G which is computed using Algorithm2is a polytope. In order to process the continuous reachability analysis using Algorithm1in the next discrete mode,we need this over-approximation to be expressed as a zonotope.To the best of the authors knowledge,there is no known e?cient algorithm for the approximation of a general polytope by a zonotope(except in small dimension[21]).In Algorithm2,we have the choice of the normal vectors

to the facets of the approximating polytope.Then,we can choose these vectors such that the resulting polytope can be easily approximated by a zonotope.Even better,we can choose these vectors such that the approximating polytope is a zonotope.Indeed,some polytopes are easily expressed as zonotopes;this is the case for the class of parallelotopes and particularly for hyper-rectangles.Hence, we choose the normal vectors to the facets such that the over-approximation of the intersection of the reachable set with the the guard is a hyper-rectangle.

Initially,we do not have much information on the intersection,so we generate at random(in a way similar to[22])a set of directions,and only keep the direction ?0that induces the thinner approximation.Then,we randomly generate a set of directions orthogonal to the directions already chosen,and again we only keep the one for which M??m?is minimal,until we get a hyper-rectangle,after d?2 steps.

4Examples

The algorithms presented in this paper have been implemented in Ocaml[23]. In this section,we show the e?ectiveness of our approach on some examples.All computations were performed on a Pentium IV3.2GHz with1GB RAM.

4.15-dimensional benchmark

To evaluate the error introduced by our method,and its usability in a hybrid reachability toolchain,we would like to compare the computed reachable set with the exact one.As explained before,the computation of the exact intersec-tion is untractable.This is why we arti?cially add a switching hyperplane to a continuous linear system.This guard will allow a transition between two states with the same dynamic(see?gure3).

Fig.3.A(not so)hybrid system on which approximate reachable sets can be compared to the exact reachable sets(computed with a non-hybrid view of the system).

The exact(up to initial time discretization errors)reachability analysis of this hybrid system can be done with algorithm1,by removing the guard.This analysis can then be compared to the one done using our algorithm for approx-imating the intersection with the guard on the hybrid view of the system.We applied our methods on such a hybrid system contructed on a?ve dimensional linear system[7,8].The projection on the?rst two variables of the computed reachables sets can be seen on?gure4.

Fig.4.Error introduced by approximating the intersection(in red).

The exact reachable set,computed by algorithm1on the non-hybrid sys-tem,has been plotted in black.After the intersection the error introduced by the approximation appears in red.The directions of approximation were cho-sen as explained in section3.4,16at each step.We only kept4out of the 49computed constraints on the intersection,in order to be able to express it as a zonotope.This?rst approximation was improved by adding4generators, introducing8new facets.The whole computation,including intersection and reachability,took0.2seconds and1.4MB.If we try to compute exactly the intersection,by expressing the intersecting zonotopes as polytopes,we have to deal with more than1011vertices.Only storing these vertices would require more than1.8terabyte,more than one million times what we need for approximate intersection and reachability.

4.2Thermostat

As a second example,we consider a high dimensional hybrid system with two discrete states.A heat source can be switched on or o?at one end of a metal rod of length1,the switching is driven by a sensor placed at the middle of the rod.The temperature at each point x of the rod,T(x,t)is driven by the Heat equation:

?T ?t =k

?2T

?x2

.

When the heat source is ON,we have T(0,t)=1,and when it is OFF,T(0,t)=0. We approximate this partial di?erential equation by a linear ordinary di?erential

equation using a?nite di?erence scheme on a grid of size1

90.

The resulting hybrid system has89continuous variables and2discrete states (see?gure5).We computed the reachable sets of this system for1000times step, during which10discrete transitions occured,in71.6s using406MB of memory. Figure6shows the reachable sets at three di?erent time,each after a discrete transition.

Fig.5.Hybrid model of a thermostat.Fig.6.Reachable set at three di?erent times.The x-axis represents the position in the metal rod,and the y-axis the temperature.The dot on the middle of the x-axis specify the position of the sensor,and the two horizontal line the switching temperatures.The heat source is on the left.

5Conclusion

In this paper,we presented an e?cient algorithm for computing a tight over-approximation of the intersection between a zonotope and a hyperplane.We showed that it can be used in conjunction with a reachability analysis algorithm for continuous linear systems to e?ectively analyze hybrid systems with high dimensional linear continuous dynamic.

The use of the zonotope representation can be seen as a trick allowing us not to compute the full dimensional Minkowski sum,this trick can in fact be applied to more complex objects and it is possible to adapt our algorithm so that it can handle intersection between a hyperplane and the Minkowski sum of a set of ellipsoids and zonotopes.An other extension should allow us to compute an under-approximation of the intersection.This under-approximation might be useful for the choice of the directions of approximation.

Future work also includes the approximation of a polytope by a zonotope,to avoid loosing most of the computed constraints (in the 5-dimensional example,we only kept 8out of the 53computed constraints).

References

1.Varaiya,P.:Reach set computation using optimal control.In:Proc.KIT Workshop on Veri?cation of Hybrid Systems,Verimag,Grenoble (1998)

2.Chutinan,A.,Krogh,B.:Veri?cation of polyhedral-invariant hybrid automata using polygonal ?ow pipe approximations.In:Hybrid Systems:Computation and Control.Volume 1569of LNCS.,Springer (1999)76–90

3.Asarin,E.,Dang,T.,Maler,O.,Bournez,O.:Approximate reachability analy-

sis of piecewise-linear dynamical systems.In:Hybrid Systems:Computation and Control.Volume1790of LNCS.,Springer(2000)20–31

4.Kurzhanski,A.,Varaiya,P.:Ellipsoidal techniques for reachability analysis.In:Hy-

brid Systems:Computation and Control.Volume1790of LNCS.,Springer(2000) 202–214

5.Mitchell,I.,Tomlin,C.:Level set methods for computation in hybrid systems.

In:Hybrid Systems:Computation and Control.Volume1790of LNCS.,Springer (2000)310–323

6.Stursberg,O.,Krogh,B.:E?cient representation and computation of reachable

sets for hybrid systems.In:Hybrid Systems:Computation and Control.Volume 2623of LNCS.,Springer(2003)482–497

7.Girard,A.:Reachability of uncertain linear systems using zonotopes.In:Hybrid

Systems:Computation and Control.Volume3414of LNCS.,Springer(2005)291–305

8.Girard,A.,Le Guernic,C.,Maler,O.:E?cient computation of reachable sets of

linear time-invariant systems with inputs.In:Hybrid Systems:Computation and Control.Volume3927of LNCS.,Springer(2006)257–271

9.Kurzhanskiy,A.A.,Varaiya,P.:Ellipsoidal techniques for reachability analysis of

discrete-time linear systems.IEEE Trans.Automatic Control52(2007)26–38 10.Asarin,E.,Bournez,O.,Dang,T.,Maler,O.,Pnueli,A.:E?ective synthesis of

switching controllers for linear systems.Proc.of the IEEE88(7)(2000)1011–1025 11.Dang,T.:V′e ri?cation et Synth`e se des Syst`e mes Hybrides.PhD thesis,Institut

National Polytechnique de Grenoble(2000)

12.Maler,O.:Control from computer science.IFAC Annual Reviews in Control(2003)

13.Tomlin,C.,Mitchell,I.,Bayen,A.,Oishi,M.:Computational techniques for the

veri?cation and control of hybrid systems.Proc.of the IEEE91(7)(2003)986–1001

14.Ziegler,G.M.:Lectures on Polytopes.Volume152of Graduate Texts in Mathe-

matics.Springer-Verlag(1995)

15.Avis,D.,Fukuda,K.:Reverse search for enumeration.Discrete Appl.Math.65(1-

3)(1996)21–46

16.Zaslavsky,T.:Facing Up to Arrangements:Face-Count Formulas for Partitions of

Space by Hyperplanes.Number154in Memoirs of the American Mathematical Society.American Mathematical Society(1975)

17.Jarvis,R.A.:On the identi?cation of the convex hull of a?nite set of points in the

plane.Inf.Process.Lett.2(1)(1973)18–21

18.Blum,M.,Floyd,R.W.,Pratt,V.R.,Rivest,R.L.,Tarjan,R.E.:Time bounds for

https://www.wendangku.net/doc/0f14244233.html,put.Syst.Sci.7(4)(1973)448–461

19.Balas,E.,Zemel,E.:An algorithm for large zero-one knapsack problems.Opera-

tions Research28(5)(Sep.-Oct.1980)1130–1154

20.Bern,M.W.,Eppstein,D.:Optimization over zonotopes and training support

vector machines(2001)Talk given at WADS.

21.Guibas,L.J.,Nguyen,A.,Zhang,L.:Zonotopes as bounding volumes.In:SODA

’03:Proceedings of the fourteenth annual ACM-SIAM symposium on Discrete al-gorithms,Philadelphia,PA,USA,Society for Industrial and Applied Mathematics (2003)803–812

22.Muller,M.E.:A note on a method for generating points uniformly on n-dimensional

https://www.wendangku.net/doc/0f14244233.html,mun.ACM2(4)(1959)19–20

23.Leroy,X.:The Objective Caml system.INRIA.(2007)

to与for的用法和区别

to与for的用法和区别 一般情况下, to后面常接对象; for后面表示原因与目的为多。 Thank you for helping me. Thanks to all of you. to sb.表示对某人有直接影响比如,食物对某人好或者不好就用to; for表示从意义、价值等间接角度来说,例如对某人而言是重要的,就用for. for和to这两个介词,意义丰富,用法复杂。这里仅就它们主要用法进行比较。 1. 表示各种“目的” 1. What do you study English for? 你为什么要学英语? 2. She went to france for holiday. 她到法国度假去了。 3. These books are written for pupils. 这些书是为学生些的。 4. hope for the best, prepare for the worst. 作最好的打算,作最坏的准备。 2.对于 1.She has a liking for painting. 她爱好绘画。 2.She had a natural gift for teaching. 她对教学有天赋/ 3.表示赞成同情,用for不用to. 1. Are you for the idea or against it? 你是支持还是反对这个想法? 2. He expresses sympathy for the common people.. 他表现了对普通老百姓的同情。 3. I felt deeply sorry for my friend who was very ill. 4 for表示因为,由于(常有较活译法) 1 Thank you for coming. 谢谢你来。 2. France is famous for its wines. 法国因酒而出名。 5.当事人对某事的主观看法,对于(某人),对…来说(多和形容词连用)用介词to,不用for.. He said that money was not important to him. 他说钱对他并不重要。 To her it was rather unusual. 对她来说这是相当不寻常的。 They are cruel to animals. 他们对动物很残忍。 6.for和fit, good, bad, useful, suitable 等形容词连用,表示适宜,适合。 Some training will make them fit for the job. 经过一段训练,他们会胜任这项工作的。 Exercises are good for health. 锻炼有益于健康。 Smoking and drinking are bad for health. 抽烟喝酒对健康有害。 You are not suited for the kind of work you are doing. 7. for表示不定式逻辑上的主语,可以用在主语、表语、状语、定语中。 1.It would be best for you to write to him. 2.The simple thing is for him to resign at once. 3.There was nowhere else for me to go. 4.He opened a door and stood aside for her to pass.

of与for的用法以及区别

of与for的用法以及区别 for 表原因、目的 of 表从属关系 介词of的用法 (1)所有关系 this is a picture of a classroom (2)部分关系 a piece of paper a cup of tea a glass of water a bottle of milk what kind of football,American of soccer? (3)描写关系 a man of thirty 三十岁的人 a man of shanghai 上海人 (4)承受动作 the exploitation of man by man.人对人的剥削。 (5)同位关系 It was a cold spring morning in the city of London in England. (6)关于,对于 What do you think of Chinese food? 你觉得中国食品怎么样? 介词 for 的用法小结 1. 表示“当作、作为”。如: I like some bread and milk for breakfast. 我喜欢把面包和牛奶作为早餐。What will we have for supper? 我们晚餐吃什么?

2. 表示理由或原因,意为“因为、由于”。如: Thank you for helping me with my English. 谢谢你帮我学习英语。 Thank you for your last letter. 谢谢你上次的来信。 Thank you for teaching us so well. 感谢你如此尽心地教我们。 3. 表示动作的对象或接受者,意为“给……”、“对…… (而言)”。如: Let me pick it up for you. 让我为你捡起来。 Watching TV too much is bad for your health. 看电视太多有害于你的健康。 4. 表示时间、距离,意为“计、达”。如: I usually do the running for an hour in the morning. 我早晨通常跑步一小时。We will stay there for two days. 我们将在那里逗留两天。 5. 表示去向、目的,意为“向、往、取、买”等。如: let’s go for a walk. 我们出去散步吧。 I came here for my schoolbag.我来这儿取书包。 I paid twenty yuan for the dictionary. 我花了20元买这本词典。 6. 表示所属关系或用途,意为“为、适于……的”。如: It’s time for school. 到上学的时间了。 Here is a letter for you. 这儿有你的一封信。 7. 表示“支持、赞成”。如: Are you for this plan or against it? 你是支持还是反对这个计划? 8. 用于一些固定搭配中。如: Who are you waiting for? 你在等谁? For example, Mr Green is a kind teacher. 比如,格林先生是一位心地善良的老师。

延时子程序计算方法

学习MCS-51单片机,如果用软件延时实现时钟,会接触到如下形式的延时子程序:delay:mov R5,#data1 d1:mov R6,#data2 d2:mov R7,#data3 d3:djnz R7,d3 djnz R6,d2 djnz R5,d1 Ret 其精确延时时间公式:t=(2*R5*R6*R7+3*R5*R6+3*R5+3)*T (“*”表示乘法,T表示一个机器周期的时间)近似延时时间公式:t=2*R5*R6*R7 *T 假如data1,data2,data3分别为50,40,248,并假定单片机晶振为12M,一个机器周期为10-6S,则10分钟后,时钟超前量超过1.11秒,24小时后时钟超前159.876秒(约2分40秒)。这都是data1,data2,data3三个数字造成的,精度比较差,建议C描述。

上表中e=-1的行(共11行)满足(2*R5*R6*R7+3*R5*R6+3*R5+3)=999,999 e=1的行(共2行)满足(2*R5*R6*R7+3*R5*R6+3*R5+3)=1,000,001 假如单片机晶振为12M,一个机器周期为10-6S,若要得到精确的延时一秒的子程序,则可以在之程序的Ret返回指令之前加一个机器周期为1的指令(比如nop指令), data1,data2,data3选择e=-1的行。比如选择第一个e=-1行,则精确的延时一秒的子程序可以写成: delay:mov R5,#167 d1:mov R6,#171 d2:mov R7,#16 d3:djnz R7,d3 djnz R6,d2

djnz R5,d1 nop ;注意不要遗漏这一句 Ret 附: #include"iostReam.h" #include"math.h" int x=1,y=1,z=1,a,b,c,d,e(999989),f(0),g(0),i,j,k; void main() { foR(i=1;i<255;i++) { foR(j=1;j<255;j++) { foR(k=1;k<255;k++) { d=x*y*z*2+3*x*y+3*x+3-1000000; if(d==-1) { e=d;a=x;b=y;c=z; f++; cout<<"e="<

常用介词用法(for to with of)

For的用法 1. 表示“当作、作为”。如: I like some bread and milk for breakfast. 我喜欢把面包和牛奶作为早餐。 What will we have for supper? 我们晚餐吃什么? 2. 表示理由或原因,意为“因为、由于”。如: Thank you for helping me with my English. 谢谢你帮我学习英语。 3. 表示动作的对象或接受者,意为“给……”、“对…… (而言)”。如: Let me pick it up for you. 让我为你捡起来。 Watching TV too much is bad for your health. 看电视太多有害于你的健康。 4. 表示时间、距离,意为“计、达”。如: I usually do the running for an hour in the morning. 我早晨通常跑步一小时。 We will stay there for two days. 我们将在那里逗留两天。 5. 表示去向、目的,意为“向、往、取、买”等。如: Let’s go for a walk. 我们出去散步吧。 I came here for my schoolbag.我来这儿取书包。 I paid twenty yuan for the dictionary. 我花了20元买这本词典。 6. 表示所属关系或用途,意为“为、适于……的”。如: It’s time for school. 到上学的时间了。 Here is a letter for you. 这儿有你的一封信。 7. 表示“支持、赞成”。如: Are you for this plan or against it? 你是支持还是反对这个计划? 8. 用于一些固定搭配中。如: Who are you waiting for? 你在等谁? For example, Mr Green is a kind teacher. 比如,格林先生是一位心地善良的老师。 尽管for 的用法较多,但记住常用的几个就可以了。 to的用法: 一:表示相对,针对 be strange (common, new, familiar, peculiar) to This injection will make you immune to infection. 二:表示对比,比较 1:以-ior结尾的形容词,后接介词to表示比较,如:superior ,inferior,prior,senior,junior 2: 一些本身就含有比较或比拟意思的形容词,如equal,similar,equivalent,analogous A is similar to B in many ways.

of和for的用法

of 1....的,属于 One of the legs of the table is broken. 桌子的一条腿坏了。 Mr.Brown is a friend of mine. 布朗先生是我的朋友。 2.用...做成的;由...制成 The house is of stone. 这房子是石建的。 3.含有...的;装有...的 4....之中的;...的成员 Of all the students in this class,Tom is the best. 在这个班级中,汤姆是最优秀的。 5.(表示同位) He came to New York at the age of ten. 他在十岁时来到纽约。 6.(表示宾格关系) He gave a lecture on the use of solar energy. 他就太阳能的利用作了一场讲演。 7.(表示主格关系) We waited for the arrival of the next bus. 我们等待下一班汽车的到来。

I have the complete works of Shakespeare. 我有莎士比亚全集。 8.来自...的;出自 He was a graduate of the University of Hawaii. 他是夏威夷大学的毕业生。 9.因为 Her son died of hepatitis. 她儿子因患肝炎而死。 10.在...方面 My aunt is hard of hearing. 我姑妈耳朵有点聋。 11.【美】(时间)在...之前 12.(表示具有某种性质) It is a matter of importance. 这是一件重要的事。 For 1.为,为了 They fought for national independence. 他们为民族独立而战。 This letter is for you. 这是你的信。

单片机C延时时间怎样计算

C程序中可使用不同类型的变量来进行延时设计。经实验测试,使用unsigned char类型具有比unsigned int更优化的代码,在使用时 应该使用unsigned char作为延时变量。以某晶振为12MHz的单片 机为例,晶振为12M H z即一个机器周期为1u s。一. 500ms延时子程序 程序: void delay500ms(void) { unsigned char i,j,k; for(i=15;i>0;i--) for(j=202;j>0;j--) for(k=81;k>0;k--); } 计算分析: 程序共有三层循环 一层循环n:R5*2 = 81*2 = 162us DJNZ 2us 二层循环m:R6*(n+3) = 202*165 = 33330us DJNZ 2us + R5赋值 1us = 3us 三层循环: R7*(m+3) = 15*33333 = 499995us DJNZ 2us + R6赋值 1us = 3us

循环外: 5us 子程序调用 2us + 子程序返回2us + R7赋值 1us = 5us 延时总时间 = 三层循环 + 循环外 = 499995+5 = 500000us =500ms 计算公式:延时时间=[(2*R5+3)*R6+3]*R7+5 二. 200ms延时子程序 程序: void delay200ms(void) { unsigned char i,j,k; for(i=5;i>0;i--) for(j=132;j>0;j--) for(k=150;k>0;k--); } 三. 10ms延时子程序 程序: void delay10ms(void) { unsigned char i,j,k; for(i=5;i>0;i--) for(j=4;j>0;j--) for(k=248;k>0;k--);

for和to区别

1.表示各种“目的”,用for (1)What do you study English for 你为什么要学英语? (2)went to france for holiday. 她到法国度假去了。 (3)These books are written for pupils. 这些书是为学生些的。 (4)hope for the best, prepare for the worst. 作最好的打算,作最坏的准备。 2.“对于”用for (1)She has a liking for painting. 她爱好绘画。 (2)She had a natural gift for teaching. 她对教学有天赋/ 3.表示“赞成、同情”,用for (1)Are you for the idea or against it 你是支持还是反对这个想法? (2)He expresses sympathy for the common people.. 他表现了对普通老百姓的同情。 (3)I felt deeply sorry for my friend who was very ill. 4. 表示“因为,由于”(常有较活译法),用for (1)Thank you for coming. 谢谢你来。

(2)France is famous for its wines. 法国因酒而出名。 5.当事人对某事的主观看法,“对于(某人),对…来说”,(多和形容词连用),用介词to,不用for. (1)He said that money was not important to him. 他说钱对他并不重要。 (2)To her it was rather unusual. 对她来说这是相当不寻常的。 (3)They are cruel to animals. 他们对动物很残忍。 6.和fit, good, bad, useful, suitable 等形容词连用,表示“适宜,适合”,用for。(1)Some training will make them fit for the job. 经过一段训练,他们会胜任这项工作的。 (2)Exercises are good for health. 锻炼有益于健康。 (3)Smoking and drinking are bad for health. 抽烟喝酒对健康有害。 (4)You are not suited for the kind of work you are doing. 7. 表示不定式逻辑上的主语,可以用在主语、表语、状语、定语中。 (1)It would be best for you to write to him. (2) The simple thing is for him to resign at once.

51单片机延时时间计算和延时程序设计

一、关于单片机周期的几个概念 ●时钟周期 时钟周期也称为振荡周期,定义为时钟脉冲的倒数(可以这样来理解,时钟周期就是单片机外接晶振的倒数,例如12MHz的晶振,它的时间周期就是1/12 us),是计算机中最基本的、最小的时间单位。 在一个时钟周期内,CPU仅完成一个最基本的动作。 ●机器周期 完成一个基本操作所需要的时间称为机器周期。 以51为例,晶振12M,时钟周期(晶振周期)就是(1/12)μs,一个机器周期包 执行一条指令所需要的时间,一般由若干个机器周期组成。指令不同,所需的机器周期也不同。 对于一些简单的的单字节指令,在取指令周期中,指令取出到指令寄存器后,立即译码执行,不再需要其它的机器周期。对于一些比较复杂的指令,例如转移指令、乘法指令,则需要两个或者两个以上的机器周期。 1.指令含义 DJNZ:减1条件转移指令 这是一组把减1与条件转移两种功能结合在一起的指令,共2条。 DJNZ Rn,rel ;Rn←(Rn)-1 ;若(Rn)=0,则PC←(PC)+2 ;顺序执行 ;若(Rn)≠0,则PC←(PC)+2+rel,转移到rel所在位置DJNZ direct,rel ;direct←(direct)-1 ;若(direct)= 0,则PC←(PC)+3;顺序执行 ;若(direct)≠0,则PC←(PC)+3+rel,转移到rel 所在位置 2.DJNZ Rn,rel指令详解 例:

MOV R7,#5 DEL:DJNZ R7,DEL; rel在本例中指标号DEL 1.单层循环 由上例可知,当Rn赋值为几,循环就执行几次,上例执行5次,因此本例执行的机器周期个数=1(MOV R7,#5)+2(DJNZ R7,DEL)×5=11,以12MHz的晶振为例,执行时间(延时时间)=机器周期个数×1μs=11μs,当设定立即数为0时,循环程序最多执行256次,即延时时间最多256μs。 2.双层循环 1)格式: DELL:MOV R7,#bb DELL1:MOV R6,#aa DELL2:DJNZ R6,DELL2; rel在本句中指标号DELL2 DJNZ R7,DELL1; rel在本句中指标号DELL1 注意:循环的格式,写错很容易变成死循环,格式中的Rn和标号可随意指定。 2)执行过程

双宾语 to for的用法

1.两者都可以引出间接宾语,但要根据不同的动词分别选用介词to 或for:(1) 在give, pass, hand, lend, send, tell, bring, show, pay, read, return, write, offer, teach, throw 等之后接介词to。 如: 请把那本字典递给我。 正:Please hand me that dictionary. 正:Please hand that dictionary to me. 她去年教我们的音乐。 正:She taught us music last year. 正:She taught music to us last year. (2) 在buy, make, get, order, cook, sing, fetch, play, find, paint, choose,prepare, spare 等之后用介词for 。如: 他为我们唱了首英语歌。 正:He sang us an English song. 正:He sang an English song for us. 请帮我把钥匙找到。 正:Please find me the keys. 正:Please find the keys for me. 能耽搁你几分钟吗(即你能为我抽出几分钟吗)? 正:Can you spare me a few minutes? 正:Can you spare a few minutes for me? 注:有的动词由于搭配和含义的不同,用介词to 或for 都是可能的。如:do sb a favour=do a favour for sb 帮某人的忙 do sb harm=do harm to sb 对某人有害

双宾语tofor的用法

1. 两者都可以引出间接宾语,但要根据不同的动词分别选用介词to 或for: (1) 在give, pass, hand, lend, send, tell, bring, show, pay, read, return, write, offer, teach, throw 等之后接介词to。 如: 请把那本字典递给我。 正:Please hand me that dictionary. 正:Please hand that dictionary to me. 她去年教我们的音乐。 正:She taught us music last year. 正:She taught music to us last year. (2) 在buy, make, get, order, cook, sing, fetch, play, find, paint, choose,prepare, spare 等之后用介词for 。如: 他为我们唱了首英语歌。 正:He sang us an English song. 正:He sang an English song for us. 请帮我把钥匙找到。 正:Please find me the keys. 正:Please find the keys for me. 能耽搁你几分钟吗(即你能为我抽出几分钟吗)? 正:Can you spare me a few minutes? 正:Can you spare a few minutes for me? 注:有的动词由于搭配和含义的不同,用介词to 或for 都是可能的。如: do sb a favou r do a favour for sb 帮某人的忙 do sb harnn= do harm to sb 对某人有害

for和of的用法

for的用法: 1. 表示“当作、作为”。如: I like some bread and milk for breakfast. 我喜欢把面包和牛奶作为早餐。 What will we have for supper? 我们晚餐吃什么? 2. 表示理由或原因,意为“因为、由于”。如: Thank you for helping me with my English. 谢谢你帮我学习英语。 Thank you for your last letter. 谢谢你上次的来信。 Thank you for teaching us so well. 感谢你如此尽心地教我们。 3. 表示动作的对象或接受者,意为“给……”、“对…… (而言)”。如: Let me pick it up for you. 让我为你捡起来。 Watching TV too much is bad for your health. 看电视太多有害于你的健康。 4. 表示时间、距离,意为“计、达”。如:

I usually do the running for an hour in the morning. 我早晨通常跑步一小时。 We will stay there for two days. 我们将在那里逗留两天。 5. 表示去向、目的,意为“向、往、取、买”等。如: Let’s go for a walk. 我们出去散步吧。 I came here for my schoolbag.我来这儿取书包。 I paid twenty yuan for the dictionary. 我花了20元买这本词典。 6. 表示所属关系或用途,意为“为、适于……的”。如: It’s time for school. 到上学的时间了。 Here is a letter for you. 这儿有你的一封信。 7. 表示“支持、赞成”。如: Are you for this plan or against it? 你是支持还是反对这个计划? 8. 用于一些固定搭配中。如:

英语形容词和of for 的用法

加入收藏夹 主题: 介词试题It’s + 形容词 + of sb. to do sth.和It’s + 形容词 + for sb. to do sth.的用法区别。 内容: It's very nice___pictures for me. A.of you to draw B.for you to draw C.for you drawing C.of you drawing 提交人:杨天若时间:1/23/2008 20:5:54 主题:for 与of 的辨别 内容:It's very nice___pictures for me. A.of you to draw B.for you to draw C.for you drawing C.of you drawing 答:选A 解析:该题考查的句型It’s + 形容词+ of sb. to do sth.和It’s +形容词+ for sb. to do sth.的用法区别。 “It’s + 形容词+ to do sth.”中常用of或for引出不定式的行为者,究竟用of sb.还是用for sb.,取决于前面的形容词。 1) 若形容词是描述不定式行为者的性格、品质的,如kind,good,nice,right,wrong,clever,careless,polite,foolish等,用of sb. 例: It’s very kind of you to help me. 你能帮我,真好。 It’s clever of you to work out the maths problem. 你真聪明,解出了这道数学题。 2) 若形容词仅仅是描述事物,不是对不定式行为者的品格进行评价,用for sb.,这类形容词有difficult,easy,hard,important,dangerous,(im)possible等。例: It’s very dangerous for children to cross the busy street. 对孩子们来说,穿过繁忙的街道很危险。 It’s difficult for u s to finish the work. 对我们来说,完成这项工作很困难。 for 与of 的辨别方法: 用介词后面的代词作主语,用介词前边的形容词作表语,造个句子。如果道理上通顺用of,不通则用for. 如: You are nice.(通顺,所以应用of)。 He is hard.(人是困难的,不通,因此应用for.) 由此可知,该题的正确答案应该为A项。 提交人:f7_liyf 时间:1/24/2008 11:18:42

to和for的用法有什么不同(一)

to和for的用法有什么不同(一) 一、引出间接宾语时的区别 两者都可以引出间接宾语,但要根据不同的动词分别选用介词to 或for,具体应注意以下三种情况: 1. 在give, pass, hand, lend, send, tell, bring, show, pay, read, return, write, offer, teach, throw 等之后接介词to。如: 请把那本字典递给我。 正:Please hand me that dictionary. 正:Please hand that dictionary to me. 她去年教我们的音乐。 正:She taught us music last year. 正:She taught music to us last year. 2. 在buy, make, get, order, cook, sing, fetch, play, find, paint, choose, prepare, spare 等之后用介词for 。如: 他为我们唱了首英语歌。 正:He sang us an English song. 正:He sang an English song for us. 请帮我把钥匙找到。 正:Please find me the keys. 正:Please find the keys for me. 能耽搁你几分钟吗(即你能为我抽出几分钟吗)? 正:Can you spare me a few minutes?

正:Can you spare a few minutes for me? 3. 有的动词由于用法和含义不同,用介词to 或for 都是可能的。如: do sb a favor=do a favor for sb 帮某人的忙 do sb harm=do harm to sb 对某人有害 在有的情况下,可能既不用for 也不用to,而用其他的介词。如: play sb a trick=play a trick on sb 作弄某人 请比较: play sb some folk songs=play some folk songs for sb 给某人演奏民歌 有时同一个动词,由于用法不同,所搭配的介词也可能不同,如leave sbsth 这一结构,若表示一般意义的为某人留下某物,则用介词for 引出间接宾语,即说leave sth for sb;若表示某人死后遗留下某物,则用介词to 引出间接宾语,即说leave sth to sb。如: Would you like to leave him a message? / Would you like to leave a message for him? 你要不要给他留个话? Her father left her a large fortune. / Her father left a large fortune to her. 她父亲死后给她留下了一大笔财产。 二、表示目标或方向的区别 两者均可表示目标、目的地、方向等,此时也要根据不同动词分别对待。如: 1. 在come, go, walk, move, fly, ride, drive, march, return 等动词之后通常用介词to 表示目标或目的地。如: He has gone to Shanghai. 他到上海去了。 They walked to a river. 他们走到一条河边。

延时计算

t=n*(分频/f) t:是你所需的延时时间 f:是你的系统时钟(SYSCLK) n:是你所求,用于设计延时函数的 程序如下: void myDelay30s() reentrant { unsigned inti,k; for(i=0;i<4000;i++) /*系统时钟我用的是24.576MHZ,分频是12分频,达到大约10s延时*/ for(k=0;k<8000;k++); } //n=i*k |评论 2012-2-18 20:03 47okey|十四级 debu(g调试),左侧有运行时间。在你要测试的延时子函数外设一断点,全速运行到此断点。记下时间,再单步运行一步,跳到下一步。再看左侧的运行时间,将这时间减去上一个时间,就是延时子函数的延时时间了。不知能不能上图。 追问 在delayms处设置断点,那么对应的汇编语言LCALL是否被执行呢?还有,问问您,在C8051F020单片机中,MOV指令都是多少指令周期呢?我在KEIL下仿真得出的结果,与我通过相应的汇编语言分析的时间,总是差了很多。 回答 C编译时,编译器都要先变成汇编。只想知道延时时间,汇编的你可以不去理会。只要看运行时间就好了。 at8051单片机12m晶振下,机器周期为1us,而c8051 2m晶振下为1us。keil 调试里频率默认为24m,你要设好晶振频率。

|评论 2012-2-23 11:17 kingranran|一级 参考C8051单片机内部计时器的工作模式,选用合适的计时器进行中断,可获得较高精度的延时 |评论 2012-2-29 20:56 衣鱼ccd1000|一级 要是精确延时的话就要用定时器,但定的时间不能太长,长了就要设一个变量累加来实现了; 要是不要求精确的话就用嵌套for函数延时,比较简单,但是程序复杂了就会增添不稳定因素,所以不推荐。 |评论

202X中考英语:to和for的区别与用法.doc

202X中考英语:to和for的区别与用法中考栏目我为考生们整理了“202X中考英语:to和for的区别与用法”,希望能帮到大家,想了解更多考试资讯,本网站的及时更新哦。 202X中考英语:to和for的区别与用法 to和for的区别与用法是什么 一般情况下, to后面常接对象; for后面表示原因与目的为多。 Thank you for helping me. Thanks to all of you. to sb. 表示对某人有直接影响比如,食物对某人好或者不好就用to; for 表示从意义、价值等间接角度来说,例如对某人而言是重要的,就用for. for和to这两个介词,意义丰富,用法复杂。这里仅就它们主要用法进行比较。 1. 表示各种“目的” 1. What do you study English for? 你为什么要学英语? 2. She went to france for holiday. 她到法国度假去了。 3. These books are written for pupils. 这些书是为学生些的。 4. hope for the best, prepare for the worst. 作最好的打算,作最坏的准备。

2.对于 1.She has a liking for painting. 她爱好绘画。 2.She had a natural gift for teaching. 她对教学有天赋。 3.表示赞成同情,用for不用to. 1. Are you for the idea or against it? 你是支持还是反对这个想法? 2. He expresses sympathy for the common people.. 他表现了对普通老百姓的同情。 3. I felt deeply sorry for my friend who was very ill. 4 for表示因为,由于(常有较活译法) 1.Thank you for coming. 谢谢你来。 2. France is famous for its wines. 法国因酒而出名。 5.当事人对某事的主观看法,对于(某人),对?来说(多和形容词连用)用介词to,不用for.. He said that money was not important to him. 他说钱对他并不重要。 To her it was rather unusual. 对她来说这是相当不寻常的。 They are cruel to animals. 他们对动物很残忍。

keep的用法及of 、for sb.句型区别

keep的用法 1. 用作及物动词 ①意为"保存;保留;保持;保守"。如: Could you keep these letters for me, please? 你能替我保存这些信吗? ②意为"遵守;维护"。如: Everyone must keep the rules. 人人必须遵守规章制度。 The teacher is keeping order in class.老师正在课堂上维持秩序。 ③意为"使……保持某种(状态、位置或动作等)"。这时要在keep的宾语后接补足语,构 成复合宾语。其中宾语补足语通常由形容词、副词、介词短语、现在分词和过去分词等充当。如: 例:We should keep our classroom clean and tidy.(形容词) 我们应保持教室整洁干净。 You'd better keep the child away from the fire.(副词)你最好让孩子离火远一点。 The bad weather keeps us inside the house.(介词短语)坏天气使我们不能出门。 Don't keep me waiting for long.(现在分词)别让我等太久。 The other students in the class keep their eyes closed.(过去分词) 班上其他同学都闭着眼睛。 2. 用作连系动词 构成系表结构:keep+表语,意为"保持,继续(处于某种状态)"。其中表语可用形容词、副词、介词短语等充当。如: 例:You must look after yourself and keep healthy.(形容词) 你必须照顾好自己,保持身体健康。 Keep off the grass.(副词)请勿践踏草地。 Traffic in Britain keeps to the left.(介词短语)英国的交通是靠左边行驶的。 注意:一般情况下,keep后接形容词较为多见。再如: She knew she must keep calm.她知道她必须保持镇静。 Please keep silent in class.课堂上请保持安静。 3. ①keep doing sth. 意为"继续干某事",表示不间断地持续干某事,keep后不 能接不定式或表示静止状态的v-ing形式,而必须接延续性的动词。 例:He kept working all day, because he wanted to finish the work on time. 他整天都在不停地工作,因为他想准时完成工作。 Keep passing the ball to each other, and you'll be OK.坚持互相传球,你们就

to of和for的区别

to , of 和for的区别 1.to有到的意思,常常和go,come,get连用引出地点。Go to school , go to the shop , go to the cinema. 常见的短语:the way to 去---的路 On one’s way to 在某人去---的路上 以上的用法中,当地点是副词home,here,there等是to 要去掉。如:get home,the way here To后跟动词原形,是不定式的标志 It is +形容词+(for/of +人+)to do sth.(括号内部分可以省略) It is easy for me to learn English. It is very kind of you to lend me your money. 当形容词表示人的行为特征时用of表示to do的性质时用for Want, hope ,decide, plan , try , fail等词后跟to do I want to join the swimming club. Would like to do I’d like to play basketball with them. It is time to have a break. Next to , close to , from ---to--- 2.for 为,表示目的。 Thank you for Buy sth for sb =buy sb sth It is time for bed. Here is a letter for you.

I will study for our country. 3.of表示所属关系意思是:---的 a map of the world a friend of mine

for和of引导的不定式结构的区别

for和of引导的不定式结构的区别 不定式是一种非谓语动词,不能单独作谓语,因此没有语法上的主语。但由于不定式表示的是动作,在意义上可以有它的主体。我们称之为逻辑主语。 提起不定式逻辑主语,人们首先想到的会是“for+名词(宾格代词)+不定式”的复合结构。如:It is important for us to study English well.然而,有时不定式的逻辑主语须要用“of+名词(代词宾格)”才行。例如:It is kind of you to help me.而不能说:It is kind for you to help me.在选择介词“for”还是“of”时,人们往往总是凭感觉而定。有时受习惯影响,多选介词“for”。于是常出现这样的错误:It was careless for him to lose his way.It is cruel for you to do so.由于众多语法书对这种结构中使用“for”与“of”的区别介绍甚少,一些人对其概念认识尚不完全清楚,笔者认为有必要就这一问题作些探讨与介绍。 一、在句中的语法作用不同 a.不定式for结构在句中可以作主、宾、表、定、状、同位语: 1.It is easy for Tom to do this work.(主语)汤姆做此工作是容易的。 2.I'd like for him to come here.(宾语)我喜欢他来这里。 3.His idea is for us to travel in two different groups.(表语)他的想法是:我们分成两组旅行。 4.Have you heard about the plan for you to go abroad.(定语)你听到让你出国的计划吗? 5.The word is too difficult for him to pronounce well.(状语)这单词太难,他念不准。 6.In the most schools,it is the custom for the headmaster to declare the newterm start.在大部分学校,校长宣布新学期开始是一个习惯。 b.不定式of结构只能在句中作主语。 1.It was careless of him to leave his umbrella in the train.他把伞丢在火车上真是太粗心了。 2.It is awfully good of you to come to see me off at the station.谢谢你来车站送我。 二、逻辑主语的名词有所不同

相关文档