plcopen/types_enums.py
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Sun, 06 Jan 2019 03:11:39 +0300
changeset 2501 eba2bbb2dd9a
parent 1953 5736d25bb393
child 2524 c80b0d864475
permissions -rw-r--r--
Make online debug optional

It could be useful for very small targets like Atmega (Arduino) and
for target bring-up there developer want to have running PLC program,
but has not implemented runtime communication yet.


TARGET_DEBUG_AND_RETAIN_DISABLE - completely disable debug and retain
functionality. Previously named TARGET_DEBUG_DISABLE.

TARGET_ONLINE_DEBUG_DISABLE - can be used to enable retain
functionality (no define TARGET_DEBUG_AND_RETAIN_DISABLE is used), but disable
online debug with corresponding RAM/FLASH overhead.

TARGET_LOGGING_DISABLE - disables logging functionality from runtime and PLC program

TARGET_EXT_SYNC_DISABLE - disables PLC program synchronization with
external events. For example, it could be used to synchronize several
PLCs that control motors for different axes.

By default all these options are off.

To test generate program for Generic target, put following files in
project files directory and run build.sh after generating PLC program.
This is very easy to integrate into makefile (Generic target).

[------------- build.sh --------------------------]
files=$(find $PWD/../build -iname '*.c' | grep -v POUS.c)
arm-none-eabi-gcc \
-DTARGET_DEBUG_AND_RETAIN_DISABLE \
-DTARGET_ONLINE_DEBUG_DISABLE \
-DTARGET_LOGGING_DISABLE \
-DTARGET_EXT_SYNC_DISABLE \
-flto -ffunction-sections -fdata-sections -I../../../../matiec/lib/C \
$files \
main.c \
-Wl,--Map=./program.map,--cref \
-nodefaultlibs --specs=nano.specs -Wl,--static -Wl,--gc-section -Wl,--start-group -lc -lm -lnosys -lgcc -Wl,--end-group
[------------------------------------------------]

[------------- main.c --------------------------]
#ifndef TARGET_DEBUG_AND_RETAIN_DISABLE
void Retain(void){}
void InValidateRetainBuffer(void){}
void ValidateRetainBuffer(void){}
#endif

extern void __run(void);
int main(void)
{
for(;;) {
__run();
// sleep common_ticktime__ ns
// add common_ticktime__ ns to __CURRENT_TIME
}
return 0;
}
[------------------------------------------------]
1944
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/env python
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     2
# -*- coding: utf-8 -*-
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     3
# This file is part of Beremiz
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     4
# See COPYING file for copyrights details.
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     5
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     6
from __future__ import absolute_import
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     7
from util.TranslationCatalogs import NoTranslate
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     8
_ = NoTranslate
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     9
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    10
ITEMS_EDITABLE = [
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    11
    ITEM_PROJECT,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    12
    ITEM_POU,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    13
    ITEM_VARIABLE,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    14
    ITEM_TRANSITION,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    15
    ITEM_ACTION,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    16
    ITEM_CONFIGURATION,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    17
    ITEM_RESOURCE,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    18
    ITEM_DATATYPE
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    19
] = range(8)
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    20
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    21
ITEMS_UNEDITABLE = [
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    22
    ITEM_DATATYPES,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    23
    ITEM_FUNCTION,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    24
    ITEM_FUNCTIONBLOCK,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    25
    ITEM_PROGRAM,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    26
    ITEM_TRANSITIONS,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    27
    ITEM_ACTIONS,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    28
    ITEM_CONFIGURATIONS,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    29
    ITEM_RESOURCES,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    30
    ITEM_PROPERTIES
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    31
] = range(8, 17)
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    32
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    33
ITEMS_VARIABLE = [
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    34
    ITEM_VAR_LOCAL,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    35
    ITEM_VAR_GLOBAL,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    36
    ITEM_VAR_EXTERNAL,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    37
    ITEM_VAR_TEMP,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    38
    ITEM_VAR_INPUT,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    39
    ITEM_VAR_OUTPUT,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    40
    ITEM_VAR_INOUT
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    41
] = range(17, 24)
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    42
1948
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
    43
ITEM_CONFNODE = 25
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
    44
