" Z' r8 f& C# E& G4 U- u1 w- g /** * u& n5 j9 E" d: r *9 V$ e/ n4 \4 v
* This is the step behavior.3 Q# E4 G, \, W, m
* @method step: M& g- f2 J' x% V! b$ ~) u
*$ R+ f! x3 j1 |( A/ t" d
*/ $ F4 D0 R k% l @ScheduledMethod( 0 F- m2 f/ h( h8 A7 _. p start = 1d, y4 t: }( a0 m$ r9 h interval = 1d,5 \1 d2 k7 \3 v/ R: I$ K- b9 i$ V5 }
shuffle = false6 } ^" D: ?7 H0 \5 @
)0 O+ P3 t* t1 D& ~
public void step() {# W, i8 h, O$ ?2 Y$ b' f: o
/ I# Z$ e) G1 j: Q( R9 H- \ // Note the simulation time. & q+ ~7 V/ p h& K2 B n ` def time = GetTickCountInTimeUnits()( d+ Z; X z' F
' q/ x- n( g+ U! z
// This is a task. 1 |& l6 R3 s- [. o+ p, \* J measurePressure=pressure+ RandomDraw(-20.0, 20.0)$ K; s3 b. }! I7 i4 V
// End the method. & l8 Z' l E7 ~5 T$ ~ return; q( p( v+ P& F b! ^2 g$ s
注意,在函数step中 : E: [) d/ {( B5 e public def step(infrastructuredemo.GasNode watchedAgent) { / ~7 l; z5 t# e/ a //这里是watchedAgent ! K* N1 |! \& |' K5 k& a+ X- i 但是在语句中,你填的是watchedNode : c; I( m# E9 X // This is an agent decision., R4 f X: ~9 ]) C
if (watchedNode.pressure<200) { " r8 Y0 D( ~0 m9 w
setPressure(watchedAgent.pressure)) v/ \7 B' A! v) N
变量名称须统一,可以都改为watchedAgent