GasNode Groovy 问题怎样解决?
在groovy出现下述程序,但在gasnode groovy里显示错误:L,请帮助解决@Parameter (displayName = "Measured Pressure", usageName = "measured pressure")
public double getMeasured pressure() {
return measured pressure
}
public void setMeasured pressure(double newValue) {
measured pressure = newValue
}
public double measured pressure = 0
/**
*
* This value is used to automatically generate agent identifiers.
* @field serialVersionUID
*
*/
private static final long serialVersionUID = 1L
/**
*
* This value is used to automatically generate agent identifiers.
* @field agentIDCounter
*
*/
protected static long agentIDCounter = 1
/**
*
* This value is the agent's identifier.
* @field agentID
*
*/
protected String agentID = "GasNode " + (agentIDCounter++)
/**
*
* This is the step behavior.
* @method step
*
*/
@Watch(
watcheeClassName = 'infrastructuredemo.GasNode',
watcheeFieldNames = 'pressure',
query = 'linked_from',
whenToTrigger = WatcherTriggerSchedule.LATER,
scheduleTriggerDelta = 10d
)
public def step(infrastructuredemo.GasNode watchedAgent) {
// Define the return value variable.
def returnValue
// Note the simulation time.
def time = GetTickCountInTimeUnits()
// This is an agent decision.
if (watchedNode.pressure<200) {
// This is a task.
setPressure(watchedAgent.pressure)
} else{
}
// Return the results.
return returnValue
}
/**
*
* This is the step behavior.
* @method step
*
*/
@ScheduledMethod(
start = 1d,
interval = 1d,
shuffle = false
)
public void step() {
// Note the simulation time.
def time = GetTickCountInTimeUnits()
// This is a task.
measurePressure=pressure+ RandomDraw(-20.0, 20.0)
// End the method.
return
} 报错信息有吗?请标出来。我好像碰到过,删除了哪条语句就行了。 报错信息发一下看看 注意,在函数step中
public def step(infrastructuredemo.GasNode watchedAgent) {
//这里是watchedAgent
但是在语句中,你填的是watchedNode
// This is an agent decision.
if (watchedNode.pressure<200) {
setPressure(watchedAgent.pressure)
变量名称须统一,可以都改为watchedAgent 注意,在函数step中
public def step(infrastructuredemo.GasNode watchedAgent) {
//这里是watchedAgent
但是在语句中,你填的是watchedNode
// This is an agent decision.
if (watchedNode.pressure<200) {
setPressure(watchedAgent.pressure)
变量名称须统一,可以都改为watchedAgent
页:
[1]