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 |
joy woo 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}
|
|
| | | | | | |
Goto Forum:
Current Time: Thu Sep 26 19:06:39 GMT 2024
Powered by FUDForum. Page generated in 0.04169 seconds
|