Folio-Epicenter示例(Julia + uibuilder)

时间:2015-09-07 03:40:33

标签: julia

我尝试使用Forio Epicenter exampleJulia 从文档中获取基本的UI Builder。它看起来像这样:

#in MyModel.jl

module MyModel

# use the Epicenter Julia package
using Epicenter

# expose methods you want to call 
# (e.g. using the Run API or Model Operation API,
#  or the Model Operation property of a component in UI Builder)
export doubleIt

# expose variables you want to view or update 
# (e.g. using the Run API or Model Variable API,
#  or the Model Variable property of a component in UI Builder)
export parameters, result

# make exposed variables global
global parameters, result

# define variables that the end user will change as part of a complex type
type ParametersType
    input1
    input2

    function ParametersType()
        item = new()
        item
    end
end

function doubleIt()
    global parameters
    global result

    result = parameters.input1 * 2
    record(:result)
end


# other files in your model
include("Utils.jl")
include("OtherModelCalculations.jl")

end

我无法连接任何变量。当我做一个"文本输入"组件并更改"模型变量"属性与Julia变量相匹配(通过" export"" global"),加载页面给我

400 Bad Request

完整的JSON响应:

{"status":400,
    "errors":{"status":400,
        "internal":{
            "procedure":"push!(LOAD_PATH, string(ENV[\"HOME\"],
            \"\/model\/\")); import Epicenter; using Juliet; using EpicenterSystem; EpicenterSystem.setup_idle_timeout
            (1800); require(\"MyModel.jl\"); using MyModel","sessionId":"c5b8189b-4f4d-4377-87a9-ca8d154863c0","trace":""}
    },
    "message":"Bad Request."
}

我已经尝试过"模型变量"的每个组合。我可以想到,包括" input1","参数"和" parameters.input1&#34 ;;总是回来400错误。

1 个答案:

答案 0 :(得分:0)

Forio支持。

两个问题

a)因为" input1"是一个变量参数的字段(类型为ParameterTypes),它必须在接口中引用为" parameters.input1"

b)更重要的是,该模型试图包括Utils.jl和OtherModelCalculations.jl,两者都不存在。因此,模型永远不会加载。