因为使用fiware cephues我按照文件发送配送文件
Sub Optimization()
Application.ScreenUpdating = False
'Unlocks workbook to allow updating
Call Unlock_Workbook
'Makes visible and selects the tab where the optimization problem is set up
Sheets("Optimization").Visible = True
Sheets("Optimization").Select
'Clear variable ranges that solver will change
Range("Worker_All[[1]:[15]]").Clear
Range("TestRig_All[[1]:[15]]").Clear
Range("Worker_787[[1]:[15]]").Clear
Range("TestRig_787[[1]:[15]]").Clear
'Install the Add-in for users who have no done this already
AddIns("Solver Add-in").Installed = True
'Optimized All Workers
For i = 1 To 15
'Cell address for objective
Min = Cells(3, 2 + i).Address
'Cell adress for variable
Variable = Range("Worker_All[" & i & "]").Address
'Cell address for constraint range
ConstraintRange = Range("IntakeHours_NonKeyWO[" & i & "]").Address
'Cell address for constrants
Constraint = Range("IntakeHours_NonKeyWOC[" & i & "]").Address
SolverReset
SolverOk SetCell:=Min, MaxMinVal:=2, ValueOf:=0, ByChange:=Variable, _
Engine:=2, EngineDesc:="Simplex LP"
SolverAdd CellRef:=ConstraintRange, Relation:=1, FormulaText:=Constraint
SolverSolve True
Next i
'Optimized All Test Rigs
For i = 1 To 15
Min = Cells(4, 2 + i).Address
Variable = Range("TestRig_All[" & i & "]").Address
ConstraintRange = Range("IntakeHours_NonKeyMO[" & i & "]").Address
Constraint = Range("IntakeHours_NonKeyMOC[" & i & "]").Address
SolverReset
SolverOk SetCell:=Min, MaxMinVal:=2, ValueOf:=0, ByChange:=Variable, _
Engine:=2, EngineDesc:="Simplex LP"
SolverAdd CellRef:=ConstraintRange, Relation:=1, FormulaText:=Constraint
SolverSolve True
Next i
'Optimized 787 Workers
For i = 1 To 15
Min = Cells(5, 2 + i).Address
Variable = Range("Worker_787[" & i & "]").Address
ConstraintRange = Range("IntakeHours_Key787WO[" & i & "]").Address
Constraint = Range("IntakeHours_Key787WOC[" & i & "]").Address
SolverReset
SolverOk SetCell:=Min, MaxMinVal:=2, ValueOf:=0, ByChange:=Variable, _
Engine:=2, EngineDesc:="Simplex LP"
SolverAdd CellRef:=ConstraintRange, Relation:=1, FormulaText:=Constraint
SolverSolve True
Next i
'Optimized 787 Test Rigs
For i = 1 To 15
Min = Cells(6, 2 + i).Address
Variable = Range("TestRig_787[" & i & "]").Address
ConstraintRange = Range("IntakeHours_Key787MO[" & i & "]").Address
Constraint = Range("IntakeHours_Key787MOC[" & i & "]").Address
SolverReset
SolverOk SetCell:=Min, MaxMinVal:=2, ValueOf:=0, ByChange:=Variable, _
Engine:=2, EngineDesc:="Simplex LP"
SolverAdd CellRef:=ConstraintRange, Relation:=1, FormulaText:=Constraint
SolverSolve True
Next i
Sheets("Cell Summary").Select
Sheets("Optimization").Visible = False
Call Lock_Workbook
Application.ScreenUpdating = True
End Sub
并成功发送状态代码为200
但发送更新时
{
"host":"http://localhost:8080",
"in":[
{
"id":"Lab.*",
"type":"Lab",
"isPattern": true,
"attributes":[
{ "name":"motion", "type":"double","metadata": [
{ "name":"unit", "type":"string" }
] }
, { "name":"priority", "type":"double","metadata": [
{ "name":"unit", "type":"string" }
] },
{ "name":"controller", "type":"string"}],
"providers":[
"http://localhost:8081"
]
}
],
"out":[
{
"id":"ControllerX",
"type":"Controller",
"attributes":[
{ "name":"switch", "type":"command"
,"metadata": [
{ "name":"unit", "type":"string" }
]
}
,
{ "name":"number", "type":"double"
,"metadata": [
{ "name":"unit", "type":"string" }
] }
]
,
"brokers":[
{
"url":"http://147.27.60.58:1026",
"serviceName": "try1",
"servicePath": "/try1",
"authToken": "token"
}
]
}
],
"statements":[
" INSERT INTO Controller SELECT controller as id , 'ON' as switch, (CASE WHEN (C is null AND motion = 1) THEN 1 WHEN (C is null AND motion = 3) THEN 0 WHEN (C is not null AND motion = 1) THEN C.number+1 WHEN (motion = 0 AND C.number >= 1) THEN C.number-1 ELSE C.number END) as number FROM Lab as L unidirectional LEFT OUTER JOIN Controller.std:groupwin(id).std:lastevent() as C ON controller=C.id GROUP BY controller HAVING (priority = 0 AND motion = 1) or (priority = 1) or (priority = 0 AND motion = 3 AND C.number > 0) "
,
" INSERT INTO Controller SELECT controller as id ,C.switch as switch, C.number-1 as number FROM Lab as L unidirectional LEFT OUTER JOIN Controller.std:groupwin(id).std:lastevent() as C ON controller=C.id GROUP BY controller HAVING motion = 0 AND C.number > 1 AND (priority=0) "
,
" INSERT INTO Controller SELECT controller as id , 'OFF' as switch ,(CASE WHEN (motion = 0 AND C.number >= 1) THEN C.number-1 WHEN (motion=1 AND C is null) THEN 1 WHEN (C is null AND motion = 3) THEN 0 WHEN (motion = 1 AND C is not null) THEN C.number+1 ELSE C.number END) as number FROM Lab as L unidirectional LEFT OUTER JOIN Controller.std:groupwin(id).std:lastevent() as C ON controller=C.id GROUP BY controller HAVING (priority = 0 AND C.number = 1 AND motion = 0 ) or (priority = 2) or (priority = 0 AND motion = 3 AND C.number = 0)
"
]
}
我无法在上下文中找到实体 当检查Cepheus-cep日志时我得到了
(curl 194.177.207.78:8081/v1/updateContext/ -s -S --header 'Content-Type: application/json' \
--header 'Accept: application/json' -d @- | python -mjson.tool ) <<EOF
{ "contextElements": [
{
"type": "Lab",
"isPattern": "false",
"id": "FCI-Lab",
"attributes": [
{
"name": "motion",
"type": "double",
"value": 1
},
{
"name": "priority",
"type": "double",
"value": 0
},
{
"name": "controller",
"type": "string",
"value": "Controller12"
}
]
}
],
"updateAction": "UPDATE"
}
EOF
日志中的不支持的媒体类型是什么意思,以及如何解决此错误? 我们真的需要尽快帮助。