1944
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    45
VAR_CLASS_INFOS = {
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    46
    "Local":    ("localVars",    ITEM_VAR_LOCAL),
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    47
    "Global":   ("globalVars",   ITEM_VAR_GLOBAL),
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    48
    "External": ("externalVars", ITEM_VAR_EXTERNAL),
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    49
    "Temp":     ("tempVars",     ITEM_VAR_TEMP),
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    50
    "Input":    ("inputVars",    ITEM_VAR_INPUT),
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    51
    "Output":   ("outputVars",   ITEM_VAR_OUTPUT),
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    52
    "InOut":    ("inOutVars",    ITEM_VAR_INOUT)}
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    53
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    54
POU_TYPES = {
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    55
    "program": ITEM_PROGRAM,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    56
    "functionBlock": ITEM_FUNCTIONBLOCK,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    57
    "function": ITEM_FUNCTION,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    58
}
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    59
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    60
CLASS_TYPES = {
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    61
    "configuration": ITEM_CONFIGURATION,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    62
    "resource": ITEM_RESOURCE,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    63
    "action": ITEM_ACTION,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    64
    "transition": ITEM_TRANSITION,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    65
    "program": ITEM_PROGRAM
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    66
}
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    67
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    68
LOCATIONS_ITEMS = [LOCATION_CONFNODE,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    69
                   LOCATION_MODULE,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    70
                   LOCATION_GROUP,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    71
                   LOCATION_VAR_INPUT,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    72
                   LOCATION_VAR_OUTPUT,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    73
                   LOCATION_VAR_MEMORY] = range(6)
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    74
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    75
UNEDITABLE_NAMES = [_("User-defined POUs"), _("Functions"), _("Function Blocks"),
1953
5736d25bb393 PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents: 1948
diff changeset
    76
                    _("Programs"), _("Data Types"), _("Transitions"), _("Actions"),
5736d25bb393 PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents: 1948
diff changeset
    77
                    _("Configurations"), _("Resources"), _("Properties")]
1944
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    78
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    79
[USER_DEFINED_POUS, FUNCTIONS, FUNCTION_BLOCKS, PROGRAMS,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    80
 DATA_TYPES, TRANSITIONS, ACTIONS, CONFIGURATIONS,
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    81
 RESOURCES, PROPERTIES] = UNEDITABLE_NAMES
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    82
1948
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
    83
# -------------------------------------------------------------------------------
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
    84
#                   Project Element tag name computation functions
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
    85
# -------------------------------------------------------------------------------
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
    86
1953
5736d25bb393 PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents: 1948
diff changeset
    87
1948
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
    88
# Compute a data type name
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
    89
def ComputeDataTypeName(datatype):
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
    90
    return "D::%s" % datatype
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
    91
1953
5736d25bb393 PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents: 1948
diff changeset
    92
1948
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
    93
# Compute a pou name
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
    94
def ComputePouName(pou):
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
    95
    return "P::%s" % pou
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
    96
1953
5736d25bb393 PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents: 1948
diff changeset
    97
1948
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
    98
# Compute a pou transition name
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
    99
def ComputePouTransitionName(pou, transition):
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   100
    return "T::%s::%s" % (pou, transition)
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   101
1953
5736d25bb393 PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents: 1948
diff changeset
   102
1948
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   103
# Compute a pou action name
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   104
def ComputePouActionName(pou, action):
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   105
    return "A::%s::%s" % (pou, action)
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   106
1953
5736d25bb393 PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents: 1948
diff changeset
   107
1948
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   108
# Compute a pou  name
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   109
def ComputeConfigurationName(config):
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   110
    return "C::%s" % config
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   111
1953
5736d25bb393 PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents: 1948
diff changeset
   112
1948
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   113
# Compute a pou  name
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   114
def ComputeConfigurationResourceName(config, resource):
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   115
    return "R::%s::%s" % (config, resource)
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   116
1953
5736d25bb393 PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents: 1948
diff changeset
   117
1948
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   118
def GetElementType(tagname):
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   119
    words = tagname.split("::")
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   120
    return {
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   121
        "D": ITEM_DATATYPE,
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   122
        "P": ITEM_POU,
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   123
        "T": ITEM_TRANSITION,
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   124
        "A": ITEM_ACTION,
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   125
        "C": ITEM_CONFIGURATION,
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   126
        "R": ITEM_RESOURCE
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   127
    }[words[0]]
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   128
b9a3f771aaab Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents: 1944
diff changeset
   129
1944
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   130
# remove gettext override
6162e34fb246 Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
   131
del _