Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
osie
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
osie
Commits
4067ea59
Commit
4067ea59
authored
Nov 01, 2021
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a multiple MOD-IO's PLC program.
parent
532da4c8
Changes
20
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
3045 additions
and
0 deletions
+3045
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/beremiz.xml
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/beremiz.xml
+4
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/LOCATED_VARIABLES.h
...utorial_multiple_mod_ios_opc_ua/build/LOCATED_VARIABLES.h
+8
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/POUS.c
...miz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/POUS.c
+301
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/POUS.h
...miz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/POUS.h
+147
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/VARIABLES.csv
...emiz_tutorial_multiple_mod_ios_opc_ua/build/VARIABLES.csv
+38
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/beremiz.h
.../beremiz_tutorial_multiple_mod_ios_opc_ua/build/beremiz.h
+35
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/config.c
...z/beremiz_tutorial_multiple_mod_ios_opc_ua/build/config.c
+62
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/config.h
...z/beremiz_tutorial_multiple_mod_ios_opc_ua/build/config.h
+11
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/generated_plc.st
...z_tutorial_multiple_mod_ios_opc_ua/build/generated_plc.st
+96
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/lastbuildPLC.md5
...z_tutorial_multiple_mod_ios_opc_ua/build/lastbuildPLC.md5
+1
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/opcua_client__1.c
..._tutorial_multiple_mod_ios_opc_ua/build/opcua_client__1.c
+147
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/plc.st
...miz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/plc.st
+190
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/plc_debugger.c
...miz_tutorial_multiple_mod_ios_opc_ua/build/plc_debugger.c
+427
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/plc_main.c
...beremiz_tutorial_multiple_mod_ios_opc_ua/build/plc_main.c
+951
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/py_ext.c
...z/beremiz_tutorial_multiple_mod_ios_opc_ua/build/py_ext.c
+221
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/resource1.c
...eremiz_tutorial_multiple_mod_ios_opc_ua/build/resource1.c
+37
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/opcua_0@opcua/baseconfnode.xml
...al_multiple_mod_ios_opc_ua/opcua_0@opcua/baseconfnode.xml
+2
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/opcua_0@opcua/confnode.xml
...torial_multiple_mod_ios_opc_ua/opcua_0@opcua/confnode.xml
+2
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/opcua_0@opcua/selected.csv
...torial_multiple_mod_ios_opc_ua/opcua_0@opcua/selected.csv
+16
-0
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/plc.xml
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/plc.xml
+349
-0
No files found.
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/beremiz.xml
0 → 100644
View file @
4067ea59
<?xml version='1.0' encoding='utf-8'?>
<BeremizRoot
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
URI_location=
"LOCAL://"
>
<TargetType/>
</BeremizRoot>
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/LOCATED_VARIABLES.h
0 → 100644
View file @
4067ea59
__LOCATED_VAR
(
DINT
,
__QD1_0
,
Q
,
D
,
1
,
0
)
__LOCATED_VAR
(
DINT
,
__QD1_1
,
Q
,
D
,
1
,
1
)
__LOCATED_VAR
(
DINT
,
__QD1_2
,
Q
,
D
,
1
,
2
)
__LOCATED_VAR
(
DINT
,
__QD1_3
,
Q
,
D
,
1
,
3
)
__LOCATED_VAR
(
DINT
,
__QD1_4
,
Q
,
D
,
1
,
4
)
__LOCATED_VAR
(
DINT
,
__QD1_5
,
Q
,
D
,
1
,
5
)
__LOCATED_VAR
(
DINT
,
__QD1_6
,
Q
,
D
,
1
,
6
)
__LOCATED_VAR
(
DINT
,
__QD1_7
,
Q
,
D
,
1
,
7
)
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/POUS.c
0 → 100644
View file @
4067ea59
void
LOGGER_init__
(
LOGGER
*
data__
,
BOOL
retain
)
{
__INIT_VAR
(
data__
->
EN
,
__BOOL_LITERAL
(
TRUE
),
retain
)
__INIT_VAR
(
data__
->
ENO
,
__BOOL_LITERAL
(
TRUE
),
retain
)
__INIT_VAR
(
data__
->
TRIG
,
__BOOL_LITERAL
(
FALSE
),
retain
)
__INIT_VAR
(
data__
->
MSG
,
__STRING_LITERAL
(
0
,
""
),
retain
)
__INIT_VAR
(
data__
->
LEVEL
,
LOGLEVEL__INFO
,
retain
)
__INIT_VAR
(
data__
->
TRIG0
,
__BOOL_LITERAL
(
FALSE
),
retain
)
}
// Code part
void
LOGGER_body__
(
LOGGER
*
data__
)
{
// Control execution
if
(
!
__GET_VAR
(
data__
->
EN
))
{
__SET_VAR
(
data__
->
,
ENO
,,
__BOOL_LITERAL
(
FALSE
));
return
;
}
else
{
__SET_VAR
(
data__
->
,
ENO
,,
__BOOL_LITERAL
(
TRUE
));
}
// Initialise TEMP variables
if
((
__GET_VAR
(
data__
->
TRIG
,)
&&
!
(
__GET_VAR
(
data__
->
TRIG0
,))))
{
#define GetFbVar(var,...) __GET_VAR(data__->var,__VA_ARGS__)
#define SetFbVar(var,val,...) __SET_VAR(data__->,var,__VA_ARGS__,val)
LogMessage
(
GetFbVar
(
LEVEL
),(
char
*
)
GetFbVar
(
MSG
,
.
body
),
GetFbVar
(
MSG
,
.
len
));
#undef GetFbVar
#undef SetFbVar
;
};
__SET_VAR
(
data__
->
,
TRIG0
,,
__GET_VAR
(
data__
->
TRIG
,));
goto
__end
;
__end:
return
;
}
// LOGGER_body__()
void
PYTHON_EVAL_init__
(
PYTHON_EVAL
*
data__
,
BOOL
retain
)
{
__INIT_VAR
(
data__
->
EN
,
__BOOL_LITERAL
(
TRUE
),
retain
)
__INIT_VAR
(
data__
->
ENO
,
__BOOL_LITERAL
(
TRUE
),
retain
)
__INIT_VAR
(
data__
->
TRIG
,
__BOOL_LITERAL
(
FALSE
),
retain
)
__INIT_VAR
(
data__
->
CODE
,
__STRING_LITERAL
(
0
,
""
),
retain
)
__INIT_VAR
(
data__
->
ACK
,
__BOOL_LITERAL
(
FALSE
),
retain
)
__INIT_VAR
(
data__
->
RESULT
,
__STRING_LITERAL
(
0
,
""
),
retain
)
__INIT_VAR
(
data__
->
STATE
,
0
,
retain
)
__INIT_VAR
(
data__
->
BUFFER
,
__STRING_LITERAL
(
0
,
""
),
retain
)
__INIT_VAR
(
data__
->
PREBUFFER
,
__STRING_LITERAL
(
0
,
""
),
retain
)
__INIT_VAR
(
data__
->
TRIGM1
,
__BOOL_LITERAL
(
FALSE
),
retain
)
__INIT_VAR
(
data__
->
TRIGGED
,
__BOOL_LITERAL
(
FALSE
),
retain
)
}
// Code part
void
PYTHON_EVAL_body__
(
PYTHON_EVAL
*
data__
)
{
// Control execution
if
(
!
__GET_VAR
(
data__
->
EN
))
{
__SET_VAR
(
data__
->
,
ENO
,,
__BOOL_LITERAL
(
FALSE
));
return
;
}
else
{
__SET_VAR
(
data__
->
,
ENO
,,
__BOOL_LITERAL
(
TRUE
));
}
// Initialise TEMP variables
__IL_DEFVAR_T
__IL_DEFVAR
;
__IL_DEFVAR_T
__IL_DEFVAR_BACK
;
#define GetFbVar(var,...) __GET_VAR(data__->var,__VA_ARGS__)
#define SetFbVar(var,val,...) __SET_VAR(data__->,var,__VA_ARGS__,val)
extern
void
__PythonEvalFB
(
int
,
PYTHON_EVAL
*
);
__PythonEvalFB
(
0
,
data__
);
#undef GetFbVar
#undef SetFbVar
;
goto
__end
;
__end:
return
;
}
// PYTHON_EVAL_body__()
void
PYTHON_POLL_init__
(
PYTHON_POLL
*
data__
,
BOOL
retain
)
{
__INIT_VAR
(
data__
->
EN
,
__BOOL_LITERAL
(
TRUE
),
retain
)
__INIT_VAR
(
data__
->
ENO
,
__BOOL_LITERAL
(
TRUE
),
retain
)
__INIT_VAR
(
data__
->
TRIG
,
__BOOL_LITERAL
(
FALSE
),
retain
)
__INIT_VAR
(
data__
->
CODE
,
__STRING_LITERAL
(
0
,
""
),
retain
)
__INIT_VAR
(
data__
->
ACK
,
__BOOL_LITERAL
(
FALSE
),
retain
)
__INIT_VAR
(
data__
->
RESULT
,
__STRING_LITERAL
(
0
,
""
),
retain
)
__INIT_VAR
(
data__
->
STATE
,
0
,
retain
)
__INIT_VAR
(
data__
->
BUFFER
,
__STRING_LITERAL
(
0
,
""
),
retain
)
__INIT_VAR
(
data__
->
PREBUFFER
,
__STRING_LITERAL
(
0
,
""
),
retain
)
__INIT_VAR
(
data__
->
TRIGM1
,
__BOOL_LITERAL
(
FALSE
),
retain
)
__INIT_VAR
(
data__
->
TRIGGED
,
__BOOL_LITERAL
(
FALSE
),
retain
)
}
// Code part
void
PYTHON_POLL_body__
(
PYTHON_POLL
*
data__
)
{
// Control execution
if
(
!
__GET_VAR
(
data__
->
EN
))
{
__SET_VAR
(
data__
->
,
ENO
,,
__BOOL_LITERAL
(
FALSE
));
return
;
}
else
{
__SET_VAR
(
data__
->
,
ENO
,,
__BOOL_LITERAL
(
TRUE
));
}
// Initialise TEMP variables
__IL_DEFVAR_T
__IL_DEFVAR
;
__IL_DEFVAR_T
__IL_DEFVAR_BACK
;
#define GetFbVar(var,...) __GET_VAR(data__->var,__VA_ARGS__)
#define SetFbVar(var,val,...) __SET_VAR(data__->,var,__VA_ARGS__,val)
extern
void
__PythonEvalFB
(
int
,
PYTHON_EVAL
*
);
__PythonEvalFB
(
1
,(
PYTHON_EVAL
*
)(
void
*
)
data__
);
#undef GetFbVar
#undef SetFbVar
;
goto
__end
;
__end:
return
;
}
// PYTHON_POLL_body__()
void
PYTHON_GEAR_init__
(
PYTHON_GEAR
*
data__
,
BOOL
retain
)
{
__INIT_VAR
(
data__
->
EN
,
__BOOL_LITERAL
(
TRUE
),
retain
)
__INIT_VAR
(
data__
->
ENO
,
__BOOL_LITERAL
(
TRUE
),
retain
)
__INIT_VAR
(
data__
->
N
,
0
,
retain
)
__INIT_VAR
(
data__
->
TRIG
,
__BOOL_LITERAL
(
FALSE
),
retain
)
__INIT_VAR
(
data__
->
CODE
,
__STRING_LITERAL
(
0
,
""
),
retain
)
__INIT_VAR
(
data__
->
ACK
,
__BOOL_LITERAL
(
FALSE
),
retain
)
__INIT_VAR
(
data__
->
RESULT
,
__STRING_LITERAL
(
0
,
""
),
retain
)
PYTHON_EVAL_init__
(
&
data__
->
PY_EVAL
,
retain
);
__INIT_VAR
(
data__
->
COUNTER
,
0
,
retain
)
__INIT_VAR
(
data__
->
_TMP_ADD10_OUT
,
0
,
retain
)
__INIT_VAR
(
data__
->
_TMP_EQ13_OUT
,
__BOOL_LITERAL
(
FALSE
),
retain
)
__INIT_VAR
(
data__
->
_TMP_SEL15_OUT
,
0
,
retain
)
__INIT_VAR
(
data__
->
_TMP_AND7_OUT
,
__BOOL_LITERAL
(
FALSE
),
retain
)
}
// Code part
void
PYTHON_GEAR_body__
(
PYTHON_GEAR
*
data__
)
{
// Control execution
if
(
!
__GET_VAR
(
data__
->
EN
))
{
__SET_VAR
(
data__
->
,
ENO
,,
__BOOL_LITERAL
(
FALSE
));
return
;
}
else
{
__SET_VAR
(
data__
->
,
ENO
,,
__BOOL_LITERAL
(
TRUE
));
}
// Initialise TEMP variables
__SET_VAR
(
data__
->
,
_TMP_ADD10_OUT
,,
ADD__UINT__UINT
(
(
BOOL
)
__BOOL_LITERAL
(
TRUE
),
NULL
,
(
UINT
)
2
,
(
UINT
)
__GET_VAR
(
data__
->
COUNTER
,),
(
UINT
)
1
));
__SET_VAR
(
data__
->
,
_TMP_EQ13_OUT
,,
EQ__BOOL__UINT
(
(
BOOL
)
__BOOL_LITERAL
(
TRUE
),
NULL
,
(
UINT
)
2
,
(
UINT
)
__GET_VAR
(
data__
->
N
,),
(
UINT
)
__GET_VAR
(
data__
->
_TMP_ADD10_OUT
,)));
__SET_VAR
(
data__
->
,
_TMP_SEL15_OUT
,,
SEL__UINT__BOOL__UINT__UINT
(
(
BOOL
)
__BOOL_LITERAL
(
TRUE
),
NULL
,
(
BOOL
)
__GET_VAR
(
data__
->
_TMP_EQ13_OUT
,),
(
UINT
)
__GET_VAR
(
data__
->
_TMP_ADD10_OUT
,),
(
UINT
)
0
));
__SET_VAR
(
data__
->
,
COUNTER
,,
__GET_VAR
(
data__
->
_TMP_SEL15_OUT
,));
__SET_VAR
(
data__
->
,
_TMP_AND7_OUT
,,
AND__BOOL__BOOL
(
(
BOOL
)
__BOOL_LITERAL
(
TRUE
),
NULL
,
(
UINT
)
2
,
(
BOOL
)
__GET_VAR
(
data__
->
_TMP_EQ13_OUT
,),
(
BOOL
)
__GET_VAR
(
data__
->
TRIG
,)));
__SET_VAR
(
data__
->
PY_EVAL
.,
TRIG
,,
__GET_VAR
(
data__
->
_TMP_AND7_OUT
,));
__SET_VAR
(
data__
->
PY_EVAL
.,
CODE
,,
__GET_VAR
(
data__
->
CODE
,));
PYTHON_EVAL_body__
(
&
data__
->
PY_EVAL
);
__SET_VAR
(
data__
->
,
ACK
,,
__GET_VAR
(
data__
->
PY_EVAL
.
ACK
,));
__SET_VAR
(
data__
->
,
RESULT
,,
__GET_VAR
(
data__
->
PY_EVAL
.
RESULT
,));
goto
__end
;
__end:
return
;
}
// PYTHON_GEAR_body__()
void
COUNTERST_init__
(
COUNTERST
*
data__
,
BOOL
retain
)
{
__INIT_VAR
(
data__
->
EN
,
__BOOL_LITERAL
(
TRUE
),
retain
)
__INIT_VAR
(
data__
->
ENO
,
__BOOL_LITERAL
(
TRUE
),
retain
)
__INIT_VAR
(
data__
->
RESET
,
__BOOL_LITERAL
(
FALSE
),
retain
)
__INIT_VAR
(
data__
->
OUT1
,
0
,
retain
)
__INIT_VAR
(
data__
->
OUT0
,
0
,
retain
)
__INIT_VAR
(
data__
->
CNT1
,
0
,
retain
)
__INIT_VAR
(
data__
->
CNT0
,
0
,
retain
)
__INIT_EXTERNAL
(
INT
,
RESETCOUNTERVALUE
,
data__
->
RESETCOUNTERVALUE
,
retain
)
__INIT_EXTERNAL
(
DINT
,
RELAY0
,
data__
->
RELAY0
,
retain
)
__INIT_EXTERNAL
(
DINT
,
RELAY1
,
data__
->
RELAY1
,
retain
)
__INIT_EXTERNAL
(
DINT
,
RELAY2
,
data__
->
RELAY2
,
retain
)
__INIT_EXTERNAL
(
DINT
,
RELAY3
,
data__
->
RELAY3
,
retain
)
__INIT_EXTERNAL
(
DINT
,
RELAY4
,
data__
->
RELAY4
,
retain
)
__INIT_EXTERNAL
(
DINT
,
RELAY5
,
data__
->
RELAY5
,
retain
)
__INIT_EXTERNAL
(
DINT
,
RELAY6
,
data__
->
RELAY6
,
retain
)
__INIT_EXTERNAL
(
DINT
,
RELAY7
,
data__
->
RELAY7
,
retain
)
}
// Code part
void
COUNTERST_body__
(
COUNTERST
*
data__
)
{
// Control execution
if
(
!
__GET_VAR
(
data__
->
EN
))
{
__SET_VAR
(
data__
->
,
ENO
,,
__BOOL_LITERAL
(
FALSE
));
return
;
}
else
{
__SET_VAR
(
data__
->
,
ENO
,,
__BOOL_LITERAL
(
TRUE
));
}
// Initialise TEMP variables
if
(
__GET_VAR
(
data__
->
RESET
,))
{
__SET_VAR
(
data__
->
,
CNT0
,,
__GET_EXTERNAL
(
data__
->
RESETCOUNTERVALUE
,));
__SET_VAR
(
data__
->
,
CNT1
,,
__GET_EXTERNAL
(
data__
->
RESETCOUNTERVALUE
,));
__SET_VAR
(
data__
->
,
RESET
,,
__BOOL_LITERAL
(
FALSE
));
}
else
{
__SET_VAR
(
data__
->
,
CNT0
,,(
__GET_VAR
(
data__
->
CNT0
,)
+
1
));
__SET_VAR
(
data__
->
,
CNT1
,,(
__GET_VAR
(
data__
->
CNT1
,)
+
1
));
if
((
__GET_VAR
(
data__
->
CNT1
,)
==
50
))
{
__SET_EXTERNAL
(
data__
->
,
RELAY0
,,
1
);
__SET_EXTERNAL
(
data__
->
,
RELAY1
,,
1
);
__SET_EXTERNAL
(
data__
->
,
RELAY2
,,
1
);
__SET_EXTERNAL
(
data__
->
,
RELAY3
,,
1
);
__SET_EXTERNAL
(
data__
->
,
RELAY4
,,
1
);
__SET_EXTERNAL
(
data__
->
,
RELAY5
,,
1
);
__SET_EXTERNAL
(
data__
->
,
RELAY6
,,
1
);
__SET_EXTERNAL
(
data__
->
,
RELAY7
,,
1
);
};
if
((
__GET_VAR
(
data__
->
CNT1
,)
==
100
))
{
__SET_EXTERNAL
(
data__
->
,
RELAY0
,,
0
);
__SET_EXTERNAL
(
data__
->
,
RELAY1
,,
0
);
__SET_EXTERNAL
(
data__
->
,
RELAY2
,,
0
);
__SET_EXTERNAL
(
data__
->
,
RELAY3
,,
0
);
__SET_EXTERNAL
(
data__
->
,
RELAY4
,,
0
);
__SET_EXTERNAL
(
data__
->
,
RELAY5
,,
0
);
__SET_EXTERNAL
(
data__
->
,
RELAY6
,,
0
);
__SET_EXTERNAL
(
data__
->
,
RELAY7
,,
0
);
__SET_VAR
(
data__
->
,
CNT1
,,
0
);
};
};
__SET_VAR
(
data__
->
,
OUT1
,,
__GET_VAR
(
data__
->
CNT1
,));
__SET_VAR
(
data__
->
,
OUT0
,,
__GET_VAR
(
data__
->
CNT0
,));
goto
__end
;
__end:
return
;
}
// COUNTERST_body__()
void
PLC_PRG_init__
(
PLC_PRG
*
data__
,
BOOL
retain
)
{
__INIT_VAR
(
data__
->
RESET
,
__BOOL_LITERAL
(
FALSE
),
retain
)
__INIT_VAR
(
data__
->
CNT0
,
0
,
retain
)
__INIT_VAR
(
data__
->
CNT1
,
0
,
retain
)
COUNTERST_init__
(
&
data__
->
COUNTERST0
,
retain
);
}
// Code part
void
PLC_PRG_body__
(
PLC_PRG
*
data__
)
{
// Initialise TEMP variables
__SET_VAR
(
data__
->
COUNTERST0
.,
RESET
,,
__GET_VAR
(
data__
->
RESET
,));
COUNTERST_body__
(
&
data__
->
COUNTERST0
);
__SET_VAR
(
data__
->
,
CNT1
,,
__GET_VAR
(
data__
->
COUNTERST0
.
OUT1
,));
__SET_VAR
(
data__
->
,
CNT0
,,
__GET_VAR
(
data__
->
COUNTERST0
.
OUT0
,));
goto
__end
;
__end:
return
;
}
// PLC_PRG_body__()
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/POUS.h
0 → 100644
View file @
4067ea59
#include "beremiz.h"
#ifndef __POUS_H
#define __POUS_H
#include "accessor.h"
#include "iec_std_lib.h"
__DECLARE_ENUMERATED_TYPE
(
LOGLEVEL
,
LOGLEVEL__CRITICAL
,
LOGLEVEL__WARNING
,
LOGLEVEL__INFO
,
LOGLEVEL__DEBUG
)
// FUNCTION_BLOCK LOGGER
// Data part
typedef
struct
{
// FB Interface - IN, OUT, IN_OUT variables
__DECLARE_VAR
(
BOOL
,
EN
)
__DECLARE_VAR
(
BOOL
,
ENO
)
__DECLARE_VAR
(
BOOL
,
TRIG
)
__DECLARE_VAR
(
STRING
,
MSG
)
__DECLARE_VAR
(
LOGLEVEL
,
LEVEL
)
// FB private variables - TEMP, private and located variables
__DECLARE_VAR
(
BOOL
,
TRIG0
)
}
LOGGER
;
void
LOGGER_init__
(
LOGGER
*
data__
,
BOOL
retain
);
// Code part
void
LOGGER_body__
(
LOGGER
*
data__
);
// FUNCTION_BLOCK PYTHON_EVAL
// Data part
typedef
struct
{
// FB Interface - IN, OUT, IN_OUT variables
__DECLARE_VAR
(
BOOL
,
EN
)
__DECLARE_VAR
(
BOOL
,
ENO
)
__DECLARE_VAR
(
BOOL
,
TRIG
)
__DECLARE_VAR
(
STRING
,
CODE
)
__DECLARE_VAR
(
BOOL
,
ACK
)
__DECLARE_VAR
(
STRING
,
RESULT
)
// FB private variables - TEMP, private and located variables
__DECLARE_VAR
(
DWORD
,
STATE
)
__DECLARE_VAR
(
STRING
,
BUFFER
)
__DECLARE_VAR
(
STRING
,
PREBUFFER
)
__DECLARE_VAR
(
BOOL
,
TRIGM1
)
__DECLARE_VAR
(
BOOL
,
TRIGGED
)
}
PYTHON_EVAL
;
void
PYTHON_EVAL_init__
(
PYTHON_EVAL
*
data__
,
BOOL
retain
);
// Code part
void
PYTHON_EVAL_body__
(
PYTHON_EVAL
*
data__
);
// FUNCTION_BLOCK PYTHON_POLL
// Data part
typedef
struct
{
// FB Interface - IN, OUT, IN_OUT variables
__DECLARE_VAR
(
BOOL
,
EN
)
__DECLARE_VAR
(
BOOL
,
ENO
)
__DECLARE_VAR
(
BOOL
,
TRIG
)
__DECLARE_VAR
(
STRING
,
CODE
)
__DECLARE_VAR
(
BOOL
,
ACK
)
__DECLARE_VAR
(
STRING
,
RESULT
)
// FB private variables - TEMP, private and located variables
__DECLARE_VAR
(
DWORD
,
STATE
)
__DECLARE_VAR
(
STRING
,
BUFFER
)
__DECLARE_VAR
(
STRING
,
PREBUFFER
)
__DECLARE_VAR
(
BOOL
,
TRIGM1
)
__DECLARE_VAR
(
BOOL
,
TRIGGED
)
}
PYTHON_POLL
;
void
PYTHON_POLL_init__
(
PYTHON_POLL
*
data__
,
BOOL
retain
);
// Code part
void
PYTHON_POLL_body__
(
PYTHON_POLL
*
data__
);
// FUNCTION_BLOCK PYTHON_GEAR
// Data part
typedef
struct
{
// FB Interface - IN, OUT, IN_OUT variables
__DECLARE_VAR
(
BOOL
,
EN
)
__DECLARE_VAR
(
BOOL
,
ENO
)
__DECLARE_VAR
(
UINT
,
N
)
__DECLARE_VAR
(
BOOL
,
TRIG
)
__DECLARE_VAR
(
STRING
,
CODE
)
__DECLARE_VAR
(
BOOL
,
ACK
)
__DECLARE_VAR
(
STRING
,
RESULT
)
// FB private variables - TEMP, private and located variables
PYTHON_EVAL
PY_EVAL
;
__DECLARE_VAR
(
UINT
,
COUNTER
)
__DECLARE_VAR
(
UINT
,
_TMP_ADD10_OUT
)
__DECLARE_VAR
(
BOOL
,
_TMP_EQ13_OUT
)
__DECLARE_VAR
(
UINT
,
_TMP_SEL15_OUT
)
__DECLARE_VAR
(
BOOL
,
_TMP_AND7_OUT
)
}
PYTHON_GEAR
;
void
PYTHON_GEAR_init__
(
PYTHON_GEAR
*
data__
,
BOOL
retain
);
// Code part
void
PYTHON_GEAR_body__
(
PYTHON_GEAR
*
data__
);
// FUNCTION_BLOCK COUNTERST
// Data part
typedef
struct
{
// FB Interface - IN, OUT, IN_OUT variables
__DECLARE_VAR
(
BOOL
,
EN
)
__DECLARE_VAR
(
BOOL
,
ENO
)
__DECLARE_VAR
(
BOOL
,
RESET
)
__DECLARE_VAR
(
INT
,
OUT1
)
__DECLARE_VAR
(
INT
,
OUT0
)
// FB private variables - TEMP, private and located variables
__DECLARE_VAR
(
INT
,
CNT1
)
__DECLARE_VAR
(
INT
,
CNT0
)
__DECLARE_EXTERNAL
(
INT
,
RESETCOUNTERVALUE
)
__DECLARE_EXTERNAL
(
DINT
,
RELAY0
)
__DECLARE_EXTERNAL
(
DINT
,
RELAY1
)
__DECLARE_EXTERNAL
(
DINT
,
RELAY2
)
__DECLARE_EXTERNAL
(
DINT
,
RELAY3
)
__DECLARE_EXTERNAL
(
DINT
,
RELAY4
)
__DECLARE_EXTERNAL
(
DINT
,
RELAY5
)
__DECLARE_EXTERNAL
(
DINT
,
RELAY6
)
__DECLARE_EXTERNAL
(
DINT
,
RELAY7
)
}
COUNTERST
;
void
COUNTERST_init__
(
COUNTERST
*
data__
,
BOOL
retain
);
// Code part
void
COUNTERST_body__
(
COUNTERST
*
data__
);
// PROGRAM PLC_PRG
// Data part
typedef
struct
{
// PROGRAM Interface - IN, OUT, IN_OUT variables
__DECLARE_VAR
(
BOOL
,
RESET
)
__DECLARE_VAR
(
INT
,
CNT0
)
__DECLARE_VAR
(
INT
,
CNT1
)
// PROGRAM private variables - TEMP, private and located variables
COUNTERST
COUNTERST0
;
}
PLC_PRG
;
void
PLC_PRG_init__
(
PLC_PRG
*
data__
,
BOOL
retain
);
// Code part
void
PLC_PRG_body__
(
PLC_PRG
*
data__
);
#endif //__POUS_H
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/VARIABLES.csv
0 → 100644
View file @
4067ea59
// Programs
0;CONFIG.RESOURCE1.INSTANCE0;PLC_PRG;
// Variables
0;VAR;CONFIG.RESETCOUNTERVALUE;CONFIG.RESETCOUNTERVALUE;INT;INT;
1;OUT;CONFIG.RELAY0;CONFIG.RELAY0;DINT;DINT;
2;OUT;CONFIG.RELAY1;CONFIG.RELAY1;DINT;DINT;
3;OUT;CONFIG.RELAY2;CONFIG.RELAY2;DINT;DINT;
4;OUT;CONFIG.RELAY3;CONFIG.RELAY3;DINT;DINT;
5;OUT;CONFIG.RELAY4;CONFIG.RELAY4;DINT;DINT;
6;OUT;CONFIG.RELAY5;CONFIG.RELAY5;DINT;DINT;
7;OUT;CONFIG.RELAY6;CONFIG.RELAY6;DINT;DINT;
8;OUT;CONFIG.RELAY7;CONFIG.RELAY7;DINT;DINT;
9;FB;CONFIG.RESOURCE1.INSTANCE0;CONFIG.RESOURCE1.INSTANCE0;PLC_PRG;;
10;VAR;CONFIG.RESOURCE1.INSTANCE0.RESET;CONFIG.RESOURCE1.INSTANCE0.RESET;BOOL;BOOL;
11;VAR;CONFIG.RESOURCE1.INSTANCE0.CNT0;CONFIG.RESOURCE1.INSTANCE0.CNT0;INT;INT;
12;VAR;CONFIG.RESOURCE1.INSTANCE0.CNT1;CONFIG.RESOURCE1.INSTANCE0.CNT1;INT;INT;
13;FB;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0;COUNTERST;;
14;VAR;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.EN;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.EN;BOOL;BOOL;
15;VAR;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.ENO;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.ENO;BOOL;BOOL;
16;VAR;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RESET;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RESET;BOOL;BOOL;
17;VAR;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.OUT1;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.OUT1;INT;INT;
18;VAR;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.OUT0;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.OUT0;INT;INT;
19;VAR;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.CNT1;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.CNT1;INT;INT;
20;VAR;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.CNT0;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.CNT0;INT;INT;
21;EXT;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RESETCOUNTERVALUE;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RESETCOUNTERVALUE;INT;INT;
22;EXT;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY0;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY0;DINT;DINT;
23;EXT;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY1;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY1;DINT;DINT;
24;EXT;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY2;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY2;DINT;DINT;
25;EXT;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY3;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY3;DINT;DINT;
26;EXT;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY4;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY4;DINT;DINT;
27;EXT;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY5;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY5;DINT;DINT;
28;EXT;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY6;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY6;DINT;DINT;
29;EXT;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY7;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY7;DINT;DINT;
// Ticktime
20000000
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/beremiz.h
0 → 100644
View file @
4067ea59
#ifndef _BEREMIZ_H_
#define _BEREMIZ_H_
/* Beremiz' header file for use by extensions */
#include "iec_types.h"
#define LOG_LEVELS 4
#define LOG_CRITICAL 0
#define LOG_WARNING 1
#define LOG_INFO 2
#define LOG_DEBUG 3
extern
unsigned
long
long
common_ticktime__
;
#ifdef TARGET_LOGGING_DISABLE
static
inline
int
LogMessage
(
uint8_t
level
,
char
*
buf
,
uint32_t
size
)
{
(
void
)
level
;
(
void
)
buf
;
(
void
)
size
;
return
0
;
}
#else
int
LogMessage
(
uint8_t
level
,
char
*
buf
,
uint32_t
size
);
#endif
long
AtomicCompareExchange
(
long
*
atomicvar
,
long
compared
,
long
exchange
);
void
*
create_RT_to_nRT_signal
(
char
*
name
);
void
delete_RT_to_nRT_signal
(
void
*
handle
);
int
wait_RT_to_nRT_signal
(
void
*
handle
);
int
unblock_RT_to_nRT_signal
(
void
*
handle
);
void
nRT_reschedule
(
void
);
#endif
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/config.c
0 → 100644
View file @
4067ea59
/*******************************************/
/* FILE GENERATED BY iec2c */
/* Editing this file is not recommended... */
/*******************************************/
#include "iec_std_lib.h"
#include "accessor.h"
#include "POUS.h"
// CONFIGURATION CONFIG
__DECLARE_GLOBAL
(
INT
,
CONFIG
,
RESETCOUNTERVALUE
)
__DECLARE_GLOBAL_LOCATION
(
DINT
,
__QD1_0
)
__DECLARE_GLOBAL_LOCATED
(
DINT
,
CONFIG
,
RELAY0
)
__DECLARE_GLOBAL_LOCATION
(
DINT
,
__QD1_1
)
__DECLARE_GLOBAL_LOCATED
(
DINT
,
CONFIG
,
RELAY1
)
__DECLARE_GLOBAL_LOCATION
(
DINT
,
__QD1_2
)
__DECLARE_GLOBAL_LOCATED
(
DINT
,
CONFIG
,
RELAY2
)
__DECLARE_GLOBAL_LOCATION
(
DINT
,
__QD1_3
)
__DECLARE_GLOBAL_LOCATED
(
DINT
,
CONFIG
,
RELAY3
)
__DECLARE_GLOBAL_LOCATION
(
DINT
,
__QD1_4
)
__DECLARE_GLOBAL_LOCATED
(
DINT
,
CONFIG
,
RELAY4
)
__DECLARE_GLOBAL_LOCATION
(
DINT
,
__QD1_5
)
__DECLARE_GLOBAL_LOCATED
(
DINT
,
CONFIG
,
RELAY5
)
__DECLARE_GLOBAL_LOCATION
(
DINT
,
__QD1_6
)
__DECLARE_GLOBAL_LOCATED
(
DINT
,
CONFIG
,
RELAY6
)
__DECLARE_GLOBAL_LOCATION
(
DINT
,
__QD1_7
)
__DECLARE_GLOBAL_LOCATED
(
DINT
,
CONFIG
,
RELAY7
)
void
RESOURCE1_init__
(
void
);
void
config_init__
(
void
)
{
BOOL
retain
;
retain
=
0
;
__INIT_GLOBAL
(
INT
,
RESETCOUNTERVALUE
,
__INITIAL_VALUE
(
0
),
retain
)
__INIT_GLOBAL_LOCATED
(
CONFIG
,
RELAY0
,
__QD1_0
,
retain
)
__INIT_GLOBAL
(
DINT
,
RELAY0
,
__INITIAL_VALUE
(
0
),
retain
)
__INIT_GLOBAL_LOCATED
(
CONFIG
,
RELAY1
,
__QD1_1
,
retain
)
__INIT_GLOBAL
(
DINT
,
RELAY1
,
__INITIAL_VALUE
(
0
),
retain
)
__INIT_GLOBAL_LOCATED
(
CONFIG
,
RELAY2
,
__QD1_2
,
retain
)
__INIT_GLOBAL
(
DINT
,
RELAY2
,
__INITIAL_VALUE
(
0
),
retain
)
__INIT_GLOBAL_LOCATED
(
CONFIG
,
RELAY3
,
__QD1_3
,
retain
)
__INIT_GLOBAL
(
DINT
,
RELAY3
,
__INITIAL_VALUE
(
0
),
retain
)
__INIT_GLOBAL_LOCATED
(
CONFIG
,
RELAY4
,
__QD1_4
,
retain
)
__INIT_GLOBAL
(
DINT
,
RELAY4
,
__INITIAL_VALUE
(
0
),
retain
)
__INIT_GLOBAL_LOCATED
(
CONFIG
,
RELAY5
,
__QD1_5
,
retain
)
__INIT_GLOBAL
(
DINT
,
RELAY5
,
__INITIAL_VALUE
(
0
),
retain
)
__INIT_GLOBAL_LOCATED
(
CONFIG
,
RELAY6
,
__QD1_6
,
retain
)
__INIT_GLOBAL
(
DINT
,
RELAY6
,
__INITIAL_VALUE
(
0
),
retain
)
__INIT_GLOBAL_LOCATED
(
CONFIG
,
RELAY7
,
__QD1_7
,
retain
)
__INIT_GLOBAL
(
DINT
,
RELAY7
,
__INITIAL_VALUE
(
0
),
retain
)
RESOURCE1_init__
();
}
void
RESOURCE1_run__
(
unsigned
long
tick
);
void
config_run__
(
unsigned
long
tick
)
{
RESOURCE1_run__
(
tick
);
}
unsigned
long
long
common_ticktime__
=
20000000ULL
*
1ULL
;
/*ns*/
unsigned
long
greatest_tick_count__
=
(
unsigned
long
)
0UL
;
/*tick*/
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/config.h
0 → 100644
View file @
4067ea59
#include "beremiz.h"
__DECLARE_GLOBAL_PROTOTYPE
(
INT
,
RESETCOUNTERVALUE
)
__DECLARE_GLOBAL_PROTOTYPE
(
DINT
,
RELAY0
)
__DECLARE_GLOBAL_PROTOTYPE
(
DINT
,
RELAY1
)
__DECLARE_GLOBAL_PROTOTYPE
(
DINT
,
RELAY2
)
__DECLARE_GLOBAL_PROTOTYPE
(
DINT
,
RELAY3
)
__DECLARE_GLOBAL_PROTOTYPE
(
DINT
,
RELAY4
)
__DECLARE_GLOBAL_PROTOTYPE
(
DINT
,
RELAY5
)
__DECLARE_GLOBAL_PROTOTYPE
(
DINT
,
RELAY6
)
__DECLARE_GLOBAL_PROTOTYPE
(
DINT
,
RELAY7
)
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/generated_plc.st
0 → 100644
View file @
4067ea59
FUNCTION_BLOCK
CounterST
VAR_INPUT
Reset
:
BOOL
;
END_VAR
VAR_OUTPUT
Out1
:
INT
;
Out0
:
INT
;
END_VAR
VAR
Cnt1
:
INT
;
Cnt0
:
INT
;
END_VAR
VAR_EXTERNAL
ResetCounterValue
:
INT
;
Relay0
:
DINT
;
Relay1
:
DINT
;
Relay2
:
DINT
;
Relay3
:
DINT
;
Relay4
:
DINT
;
Relay5
:
DINT
;
Relay6
:
DINT
;
Relay7
:
DINT
;
END_VAR
IF
Reset
THEN
Cnt0
:=
ResetCounterValue
;
Cnt1
:=
ResetCounterValue
;
Reset
:=
False
;
ELSE
Cnt0
:=
Cnt0
+
1
;
Cnt1
:=
Cnt1
+
1
;
IF
Cnt1
=
50
THEN
Relay0
:=
1
;
Relay1
:=
1
;
Relay2
:=
1
;
Relay3
:=
1
;
Relay4
:=
1
;
Relay5
:=
1
;
Relay6
:=
1
;
Relay7
:=
1
;
END_IF
;
IF
Cnt1
=
100
THEN
Relay0
:=
0
;
Relay1
:=
0
;
Relay2
:=
0
;
Relay3
:=
0
;
Relay4
:=
0
;
Relay5
:=
0
;
Relay6
:=
0
;
Relay7
:=
0
;
Cnt1
:=
0
;
END_IF
;
END_IF
;
Out1
:=
Cnt1
;
Out0
:=
Cnt0
;
END_FUNCTION_BLOCK
PROGRAM
plc_prg
VAR_INPUT
Reset
:
BOOL
;
END_VAR
VAR_OUTPUT
Cnt0
:
INT
;
Cnt1
:
INT
;
END_VAR
VAR
CounterST0
:
CounterST
;
END_VAR
CounterST0
(
Reset
:=
Reset
);
Cnt1
:=
CounterST0
.
Out1
;
Cnt0
:=
CounterST0
.
Out0
;
END_PROGRAM
CONFIGURATION
config
VAR_GLOBAL
ResetCounterValue
:
INT
:=
0
;
Relay0
AT
%
QD1
.
0
:
DINT
:=
0
;
Relay1
AT
%
QD1
.
1
:
DINT
:=
0
;
Relay2
AT
%
QD1
.
2
:
DINT
:=
0
;
Relay3
AT
%
QD1
.
3
:
DINT
:=
0
;
Relay4
AT
%
QD1
.
4
:
DINT
:=
0
;
Relay5
AT
%
QD1
.
5
:
DINT
:=
0
;
Relay6
AT
%
QD1
.
6
:
DINT
:=
0
;
Relay7
AT
%
QD1
.
7
:
DINT
:=
0
;
END_VAR
RESOURCE
resource1
ON
PLC
TASK
task0
(
INTERVAL
:=
T
#20ms
,
PRIORITY
:=
0
);
PROGRAM
instance0
WITH
task0
:
plc_prg
;
END_RESOURCE
END_CONFIGURATION
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/lastbuildPLC.md5
0 → 100644
View file @
4067ea59
d214b79e70d0232543aa4146a721fef2
\ No newline at end of file
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/opcua_client__1.c
0 → 100644
View file @
4067ea59
/* code generated by beremiz OPC-UA extension */
#include <open62541/client_config_default.h>
#include <open62541/client_highlevel.h>
#include <open62541/plugin/log_stdout.h>
UA_Client
*
client
;
#define DECL_VAR(ua_type, C_type, c_loc_name) \
UA_Variant *c_loc_name##_variant; \
C_type c_loc_name##_buf = 0; \
C_type *c_loc_name = &c_loc_name##_buf;
DECL_VAR
(
UA_Int32
,
uint32_t
,
__ID1_0
)
DECL_VAR
(
UA_Int32
,
uint32_t
,
__ID1_1
)
DECL_VAR
(
UA_Int32
,
uint32_t
,
__ID1_2
)
DECL_VAR
(
UA_Int32
,
uint32_t
,
__ID1_3
)
DECL_VAR
(
UA_Int32
,
uint32_t
,
__ID1_4
)
DECL_VAR
(
UA_Int32
,
uint32_t
,
__ID1_5
)
DECL_VAR
(
UA_Int32
,
uint32_t
,
__ID1_6
)
DECL_VAR
(
UA_Int32
,
uint32_t
,
__ID1_7
)
DECL_VAR
(
UA_Int32
,
uint32_t
,
__QD1_0
)
DECL_VAR
(
UA_Int32
,
uint32_t
,
__QD1_1
)
DECL_VAR
(
UA_Int32
,
uint32_t
,
__QD1_2
)
DECL_VAR
(
UA_Int32
,
uint32_t
,
__QD1_3
)
DECL_VAR
(
UA_Int32
,
uint32_t
,
__QD1_4
)
DECL_VAR
(
UA_Int32
,
uint32_t
,
__QD1_5
)
DECL_VAR
(
UA_Int32
,
uint32_t
,
__QD1_6
)
DECL_VAR
(
UA_Int32
,
uint32_t
,
__QD1_7
)
#define FREE_VARIANT(ua_type, c_loc_name) \
UA_Variant_delete(c_loc_name##_variant);
void
__cleanup_1
(
void
)
{
UA_Client_disconnect
(
client
);
UA_Client_delete
(
client
);
FREE_VARIANT
(
UA_Int32
,
__ID1_0
)
FREE_VARIANT
(
UA_Int32
,
__ID1_1
)
FREE_VARIANT
(
UA_Int32
,
__ID1_2
)
FREE_VARIANT
(
UA_Int32
,
__ID1_3
)
FREE_VARIANT
(
UA_Int32
,
__ID1_4
)
FREE_VARIANT
(
UA_Int32
,
__ID1_5
)
FREE_VARIANT
(
UA_Int32
,
__ID1_6
)
FREE_VARIANT
(
UA_Int32
,
__ID1_7
)
FREE_VARIANT
(
UA_Int32
,
__QD1_0
)
FREE_VARIANT
(
UA_Int32
,
__QD1_1
)
FREE_VARIANT
(
UA_Int32
,
__QD1_2
)
FREE_VARIANT
(
UA_Int32
,
__QD1_3
)
FREE_VARIANT
(
UA_Int32
,
__QD1_4
)
FREE_VARIANT
(
UA_Int32
,
__QD1_5
)
FREE_VARIANT
(
UA_Int32
,
__QD1_6
)
FREE_VARIANT
(
UA_Int32
,
__QD1_7
)
}
#define ALLOC_VARIANT(ua_type, c_loc_name) \
c_loc_name##_variant = UA_Variant_new();
int
__init_1
(
int
argc
,
char
**
argv
)
{
UA_StatusCode
retval
;
client
=
UA_Client_new
();
UA_ClientConfig_setDefault
(
UA_Client_getConfig
(
client
));
ALLOC_VARIANT
(
UA_Int32
,
__ID1_0
)
ALLOC_VARIANT
(
UA_Int32
,
__ID1_1
)
ALLOC_VARIANT
(
UA_Int32
,
__ID1_2
)
ALLOC_VARIANT
(
UA_Int32
,
__ID1_3
)
ALLOC_VARIANT
(
UA_Int32
,
__ID1_4
)
ALLOC_VARIANT
(
UA_Int32
,
__ID1_5
)
ALLOC_VARIANT
(
UA_Int32
,
__ID1_6
)
ALLOC_VARIANT
(
UA_Int32
,
__ID1_7
)
ALLOC_VARIANT
(
UA_Int32
,
__QD1_0
)
ALLOC_VARIANT
(
UA_Int32
,
__QD1_1
)
ALLOC_VARIANT
(
UA_Int32
,
__QD1_2
)
ALLOC_VARIANT
(
UA_Int32
,
__QD1_3
)
ALLOC_VARIANT
(
UA_Int32
,
__QD1_4
)
ALLOC_VARIANT
(
UA_Int32
,
__QD1_5
)
ALLOC_VARIANT
(
UA_Int32
,
__QD1_6
)
ALLOC_VARIANT
(
UA_Int32
,
__QD1_7
)
/* Connect to server */
retval
=
UA_Client_connect
(
client
,
"opc.tcp://192.168.0.78:4840"
);
if
(
retval
!=
UA_STATUSCODE_GOOD
)
{
UA_Client_delete
(
client
);
return
EXIT_FAILURE
;
}
}
#define READ_VALUE(ua_type, ua_type_enum, c_loc_name, ua_nodeid_type, ua_nsidx, ua_node_id) \
retval = UA_Client_readValueAttribute( \
client, ua_nodeid_type(ua_nsidx, ua_node_id), c_loc_name##_variant); \
if(retval == UA_STATUSCODE_GOOD && UA_Variant_isScalar(c_loc_name##_variant) && \
c_loc_name##_variant->type == &UA_TYPES[ua_type_enum]) { \
c_loc_name##_buf = *(ua_type*)c_loc_name##_variant->data; \
}
void
__retrieve_1
(
void
)
{
UA_StatusCode
retval
;
READ_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__ID1_0
,
UA_NODEID_STRING
,
1
,
"i2c0.relay0"
)
READ_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__ID1_1
,
UA_NODEID_STRING
,
1
,
"i2c0.relay1"
)
READ_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__ID1_2
,
UA_NODEID_STRING
,
1
,
"i2c0.relay2"
)
READ_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__ID1_3
,
UA_NODEID_STRING
,
1
,
"i2c0.relay3"
)
READ_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__ID1_4
,
UA_NODEID_STRING
,
1
,
"i2c1.relay0"
)
READ_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__ID1_5
,
UA_NODEID_STRING
,
1
,
"i2c1.relay1"
)
READ_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__ID1_6
,
UA_NODEID_STRING
,
1
,
"i2c1.relay2"
)
READ_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__ID1_7
,
UA_NODEID_STRING
,
1
,
"i2c1.relay3"
)
READ_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__QD1_0
,
UA_NODEID_STRING
,
1
,
"i2c0.relay0"
)
READ_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__QD1_1
,
UA_NODEID_STRING
,
1
,
"i2c0.relay1"
)
READ_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__QD1_2
,
UA_NODEID_STRING
,
1
,
"i2c0.relay2"
)
READ_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__QD1_3
,
UA_NODEID_STRING
,
1
,
"i2c0.relay3"
)
READ_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__QD1_4
,
UA_NODEID_STRING
,
1
,
"i2c1.relay0"
)
READ_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__QD1_5
,
UA_NODEID_STRING
,
1
,
"i2c1.relay1"
)
READ_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__QD1_6
,
UA_NODEID_STRING
,
1
,
"i2c1.relay2"
)
READ_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__QD1_7
,
UA_NODEID_STRING
,
1
,
"i2c1.relay3"
)
}
#define WRITE_VALUE(ua_type, ua_type_enum, c_loc_name, ua_nodeid_type, ua_nsidx, ua_node_id) \
UA_Variant_setScalarCopy(c_loc_name##_variant, (ua_type*)c_loc_name, &UA_TYPES[ua_type_enum]); \
UA_Client_writeValueAttribute(client, ua_nodeid_type(ua_nsidx, ua_node_id), c_loc_name##_variant);
void
__publish_1
(
void
)
{
WRITE_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__ID1_0
,
UA_NODEID_STRING
,
1
,
"i2c0.relay0"
)
WRITE_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__ID1_1
,
UA_NODEID_STRING
,
1
,
"i2c0.relay1"
)
WRITE_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__ID1_2
,
UA_NODEID_STRING
,
1
,
"i2c0.relay2"
)
WRITE_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__ID1_3
,
UA_NODEID_STRING
,
1
,
"i2c0.relay3"
)
WRITE_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__ID1_4
,
UA_NODEID_STRING
,
1
,
"i2c1.relay0"
)
WRITE_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__ID1_5
,
UA_NODEID_STRING
,
1
,
"i2c1.relay1"
)
WRITE_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__ID1_6
,
UA_NODEID_STRING
,
1
,
"i2c1.relay2"
)
WRITE_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__ID1_7
,
UA_NODEID_STRING
,
1
,
"i2c1.relay3"
)
WRITE_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__QD1_0
,
UA_NODEID_STRING
,
1
,
"i2c0.relay0"
)
WRITE_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__QD1_1
,
UA_NODEID_STRING
,
1
,
"i2c0.relay1"
)
WRITE_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__QD1_2
,
UA_NODEID_STRING
,
1
,
"i2c0.relay2"
)
WRITE_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__QD1_3
,
UA_NODEID_STRING
,
1
,
"i2c0.relay3"
)
WRITE_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__QD1_4
,
UA_NODEID_STRING
,
1
,
"i2c1.relay0"
)
WRITE_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__QD1_5
,
UA_NODEID_STRING
,
1
,
"i2c1.relay1"
)
WRITE_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__QD1_6
,
UA_NODEID_STRING
,
1
,
"i2c1.relay2"
)
WRITE_VALUE
(
UA_Int32
,
UA_TYPES_INT32
,
__QD1_7
,
UA_NODEID_STRING
,
1
,
"i2c1.relay3"
)
}
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/plc.st
0 → 100644
View file @
4067ea59
TYPE
LOGLEVEL
:
(
CRITICAL
,
WARNING
,
INFO
,
DEBUG
)
:=
INFO
;
END_TYPE
FUNCTION_BLOCK
LOGGER
VAR_INPUT
TRIG
:
BOOL
;
MSG
:
STRING
;
LEVEL
:
LOGLEVEL
:=
INFO
;
END_VAR
VAR
TRIG0
:
BOOL
;
END_VAR
IF
TRIG
AND
NOT
TRIG0
THEN
{{
LogMessage
(
GetFbVar
(
LEVEL
)
,
(
char
*
)
GetFbVar
(
MSG
,
.
body
)
,
GetFbVar
(
MSG
,
.
len
));
}}
END_IF
;
TRIG0:
=
TRIG
;
END_FUNCTION_BLOCK
FUNCTION_BLOCK
python_eval
VAR_INPUT
TRIG
:
BOOL
;
CODE
:
STRING
;
END_VAR
VAR_OUTPUT
ACK
:
BOOL
;
RESULT
:
STRING
;
END_VAR
VAR
STATE
:
DWORD
;
BUFFER
:
STRING
;
PREBUFFER
:
STRING
;
TRIGM1
:
BOOL
;
TRIGGED
:
BOOL
;
END_VAR
{
extern
void
__
PythonEvalFB
(
int
,
PYTHON_EVAL
*
);
__
PythonEvalFB
(
0
,
data__
);}
END_FUNCTION_BLOCK
FUNCTION_BLOCK
python_poll
VAR_INPUT
TRIG
:
BOOL
;
CODE
:
STRING
;
END_VAR
VAR_OUTPUT
ACK
:
BOOL
;
RESULT
:
STRING
;
END_VAR
VAR
STATE
:
DWORD
;
BUFFER
:
STRING
;
PREBUFFER
:
STRING
;
TRIGM1
:
BOOL
;
TRIGGED
:
BOOL
;
END_VAR
{
extern
void
__
PythonEvalFB
(
int
,
PYTHON_EVAL
*
);
__
PythonEvalFB
(
1
,
(
PYTHON_EVAL
*
)(
void
*
)
data__
);}
END_FUNCTION_BLOCK
FUNCTION_BLOCK
python_gear
VAR_INPUT
N
:
UINT
;
TRIG
:
BOOL
;
CODE
:
STRING
;
END_VAR
VAR_OUTPUT
ACK
:
BOOL
;
RESULT
:
STRING
;
END_VAR
VAR
py_eval
:
python_eval
;
COUNTER
:
UINT
;
_
TMP_ADD10_OUT
:
UINT
;
_
TMP_EQ13_OUT
:
BOOL
;
_
TMP_SEL15_OUT
:
UINT
;
_
TMP_AND7_OUT
:
BOOL
;
END_VAR
_
TMP_ADD10_OUT
:=
ADD
(
COUNTER
,
1
);
_
TMP_EQ13_OUT
:=
EQ
(
N
,
_
TMP_ADD10_OUT
);
_
TMP_SEL15_OUT
:=
SEL
(
_
TMP_EQ13_OUT
,
_
TMP_ADD10_OUT
,
0
);
COUNTER
:=
_
TMP_SEL15_OUT
;
_
TMP_AND7_OUT
:=
AND
(
_
TMP_EQ13_OUT
,
TRIG
);
py_eval
(
TRIG
:=
_
TMP_AND7_OUT
,
CODE
:=
CODE
);
ACK
:=
py_eval
.
ACK
;
RESULT
:=
py_eval
.
RESULT
;
END_FUNCTION_BLOCK
FUNCTION_BLOCK
CounterST
VAR_INPUT
Reset
:
BOOL
;
END_VAR
VAR_OUTPUT
Out1
:
INT
;
Out0
:
INT
;
END_VAR
VAR
Cnt1
:
INT
;
Cnt0
:
INT
;
END_VAR
VAR_EXTERNAL
ResetCounterValue
:
INT
;
Relay0
:
DINT
;
Relay1
:
DINT
;
Relay2
:
DINT
;
Relay3
:
DINT
;
Relay4
:
DINT
;
Relay5
:
DINT
;
Relay6
:
DINT
;
Relay7
:
DINT
;
END_VAR
IF
Reset
THEN
Cnt0
:=
ResetCounterValue
;
Cnt1
:=
ResetCounterValue
;
Reset
:=
False
;
ELSE
Cnt0
:=
Cnt0
+
1
;
Cnt1
:=
Cnt1
+
1
;
IF
Cnt1
=
50
THEN
Relay0
:=
1
;
Relay1
:=
1
;
Relay2
:=
1
;
Relay3
:=
1
;
Relay4
:=
1
;
Relay5
:=
1
;
Relay6
:=
1
;
Relay7
:=
1
;
END_IF
;
IF
Cnt1
=
100
THEN
Relay0
:=
0
;
Relay1
:=
0
;
Relay2
:=
0
;
Relay3
:=
0
;
Relay4
:=
0
;
Relay5
:=
0
;
Relay6
:=
0
;
Relay7
:=
0
;
Cnt1
:=
0
;
END_IF
;
END_IF
;
Out1
:=
Cnt1
;
Out0
:=
Cnt0
;
END_FUNCTION_BLOCK
PROGRAM
plc_prg
VAR_INPUT
Reset
:
BOOL
;
END_VAR
VAR_OUTPUT
Cnt0
:
INT
;
Cnt1
:
INT
;
END_VAR
VAR
CounterST0
:
CounterST
;
END_VAR
CounterST0
(
Reset
:=
Reset
);
Cnt1
:=
CounterST0
.
Out1
;
Cnt0
:=
CounterST0
.
Out0
;
END_PROGRAM
CONFIGURATION
config
VAR_GLOBAL
ResetCounterValue
:
INT
:=
0
;
Relay0
AT
%
QD1
.
0
:
DINT
:=
0
;
Relay1
AT
%
QD1
.
1
:
DINT
:=
0
;
Relay2
AT
%
QD1
.
2
:
DINT
:=
0
;
Relay3
AT
%
QD1
.
3
:
DINT
:=
0
;
Relay4
AT
%
QD1
.
4
:
DINT
:=
0
;
Relay5
AT
%
QD1
.
5
:
DINT
:=
0
;
Relay6
AT
%
QD1
.
6
:
DINT
:=
0
;
Relay7
AT
%
QD1
.
7
:
DINT
:=
0
;
END_VAR
RESOURCE
resource1
ON
PLC
TASK
task0
(
INTERVAL
:=
T
#20ms
,
PRIORITY
:=
0
);
PROGRAM
instance0
WITH
task0
:
plc_prg
;
END_RESOURCE
END_CONFIGURATION
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/plc_debugger.c
0 → 100644
View file @
4067ea59
This diff is collapsed.
Click to expand it.
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/plc_main.c
0 → 100644
View file @
4067ea59
This diff is collapsed.
Click to expand it.
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/py_ext.c
0 → 100644
View file @
4067ea59
/*
* Python Asynchronous execution code
*
* PLC put python commands in a fifo, respecting execution order
* with the help of C pragmas inserted in python_eval FB code
*
* Buffer content is read asynchronously, (from non real time part),
* commands are executed and result stored for later use by PLC.
*
* In this implementation, fifo is a list of pointer to python_eval
* function blocks structures. Some local variables have been added in
* python_eval interface. We use those local variables as buffer and state
* flags.
*
* */
#include "iec_types_all.h"
#include "POUS.h"
#include <string.h>
/* The fifo (fixed size, as number of FB is fixed) */
static
PYTHON_EVAL
*
EvalFBs
[
1
];
/* Producer and consumer cursors */
static
int
Current_PLC_EvalFB
;
static
int
Current_Python_EvalFB
;
/* A global IEC-Python gateway state, for use inside python_eval FBs*/
static
int
PythonState
;
#define PYTHON_LOCKED_BY_PYTHON 0
#define PYTHON_LOCKED_BY_PLC 1
#define PYTHON_MUSTWAKEUP 2
#define PYTHON_FINISHED 4
/* Each python_eval FunctionBlock have it own state */
#define PYTHON_FB_FREE 0
#define PYTHON_FB_REQUESTED 1
#define PYTHON_FB_PROCESSING 2
#define PYTHON_FB_ANSWERED 3
int
WaitPythonCommands
(
void
);
void
UnBlockPythonCommands
(
void
);
int
TryLockPython
(
void
);
void
UnLockPython
(
void
);
void
LockPython
(
void
);
int
__init_py_ext
()
{
int
i
;
/* Initialize cursors */
Current_Python_EvalFB
=
0
;
Current_PLC_EvalFB
=
0
;
PythonState
=
PYTHON_LOCKED_BY_PYTHON
;
for
(
i
=
0
;
i
<
1
;
i
++
)
EvalFBs
[
i
]
=
NULL
;
return
0
;
}
void
__cleanup_py_ext
()
{
PythonState
=
PYTHON_FINISHED
;
UnBlockPythonCommands
();
}
void
__retrieve_py_ext
()
{
/* Check Python thread is not being
* modifying internal python_eval data */
PythonState
=
TryLockPython
()
?
PYTHON_LOCKED_BY_PLC
:
PYTHON_LOCKED_BY_PYTHON
;
/* If python thread _is_ in, then PythonState remains PYTHON_LOCKED_BY_PYTHON
* and python_eval will no do anything */
}
void
__publish_py_ext
()
{
if
(
PythonState
&
PYTHON_LOCKED_BY_PLC
){
/* If runnig PLC did push something in the fifo*/
if
(
PythonState
&
PYTHON_MUSTWAKEUP
){
/* WakeUp python thread */
UnBlockPythonCommands
();
}
UnLockPython
();
}
}
/**
* Called by the PLC, each time a python_eval
* FB instance is executed
*/
void
__PythonEvalFB
(
int
poll
,
PYTHON_EVAL
*
data__
)
{
if
(
!
__GET_VAR
(
data__
->
TRIG
)){
/* ACK is False when TRIG is false, except a pulse when receiving result */
__SET_VAR
(
data__
->
,
ACK
,,
0
);
}
/* detect rising edge on TRIG to trigger evaluation */
if
(((
__GET_VAR
(
data__
->
TRIG
)
&&
!
__GET_VAR
(
data__
->
TRIGM1
))
||
/* polling is equivalent to trig on value rather than on rising edge*/
(
poll
&&
__GET_VAR
(
data__
->
TRIG
)
))
&&
/* trig only if not already trigged */
__GET_VAR
(
data__
->
TRIGGED
)
==
0
){
/* mark as trigged */
__SET_VAR
(
data__
->
,
TRIGGED
,,
1
);
/* make a safe copy of the code */
__SET_VAR
(
data__
->
,
PREBUFFER
,,
__GET_VAR
(
data__
->
CODE
));
}
/* retain value for next rising edge detection */
__SET_VAR
(
data__
->
,
TRIGM1
,,
__GET_VAR
(
data__
->
TRIG
));
/* python thread is not in ? */
if
(
PythonState
&
PYTHON_LOCKED_BY_PLC
){
/* if some answer are waiting, publish*/
if
(
__GET_VAR
(
data__
->
STATE
)
==
PYTHON_FB_ANSWERED
){
/* Copy buffer content into result*/
__SET_VAR
(
data__
->
,
RESULT
,,
__GET_VAR
(
data__
->
BUFFER
));
/* signal result presence to PLC*/
__SET_VAR
(
data__
->
,
ACK
,,
1
);
/* Mark as free */
__SET_VAR
(
data__
->
,
STATE
,,
PYTHON_FB_FREE
);
/* mark as not trigged */
if
(
!
poll
)
__SET_VAR
(
data__
->
,
TRIGGED
,,
0
);
/*printf("__PythonEvalFB pop %d - %*s\n",Current_PLC_EvalFB, data__->BUFFER.len, data__->BUFFER.body);*/
}
else
if
(
poll
){
/* when in polling, no answer == ack down */
__SET_VAR
(
data__
->
,
ACK
,,
0
);
}
/* got the order to act ?*/
if
(
__GET_VAR
(
data__
->
TRIGGED
)
==
1
&&
/* and not already being processed */
__GET_VAR
(
data__
->
STATE
)
==
PYTHON_FB_FREE
)
{
/* Enter the block in the fifo
* Don't have to check if fifo cell is free
* as fifo size == FB count, and a FB cannot
* be requested twice */
EvalFBs
[
Current_PLC_EvalFB
]
=
data__
;
/* copy into BUFFER local*/
__SET_VAR
(
data__
->
,
BUFFER
,,
__GET_VAR
(
data__
->
PREBUFFER
));
/* Set ACK pin to low so that we can set a rising edge on result */
if
(
!
poll
){
/* when not polling, a new answer imply reseting ack*/
__SET_VAR
(
data__
->
,
ACK
,,
0
);
}
else
{
/* when in polling, acting reset trigger */
__SET_VAR
(
data__
->
,
TRIGGED
,,
0
);
}
/* Mark FB busy */
__SET_VAR
(
data__
->
,
STATE
,,
PYTHON_FB_REQUESTED
);
/* Have to wakeup python thread in case he was asleep */
PythonState
|=
PYTHON_MUSTWAKEUP
;
/*printf("__PythonEvalFB push %d - %*s\n",Current_PLC_EvalFB, data__->BUFFER.len, data__->BUFFER.body);*/
/* Get a new line */
Current_PLC_EvalFB
=
(
Current_PLC_EvalFB
+
1
)
%
1
;
}
}
}
char
*
PythonIterator
(
char
*
result
,
void
**
id
)
{
char
*
next_command
;
PYTHON_EVAL
*
data__
;
//printf("PythonIterator result %s\n", result);
/*emergency exit*/
if
(
PythonState
&
PYTHON_FINISHED
)
return
NULL
;
/* take python mutex to prevent changing PLC data while PLC running */
LockPython
();
/* Get current FB */
data__
=
EvalFBs
[
Current_Python_EvalFB
];
if
(
data__
&&
/* may be null at first run */
__GET_VAR
(
data__
->
STATE
)
==
PYTHON_FB_PROCESSING
){
/* some answer awaited*/
/* If result not None */
if
(
result
){
/* Get results len */
__SET_VAR
(
data__
->
,
BUFFER
,
.
len
,
strlen
(
result
));
/* prevent results overrun */
if
(
__GET_VAR
(
data__
->
BUFFER
,
.
len
)
>
STR_MAX_LEN
)
{
__SET_VAR
(
data__
->
,
BUFFER
,
.
len
,
STR_MAX_LEN
);
/* TODO : signal error */
}
/* Copy results to buffer */
strncpy
((
char
*
)
__GET_VAR
(
data__
->
BUFFER
,
.
body
),
result
,
__GET_VAR
(
data__
->
BUFFER
,.
len
));
}
else
{
__SET_VAR
(
data__
->
,
BUFFER
,
.
len
,
0
);
}
/* remove block from fifo*/
EvalFBs
[
Current_Python_EvalFB
]
=
NULL
;
/* Mark block as answered */
__SET_VAR
(
data__
->
,
STATE
,,
PYTHON_FB_ANSWERED
);
/* Get a new line */
Current_Python_EvalFB
=
(
Current_Python_EvalFB
+
1
)
%
1
;
//printf("PythonIterator ++ Current_Python_EvalFB %d\n", Current_Python_EvalFB);
}
/* while next slot is empty */
while
(((
data__
=
EvalFBs
[
Current_Python_EvalFB
])
==
NULL
)
||
/* or doesn't contain command */
__GET_VAR
(
data__
->
STATE
)
!=
PYTHON_FB_REQUESTED
)
{
UnLockPython
();
/* wait next FB to eval */
//printf("PythonIterator wait\n");
if
(
WaitPythonCommands
())
return
NULL
;
/*emergency exit*/
if
(
PythonState
&
PYTHON_FINISHED
)
return
NULL
;
LockPython
();
}
/* Mark block as processing */
__SET_VAR
(
data__
->
,
STATE
,,
PYTHON_FB_PROCESSING
);
//printf("PythonIterator\n");
/* make BUFFER a null terminated string */
__SET_VAR
(
data__
->
,
BUFFER
,
.
body
[
__GET_VAR
(
data__
->
BUFFER
,
.
len
)],
0
);
/* next command is BUFFER */
next_command
=
(
char
*
)
__GET_VAR
(
data__
->
BUFFER
,
.
body
);
*
id
=
data__
;
/* free python mutex */
UnLockPython
();
/* return the next command to eval */
return
next_command
;
}
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/build/resource1.c
0 → 100644
View file @
4067ea59
/*******************************************/
/* FILE GENERATED BY iec2c */
/* Editing this file is not recommended... */
/*******************************************/
#include "iec_std_lib.h"
// RESOURCE RESOURCE1
extern
unsigned
long
long
common_ticktime__
;
#include "accessor.h"
#include "POUS.h"
#include "config.h"
#include "POUS.c"
BOOL
TASK0
;
PLC_PRG
RESOURCE1__INSTANCE0
;
#define INSTANCE0 RESOURCE1__INSTANCE0
void
RESOURCE1_init__
(
void
)
{
BOOL
retain
;
retain
=
0
;
TASK0
=
__BOOL_LITERAL
(
FALSE
);
PLC_PRG_init__
(
&
INSTANCE0
,
retain
);
}
void
RESOURCE1_run__
(
unsigned
long
tick
)
{
TASK0
=
!
(
tick
%
1
);
if
(
TASK0
)
{
PLC_PRG_body__
(
&
INSTANCE0
);
}
}
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/opcua_0@opcua/baseconfnode.xml
0 → 100644
View file @
4067ea59
<?xml version='1.0' encoding='utf-8'?>
<BaseParams
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
IEC_Channel=
"1"
Name=
"opcua_0"
/>
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/opcua_0@opcua/confnode.xml
0 → 100644
View file @
4067ea59
<?xml version='1.0' encoding='utf-8'?>
<OPCUAClient
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
Server_URI=
"opc.tcp://192.168.0.78:4840"
/>
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/opcua_0@opcua/selected.csv
0 → 100644
View file @
4067ea59
input,"LocalizedText(Encoding:3, Locale:en-US, Text:Relay 0)",1,str,i2c0.relay0,Int32,0
input,"LocalizedText(Encoding:3, Locale:en-US, Text:Relay 1)",1,str,i2c0.relay1,Int32,1
input,"LocalizedText(Encoding:3, Locale:en-US, Text:Relay 2)",1,str,i2c0.relay2,Int32,2
input,"LocalizedText(Encoding:3, Locale:en-US, Text:Relay 3)",1,str,i2c0.relay3,Int32,3
input,I2C1 / Relay 0,1,str,i2c1.relay0,Int32,4
input,I2C1 / Relay 1,1,str,i2c1.relay1,Int32,5
input,I2C1 / Relay 2,1,str,i2c1.relay2,Int32,6
input,I2C1 / Relay 3,1,str,i2c1.relay3,Int32,7
output,"LocalizedText(Encoding:3, Locale:en-US, Text:Relay 0)",1,str,i2c0.relay0,Int32,0
output,"LocalizedText(Encoding:3, Locale:en-US, Text:Relay 1)",1,str,i2c0.relay1,Int32,1
output,"LocalizedText(Encoding:3, Locale:en-US, Text:Relay 2)",1,str,i2c0.relay2,Int32,2
output,"LocalizedText(Encoding:3, Locale:en-US, Text:Relay 3)",1,str,i2c0.relay3,Int32,3
output,I2C1 / Relay 0,1,str,i2c1.relay0,Int32,4
output,I2C1 / Relay 1,1,str,i2c1.relay1,Int32,5
output,I2C1 / Relay 2,1,str,i2c1.relay2,Int32,6
output,I2C1 / Relay 3,1,str,i2c1.relay3,Int32,7
Beremiz/beremiz_tutorial_multiple_mod_ios_opc_ua/plc.xml
0 → 100644
View file @
4067ea59
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment