Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » LuaJit in windows in ok but under raspiberry can't
LuaJit in windows in ok but under raspiberry can't [message #1819636] Mon, 20 January 2020 03:15 Go to next message
joy woo is currently offline joy wooFriend
Messages: 198
Registered: May 2019
Senior Member
i noticed some FBs could be created, but some couldn't, but with the same FB, in windows was ok.
that's the FB below, of course gramma is ok which is also ok in windows

int err = luaL_loadstring(luaState, str.c_str());
if (err) {
switch (err) {
case LUA_ERRSYNTAX:
DEVLOG_ERROR("Syntax error loading Lua definitions\n");
break;

it threw error LUA_ERRSYNTAX


local FB_STATE = 0
local ECC_START = 0
local ECC_Forwarding = 1
local ECC_Limit = 2
local ECC_Backing = 3
local ECC_BackingLimit = 4
local ECC_Stop = 5
local ECC_Forwarding2 = 6
local ECC_ReachLimit2 = 7
local ECC_Backing2 = 8
local ECC_BackingLimit2 = 9
local ECC_Suspend1 = 10
local ECC_Suspend2 = 11
local ECC_Suspend3 = 12
local EI_REQ = 0
local EI_ON = 1
local EO_BCE = 0
local EO_LCOff = 1
local DI_QI = 33554432
local DI_Start = 33554433
local DI_BCLimit = 33554434
local DI_BCOrigin = 33554435
local DI_Stop = 33554436
local DI_Automode = 33554437
local DI_Jog = 33554438
local DI_Rst = 33554439
local DI_LScreen = 33554440
local DI_DUR = 33554441
local DO_BCSta = 67108864
local DO_STA = 67108865
local AEI_timeOut_TimeOut = 134217728
local AEO_timeOut_START = 134217728
local AEO_timeOut_STOP = 134217729
local ADO_timeOut_DT = 201326592

local function alg_BCylinderDown(fb)
local STATE = fb[FB_STATE]
local VAR_STA = fb[DO_STA]
local VAR_BCSta = fb[DO_BCSta]
VAR_STA = 1
VAR_BCSta = true
fb[DO_STA] = VAR_STA
fb[DO_BCSta] = VAR_BCSta
end

local function alg_ReachLimit(fb)
local STATE = fb[FB_STATE]
local VAR_STA = fb[DO_STA]
local VAR_DUR = fb[DI_DUR]
local VAR_timeOut_DT = fb[ADO_timeOut_DT]
VAR_STA = 2
VAR_timeOut_DT = VAR_DUR
fb[DO_STA] = VAR_STA
fb[ADO_timeOut_DT] = VAR_timeOut_DT
end

local function alg_BackingOperation(fb)
local STATE = fb[FB_STATE]
local VAR_STA = fb[DO_STA]
local VAR_BCSta = fb[DO_BCSta]
VAR_STA = 3
VAR_BCSta = false
fb[DO_STA] = VAR_STA
fb[DO_BCSta] = VAR_BCSta
end

local function alg_StartOperation(fb)
local STATE = fb[FB_STATE]
local VAR_STA = fb[DO_STA]
VAR_STA = 0
fb[DO_STA] = VAR_STA
end

local function alg_StopAll(fb)
local STATE = fb[FB_STATE]
local VAR_STA = fb[DO_STA]
local VAR_BCSta = fb[DO_BCSta]
VAR_STA = 99
VAR_BCSta = 0
fb[DO_STA] = VAR_STA
fb[DO_BCSta] = VAR_BCSta
end

local function alg_ReachBackingLimit(fb)
local STATE = fb[FB_STATE]
local VAR_STA = fb[DO_STA]
local VAR_DUR = fb[DI_DUR]
local VAR_timeOut_DT = fb[ADO_timeOut_DT]
VAR_STA = 4
VAR_timeOut_DT = VAR_DUR
fb[DO_STA] = VAR_STA
fb[ADO_timeOut_DT] = VAR_timeOut_DT
end

local function alg_BackingOnOperation(fb)
local STATE = fb[FB_STATE]
local VAR_STA = fb[DO_STA]
local VAR_BCSta = fb[DO_BCSta]
VAR_STA = 6
VAR_BCSta = true
fb[DO_STA] = VAR_STA
fb[DO_BCSta] = VAR_BCSta
end

local function alg_ReachLimit2Operation(fb)
local STATE = fb[FB_STATE]
local VAR_STA = fb[DO_STA]
VAR_STA = 7
fb[DO_STA] = VAR_STA
end

local function alg_Backing2Operation(fb)
local STATE = fb[FB_STATE]
local VAR_STA = fb[DO_STA]
local VAR_BCSta = fb[DO_BCSta]
VAR_STA = 8
VAR_BCSta = false
fb[DO_STA] = VAR_STA
fb[DO_BCSta] = VAR_BCSta
end

local function alg_BackigLimt2Operation(fb)
local STATE = fb[FB_STATE]
local VAR_STA = fb[DO_STA]
VAR_STA = 9
fb[DO_STA] = VAR_STA
end

local function alg_Suspend1Operation(fb)
local STATE = fb[FB_STATE]
local VAR_BCSta = fb[DO_BCSta]
local VAR_STA = fb[DO_STA]
VAR_BCSta = false
VAR_STA = 98
fb[DO_BCSta] = VAR_BCSta
fb[DO_STA] = VAR_STA
end

local function alg_Suspend2Operation(fb)
local STATE = fb[FB_STATE]
end

local function alg_Suspend3Operation(fb)
local STATE = fb[FB_STATE]
local VAR_BCSta = fb[DO_BCSta]
local VAR_STA = fb[DO_STA]
VAR_BCSta = false
VAR_STA = 98
fb[DO_BCSta] = VAR_BCSta
fb[DO_STA] = VAR_STA
end


local function enterECC_START(fb)
fb[FB_STATE] = ECC_START
alg_StartOperation(fb)
return true
end

local function enterECC_Forwarding(fb)
fb[FB_STATE] = ECC_Forwarding
alg_BCylinderDown(fb)
fb(EO_BCE)
return true
end

local function enterECC_Limit(fb)
fb[FB_STATE] = ECC_Limit
alg_ReachLimit(fb)
fb(AEO_timeOut_START)
return true
end

local function enterECC_Backing(fb)
fb[FB_STATE] = ECC_Backing
alg_BackingOperation(fb)
fb(EO_BCE)
return true
end

local function enterECC_BackingLimit(fb)
fb[FB_STATE] = ECC_BackingLimit
alg_ReachBackingLimit(fb)
fb(AEO_timeOut_START)
return true
end

local function enterECC_Stop(fb)
fb[FB_STATE] = ECC_Stop
alg_StopAll(fb)
fb(EO_BCE)
return true
end

local function enterECC_Forwarding2(fb)
fb[FB_STATE] = ECC_Forwarding2
alg_BackingOnOperation(fb)
fb(EO_BCE)
return true
end

local function enterECC_ReachLimit2(fb)
fb[FB_STATE] = ECC_ReachLimit2
alg_ReachLimit2Operation(fb)
fb(AEO_timeOut_START)
return true
end

local function enterECC_Backing2(fb)
fb[FB_STATE] = ECC_Backing2
alg_Backing2Operation(fb)
fb(EO_BCE)
return true
end

local function enterECC_BackingLimit2(fb)
fb[FB_STATE] = ECC_BackingLimit2
alg_BackigLimt2Operation(fb)
fb(EO_LCOff)
return true
end

local function enterECC_Suspend1(fb)
fb[FB_STATE] = ECC_Suspend1
alg_Suspend1Operation(fb)
fb(EO_BCE)
return true
end

local function enterECC_Suspend2(fb)
fb[FB_STATE] = ECC_Suspend2
fb(AEO_timeOut_STOP)
return true
end

local function enterECC_Suspend3(fb)
fb[FB_STATE] = ECC_Suspend3
fb(AEO_timeOut_STOP)
alg_Suspend3Operation(fb)
fb(EO_BCE)
return true
end


local function transition(fb, id)
local STATE = fb[FB_STATE]
local VAR_QI = fb[DI_QI]
local VAR_Start = fb[DI_Start]
local VAR_BCLimit = fb[DI_BCLimit]
local VAR_BCOrigin = fb[DI_BCOrigin]
local VAR_Stop = fb[DI_Stop]
local VAR_Automode = fb[DI_Automode]
local VAR_Jog = fb[DI_Jog]
local VAR_Rst = fb[DI_Rst]
local VAR_LScreen = fb[DI_LScreen]
local VAR_DUR = fb[DI_DUR]
local VAR_BCSta = fb[DO_BCSta]
local VAR_STA = fb[DO_STA]
if ECC_START == STATE then
if EI_ON == id and ((VAR_QI == 1) and (VAR_LScreen == 1)) then return enterECC_Forwarding(fb)
elseif true and (VAR_Stop == 1) then return enterECC_Stop(fb)
else return false
end
elseif ECC_Forwarding == STATE then
if true and (((VAR_BCLimit == 1) and (VAR_Automode == 1)) and (VAR_LScreen == 1)) then return enterECC_Limit(fb)
elseif true and ((VAR_Stop == 1) or ((VAR_Automode == 0) and (VAR_Rst == 1))) then return enterECC_Stop(fb)
elseif true and (((VAR_Automode == 0) and (VAR_Jog == 1)) and (VAR_BCLimit == 1)) then return enterECC_Backing(fb)
elseif true and (VAR_LScreen == 0) then return enterECC_Suspend1(fb)
else return false
end
elseif ECC_Limit == STATE then
if AEI_timeOut_TimeOut == id and (VAR_LScreen == 1) then return enterECC_Backing(fb)
elseif true and ((VAR_Stop == 1) or ((VAR_Automode == 0) and (VAR_Rst == 1))) then return enterECC_Stop(fb)
elseif true and (VAR_LScreen == 0) then return enterECC_Suspend1(fb)
else return false
end
elseif ECC_Backing == STATE then
if true and ((VAR_BCOrigin == 1) and (VAR_Automode == 1)) then return enterECC_BackingLimit(fb)
elseif true and ((VAR_Stop == 1) or ((VAR_Automode == 0) and (VAR_Rst == 1))) then return enterECC_Stop(fb)
elseif true and (((VAR_Automode == 0) and (VAR_Jog == 1)) and (VAR_BCOrigin == 1)) then return enterECC_Forwarding2(fb)
elseif true and (VAR_LScreen == 0) then return enterECC_Suspend1(fb)
else return false
end
elseif ECC_BackingLimit == STATE then
if true and ((VAR_Stop == 1) or ((VAR_Automode == 0) and (VAR_Rst == 1))) then return enterECC_Stop(fb)
elseif AEI_timeOut_TimeOut == id and (VAR_Stop < 1) then return enterECC_Forwarding2(fb)
elseif true and (VAR_LScreen == 0) then return enterECC_Suspend2(fb)
else return false
end
elseif ECC_Stop == STATE then
if true and (VAR_Stop == 0) then return enterECC_START(fb)
else return false
end
elseif ECC_Forwarding2 == STATE then
if true and ((VAR_Stop == 1) or ((VAR_Automode == 0) and (VAR_Rst == 1))) then return enterECC_Stop(fb)
elseif true and (((VAR_BCLimit == 1) and (VAR_Automode == 1)) and (VAR_LScreen == 1)) then return enterECC_ReachLimit2(fb)
elseif true and (((VAR_BCLimit == 1) and (VAR_Automode == 0)) and (VAR_Jog == 1)) then return enterECC_Backing2(fb)
elseif true and (VAR_LScreen == 0) then return enterECC_Suspend3(fb)
else return false
end
elseif ECC_ReachLimit2 == STATE then
if AEI_timeOut_TimeOut == id and (VAR_LScreen == 1) then return enterECC_Backing2(fb)
elseif true and (VAR_LScreen == 0) then return enterECC_Suspend3(fb)
else return false
end
elseif ECC_Backing2 == STATE then
if true and ((VAR_BCOrigin == 1) and ((VAR_Automode == 1) or ((VAR_Automode == 0) and (VAR_Jog == 1)))) then return enterECC_BackingLimit2(fb)
else return false
end
elseif ECC_BackingLimit2 == STATE then
if true and 1 then return enterECC_START(fb)
else return false
end
elseif ECC_Suspend1 == STATE then
if true and ((VAR_LScreen == 1) and (VAR_Start == 1)) then return enterECC_Forwarding(fb)
else return false
end
elseif ECC_Suspend2 == STATE then
if true and ((VAR_LScreen == 1) and (VAR_Start == 1)) then return enterECC_BackingLimit(fb)
else return false
end
elseif ECC_Suspend3 == STATE then
if true and ((VAR_LScreen == 1) and (VAR_Start == 1)) then return enterECC_Forwarding2(fb)
else return false
end
else return false
end
end

local function executeEvent(fb, id)
local modified = transition(fb, id)
while modified do
modified = transition(fb, -1)
end
end

local interfaceSpec = {
numEIs = 2,
EINames = {"REQ", "ON"},
EIWith = {0, 2, 3, 4, 5, 6, 7, 8, 1, 255, 0, 2, 3, 255},
EIWithIndexes = {0, 10},
numEOs = 2,
EONames = {"BCE", "LCOff"},
EOWith = {0, 255},
EOWithIndexes = {0, -1},
numDIs = 10,
DINames = {"QI", "Start", "BCLimit", "BCOrigin", "Stop", "Automode", "Jog", "Rst", "LScreen", "DUR"},
DIDataTypeNames = {"BOOL", "BOOL", "BOOL", "BOOL", "BOOL", "BOOL", "BOOL", "BOOL", "BOOL", "TIME"},
numDOs = 2,
DONames = {"BCSta", "STA"},
DODataTypeNames = {"BOOL", "UINT"},
numAdapters = 1,
adapterInstanceDefinition = {
{adapterNameID = "timeOut", adapterTypeNameID = "ATimeOut", isPlug = true}
}
}

local internalVarsInformation = {
numIntVars = 0,
intVarsNames = {},
intVarsDataTypeNames = {}
}

return {ECC = executeEvent, interfaceSpec = interfaceSpec, internalVarsInformation = internalVarsInformation}
Re: LuaJit in windows in ok but under raspiberry can't [message #1819637 is a reply to message #1819636] Mon, 20 January 2020 03:17 Go to previous messageGo to next message
joy woo is currently offline joy wooFriend
Messages: 198
Registered: May 2019
Senior Member
both luajit 2.05 stable version and luajit 2.1 beta3 had this problem
Re: LuaJit in windows in ok but under raspiberry can't [message #1819638 is a reply to message #1819637] Mon, 20 January 2020 05:03 Go to previous messageGo to next message
joy woo is currently offline joy wooFriend
Messages: 198
Registered: May 2019
Senior Member
I found the reason after 10 hours working.
line 286
elseif AEI_timeOut_TimeOut == id and (VAR_Stop < 1) then return enterECC_Forwarding2(fb)

i think when converting to lua, the () is missing
Re: LuaJit in windows in ok but under raspiberry can't [message #1820988 is a reply to message #1819638] Tue, 04 February 2020 07:34 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 199
Registered: February 2016
Senior Member
Hi,

Sorry for the late response. But it seems that the problem is in the generator? Where do you see the missing ()? and how is it that the compiler in windows doesn't see this as an error?

Regards,

Jose Cabral
Re: LuaJit in windows in ok but under raspiberry can't [message #1821018 is a reply to message #1820988] Tue, 04 February 2020 15:16 Go to previous messageGo to next message
joy woo is currently offline joy wooFriend
Messages: 198
Registered: May 2019
Senior Member
it's under raspberry with poxis architecture.
it's stange, i have two raspberry devices, one with the older version(development enviroment), one is the newer version(product enviroment).
when deploying with dynamic load, the older version deploys fine, but the newer version of raspberry os always crashed(only this custom FB above, the others can be ok),
that drives me crazy.



Re: LuaJit in windows in ok but under raspiberry can't [message #1821073 is a reply to message #1821018] Wed, 05 February 2020 07:53 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 199
Registered: February 2016
Senior Member
what do you mean with developmemt and product environment? Two versions of forte? which ones?

or are you using different versions of Lua?
Re: LuaJit in windows in ok but under raspiberry can't [message #1821121 is a reply to message #1821073] Thu, 06 February 2020 03:08 Go to previous message
joy woo is currently offline joy wooFriend
Messages: 198
Registered: May 2019
Senior Member
develepment device i use to build forte with codeblocks/codelite with which i can debug the error,
product device is only for deployment. but they have different versions of raspberry os
i use 1.10 because the modbus moduble can only build under 1.10(for the timer justify in 1.11)
both device use the latest version of luajit beta3
i know it's difficult to find out the reason according to the information i provide.
i think maybe i should simulate a single FB xml deploy to the forte, avoid multiple thread interrupting
i will debug it, try to find out the reason.

I think maybe forte need to more log levels to give the more information.
Previous Topic:Watching and Monitoring of Composite FBs
Next Topic:4Diac-Arrowhead framework
Goto Forum:
  


Current Time: Thu Apr 25 06:45:06 GMT 2024

Powered by FUDForum. Page generated in 0.03479 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top