Repository navigation
Releases
v0.5.2 - Pypi
v0.5.1 - Protected content fixes
New Feature: copy_data_from
- Tag.copy_data_from(source): replaces a tag's Data (L5K and Decorated) with copies of another tag's of the same type/dimensions, to clone an AOI instance including its local-tag values
Bug Fixes
- Layout: a source-protected AOI is laid out from its readable Parameters (definition order, InOut skipped, Decorated defaults, no L5K), so tags of that type can be created with values (program and controller tags)
- UDT members and AOI parameters/locals of a protected type are refused with an explicit "source-protected AOI ... not supported here" message; Tag.to_spec's refusal explains why
- Docs: exp36 (Studio v37 keeps Decorated values over a stale L5K block on import and on a full-project open, also for protected AOIs; a Decorated-only protected instance imports with locals at defaults)
v0.5.0
New Features
- Added support for source-protected content. Projects with protected Add-On Instructions or routines, such as AOIs from a vendor or customer, can now be read and used to build component exports.
Highlights
Read source-protected AOIs and routines
Studio 5000 saves a protected AOI as <EncodedData EncodedType="AddOnInstructionDefinition">, not as
an <AddOnInstructionDefinition>, and a protected routine as <EncodedData EncodedType="Routine">.
Earlier releases ignored both.
project.protected_aois→ProtectedAOI: name, class, revision, signature ID and timestamp,
edited date, software revision, encryption config and revision note. Studio leaves the parameter
definitions readable, soparametersis the sameAOIParametersCollectiona normal AOI has,
with descriptions, defaults, usage, required and visible.program.protected_routines→ProtectedRoutine: name, type and encryption config.project.aoisandprogram.routinesstill hold readable definitions only.- The encoded payload is never interpreted, and it is written back unchanged.
Tags of a protected AOI type
They parse like any other AOI-typed tag, from their Decorated data. Their members also get metadata
from the protected AOI's parameters, for example instance.mode carries the parameter description.
Component exports with protected content
- A routine, rung, program or tag export that uses a protected AOI no longer fails with
unresolvable data type. The AOI'sEncodedDatais copied unchanged into the context, which is
the same thing Studio does when it exports protected content. - A Program export keeps its protected routines.
- Each copy raises a new
ProtectedContentWarning(aUserWarning). A Program export also warns,
naming each protected routine, that the tags and AOIs used only inside it can't be found, so they
are not included as context. - Verified with Studio 5000 v37 through the Logix Designer SDK: these files import with 0 warnings
and build, without the source key. That includes importing into a blank project, where Studio
creates the protected AOI from the copied element. Details are indocs/import-format.md(exp35).
Behavior changes
export_component()/project.export()now succeed where a protected AOI type used to raise
ValueError, and they emitProtectedContentWarninginstead.- A protected AOI or protected routine passed as an export target raises
ValueError. Tag.to_spec()raisesValueErrorfor a tag of a protected AOI type, and so doesProgram.to_spec()
for a program with a protected routine. A spec can't rebuild encoded content, and earlier releases
silently dropped the routine.find_type_users()also reports protected AOIs whose parameters use the type, so removing a UDT
that one of them uses is refused.- Adding or renaming a routine rejects names already used by a protected routine in that program.
TypeRegistrytakes an optional third argument,protected_aois, and has new
protected_aoi()/is_protected_aoi()methods. Existing callers are unaffected.
Known limitations
- Logic inside a protected routine can't be read, so calls and references inside it are not
found by call-site, reference or export scans. - Protected AOI types can't be used in new tag specs or UDT members ("unknown data type"), because
their data layout includes encoded local tags. - A UDT replace does not migrate the values of tags of a protected AOI type.
New public API
ProtectedAOI, ProtectedAOICollection, ProtectedRoutine, ProtectedRoutinesCollection,
ProtectedContentWarning, Project.protected_aois, Program.protected_routines,
TypeRegistry.protected_aoi(), TypeRegistry.is_protected_aoi().
Other
- Test fixture
example.L5X/.ACDre-exported from Studio v37 with a protected AOI
(SeqCtrl_Protected) and a protected routine (AnotherProgram/SequenceRoutine_Protected). - README: new "Source-protected AOIs and routines" section.
v0.4.0
New Features
Write Support
This release adds write support. You can edit loaded L5X files, generate new UDTs, AOIs, programs and tags, and export standalone component files that Studio 5000 can import. Write support is verified against Studio 5000 v37 and v38 with the Logix Designer SDK, and generated components also import into v33 and v35.
- Write files:
Project.write()andProject.to_string()produce Studio's own export format.loads()parses L5X text. - Edit in place:
- set tag values, including whole structures and arrays (
tag.value = {...}); - set descriptions, rung comments and rung text;
- set operand comments and metadata.
- set tag values, including whole structures and arrays (
- Add, remove and rename:
- tags, aliases and routines;
- rungs, which are renumbered automatically;
- ST routine lines.
- Spec builders: plain, JSON-friendly specs for UDTs, AOIs, programs and tags (
DataTypeSpec,AOISpec,ProgramSpec,TagSpec, ...). Every existing object can be turned into a spec withto_spec(). - Edit UDTs and AOIs with migration:
replace()updates every existing instance by member or parameter name, using Studio's own type-conversion rules. AOI renames also update call sites in logic, andreplace()refuses signature changes that would break existing calls. - Component export:
project.export(...)writes any UDT, AOI, program, routine, rung or tag as a standalone import file, with the UDTs, AOIs, tags and modules it depends on. - Templating:
stamp()andsubstitute()turn one program or spec into many (Motor1toMotor2..10). - Studio 5000 v38: support for the new
TIMER_Ttype. ItsACCmember comes beforePRE, unlikeTIMER. - Time values:
TIME,TIME32,LTIME,DTandLDTacceptint,timedeltaanddatetimevalues and are stored in Studio's canonical form. Literals that Studio would silently discard (T#1500ms,T#2.5s, units out of order) are rejected.
v38 Support
The release also adds Studio 5000 v38 including the new TIMER_T type.
Miscellaneous
StringNode.valuenow returns decoded text:$l,$',$HHand the other escapes become real characters.- Tags without a
<Data>element load as typed tags (IntegerTag,StructTag, ...) instead ofUnknownTag. - Assigning
.valueon a struct or array tag no longer silently creates a Python attribute. It sets the members, or raisesTypeError. Useto_python()to read a structure or array.
Known limitations
- Replacing a UDT or AOI resets the local-tag values of the AOI instances that depend on it, because Studio stores those values only in L5K data.
- Renaming tags, routines, programs, AOIs, and UDTs doesn't update references in logic.
- Instruction and type availability differs between Studio versions (for example
MOVbecameMOVEin v36). Use the instructions your version supports. - Source-protected (encoded) routines and AOIs are not tested.
See the README for more details.
v0.3.1-beta
New Features
AOI Parameter and Local Tag Properties
Updated Add On Parameters and Local Tags so that they now carry bit, member, and element level meta data and behave more like Tags.
AOI's got forgotten about during the bit tag typing rewrite, so they were still generic wrappers that could be any type and were missing some member or element data. They are now typed classes like tags and fully include things like bit level comments:
print(project.aois["Debounce"].parameters["onDelay"])AOIParameterIntegerTag('onDelay', 'DINT')
name = 'onDelay'
data_type = 'DINT'
external_access = 'Read/Write'
description = 'milliseconds before output bit turns ON'
tag_type = 'Base'
usage = 'Input'
radix = 'Decimal'
visible = True
value: 0
min: 0
max: 2147483647
engineering_unit: 'ms'This also means that tag instances of AOI's now get the definition's extended properties for each parameter unless these are defined on the instance in which case they override the definition's value (matching Studio 5000's behavior).
Updates
The readme has been overhauled and is much more hand written now. Hopefully its more readable and the example are more relevant now.
v0.3.0-beta
Tag Refactor and New Module Tags
Important
Many classes have been changed pretty significantly. Anything built with v0.2.0 will need updates to use v0.3.0
Tags
The tag parser has been overhauled to be more specific. There are now several sub-classes mirroring the atomic types in Studio 5000 (integers of all shapes and sizes, reals, strings, etc.) This means that properties are much more focused and most tag types have more useful methods and properties associated with them. See the README.md for more details on the new tag API.
Modules Tags and Controller Tags
Ethernet and IO modules now have a value in project.tags mirroring how (most) modules create data in a Controller's global tags. These object reference the input, output, and control data present in project.modules.
Additionally, to still mirror how the L5X is structured or to just filter out module data, a project.controller_tags object now exist to list the global tags sans IO data.
Print Info
Several objects have had their representation updated so that printing a tag or AOI reveals more useful info. For example:
print(project.programs["MainProgram"].tags["a_commented_dint"])Now prints:
IntegerTag('a_commented_dint', 'DINT')
name = 'a_commented_dint'
tag_type = 'Base'
data_type = 'DINT'
external_access = 'Read/Write'
opc_ua_access = 'None'
description = 'a dint with bit comments'
value: 0
radix: 'Decimal'Whereas previously it would have just printed `IntegerTag('a_commented_dint', 'DINT')
v0.2.0-beta
v0.2.0 brings support for more specialty tag types, safety controller attributes, and routine comment extraction.
New Features
Safety support
ControllerInfonow exposessafetyInfowith details about controller level safety infoTask,ProgramandTagall now have aclass_andis_safetyparameter to identify safety components
Routine Comments
- Routines now have a
Routine.commentsproperty that returns a list of all comments for both Ladder Logic and Structured Text
Specialty Tag Types
Tagnow has four more properties for specialty tags:MessageParameters— forMESSAGEtags, exposed viaTag.message_parameters.MotionGroupParameters— forMOTION_GROUPtags, exposed viaTag.motion_group_parameters.AxisParameters— forAXIS_CIP_DRIVEtags: identification, scaling/actuator, motor nameplate, homing, motion limits, stopping, and feedback — exposed viaTag.axis_parameters.Tag.special_data_format/Tag.special_data_attributes— generic fallback for any non-value<Data Format="...">tag type not otherwise recognized.
Misc
ControllerInfonow shows more info such as time sync, wall clock time, ethernet ports, and OPC UA enabled status- Tags now show OPC UA access
Fixes & improvements
- Controller tests now validate date format rather than an exact value so the tests don't need to be updated for every small change in
example.L5X - All example files were removed and are now just contained in
tests/fixturesso that there is no need to maintain two copies of the same file - The old, non-safety, example project file was kept as
test/fixtures/simple_example.*
v0.1.1-beta
Bug Fixes
- Fixed missing parameters for scalar tags. EngineeringUnits, State0/1, etc. are now correctly parsed for the base Tag element if it is not a structure.
v0.1.0-beta
First stable release for anyone to tryout. See the readme for available features.