【问题标题】:Folio-Epicenter example (Julia + uibuilder)Folio-Epicenter 示例(Julia + uibuilder)
【发布时间】:2015-09-07 03:40:33
【问题描述】:

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

#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 变量(通过“导出”和“全局”公开)时,加载页面给了我

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”和“parameters.input1”;总是返回 400 错误。

【问题讨论】:

  • 您能否提供更多上下文和/或代码,以便人们可以看到您在做什么并提供帮助?

标签: julia


【解决方案1】:

Forio 支持在这里。

两个问题

a) 由于“input1”是可变参数(ParameterTypes类型)中的一个字段,所以在接口中必须将其称为“parameters.input1”

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-07-03
    • 2012-06-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多