Overview of ACS (ACS)
Automatic Code Synchronizer (ACS) is a real-time synchronizer that keeps a model and its generated code synchronized.
After you have set up ACS, it works in the background and you do not have to interact with it. ACS monitors a model and its generated code for changes:
• If ACS detects a change in the model that affects the code, ACS automatically generates the relevant code files.
• If ACS detects a change to a reversible property in a generated code file, such as an operation body, ACS can automatically reverse engineer the changed text to the model.
Alternatively, you can make ACS generate code on demand.
ACS works with any code editor or IDE. You use Modeler to architect your design, while retaining the power of your IDE to change and navigate the source code. The code is always available and therefore can be validated by a compiler or static code checker, for example, to check compliance to a language subset such as MISRA C or Ravenscar.
ACS is very useful when you are learning UML, because you can experiment with changes in a model and immediately see the associated changes in your code files.
ACS uses a selected ACS Code Generator DLL to generate code. ACS can generate code for Ada, C, C#, C++, Java and Visual Basic.
To use ACS you require an ACS license and a Modeler license. In addition, you need ACS licenses for the languages you want to generate.
Before using ACS with a model, you must add the ACS Profile to that model. After adding the ACS Profile to a model you can use the ACS/TDK Control tab in Modeler to control code generation through ACS.
To generate code through ACS, perform the following steps:
• Add the ACS Profile to your model.
• In Modeler, select the source Model or Package for the generation.
• Load
ACS. On the
ACS/TDK Control tab, click the
Load ACS button.
• Create a
Generation Settings Scheme to define how the code files are generated. On the
ACS/TDK Control tab, click the
button, and then define the
Generation Settings Scheme through the
Launch ACS/TDK dialog.
• Set up the ACS generate and reverse options through the ACS/TDK Control tab.
• Start ACS using the selected Generation Settings Scheme. In Modeler select the root item, on the ACS/TDK Control tab, select the Generation Settings Scheme you want to use and then click the Start button.
• Force a code generation: on the
ACS/TDK Control tab, click the
Force Generate button.
| • By default, ACS reverse engineers reversible properties. After reverse engineering marked text, ACS generates that code from the model. If required, you can disable reverse engineering. • ACS can reverse engineer only text that it has generated between markers, such as operation bodies. • When you force a generation, ACS deletes any redundant code files, but does not delete any redundant folders. • When you first start ACS with a model, ACS does not generate any code to the target folder. To initially generate code you must force a generation from ACS. Thereafter, when ACS is running it will update your code with changes you make in the model, unless you disable generation. If you stop ACS and later restart it, ACS startup options can reverse changes to text within markers (reversible properties), and generate code so that your model and code files are synchronized. • ACS reverse engineers only operation bodies and selected other properties. If you make changes in the code that are not reverse engineered (for example, add an attribute or operation), those changes will be lost if ACS updates the code file. See the Working with ACS and the Synchronizers and Strategy for maintaining operation bodies and other reversible properties sections that follow. • By default, ACS ignores a new Class in a model until you change its default name to something that is not Class <integer>. If you want to generate Classes that have default names, on the ACS/TDK Settings dialog (click the Edit ACS Settings button) select the Generate Default Named Items check box. |
Learning to use ACS
If you are learning to use Modeler and ACS, you may find the Modeler tutorials useful.
For information about downloading and opening the
Modeler Tutorials, see
PTC Modeler tutorials.
ACS Profile
If you want to use ACS with a model, you must add the ACS Profile to that model.
| • If you upgrade Modeler, update the ACS Profiles in your models and right-click the ACS Profile, and then select > . • Do not make changes to the ACS profile. Any changes you make will be lost when the profile is updated. | You can create Tag Definitions outside of the ACS profile, and link those Tag Definitions to Stereotypes in the ACS profile. When the ACS profile is updated, the links will not be broken. |
• Do not create copies of the ACS profile within a model, or create copies of the ACS profile through XMI Import/Export. The copies of the ACS profile will not work correctly and you will not be able to update the copies through the Update All Profiles command. |
ACS/TDK Control Tab
In
Modeler, you use the
ACS/TDK Control tab to control
ACS.
Tell me more...Generation Settings Schemes
ACS uses Generation Settings Scheme to define how code files are generated.
You can create many Generation Settings Schemes for the Model and each Package in the model. When you select the Model or a Package in Modeler, the Generation Settings Schemes that have been created for the selected item are listed in the drop-down-list on the ACS/TDK Control tab.
To generate code using a
Generation Settings Scheme and select the root item in
Modeler, select the
Generation Settings Scheme you want to use on the
ACS/TDK Control tab, and then click the
Start button.
The Generation Settings Scheme specifies which ACS Code Generator DLL is used to generate code.
ACS Code Generator DLLs
ACS uses ACS Code Generator DLLs that have been created by the Transformation Development Kit (TDK).
When you install
ACS,
Code Generator DLLs are installed for your use. For information about these
Code Generator DLLs, see
Provided ACS Code Generator DLLs (ACS).
You can customize a supplied ACS Code Generator DLLs through Transformation Development Kit (TDK).
ACS Code Generator DLLs are provided to generate code files for the following code languages:
Strategy for maintaining operation bodies and other reversible properties
You must decide how you want to maintain operation bodies and other reversible properties, that is, in the model or in the code files.
The ACS settings you must use depends on whether you want to maintain reversible properties in the model or code files.
For more information about maintaining reversible properties, see
Strategy for maintaining reversible properties (ACS).
Refreshing the ACS cache
On occasions, changes may be made to the model for which
ACS is not sent notification calls, such as, other user's changes made in a multi-user environment and changes made by add-ins. Should this happen and you want to
ACS to detect these changes, on the
ACS/TDK Control tab, click
Force Refresh.
Working with Modeler CM branches (sandboxes)
If you use ACS with a Modeler CM branch, ACS generates code only for changes that appear in your sandbox - changes made to the trunk and other sandboxes will not appear in your sandbox and are not generated by ACS.
If you are maintaining reversible properties in the code files, you must be very careful when rebasing a branch, else you can lose other users' changes to the model. For more information about maintaining reversible properties, see
Strategy for maintaining reversible properties (ACS).
Working with External CM tool integration replicas
If you are using a replica of a model, ACS generates code only for changes that appear in your replica - changes made by other users are generated only if you update your replica with those changes.
Complications can arise if you are maintaining reversible properties in the code files and a change cannot be reverse engineered because the associated item's Package in the model is not checked out. For more information about maintaining reversible properties, see
Strategy for maintaining reversible properties (ACS).
Working with multi-user models
In a multi-user model, it is important to isolate your changes from other users changes. If ACS generates other users transitional changes to your code files, your code files will typically be in an uncompilable state.
In a multi-user model, use the Modeler CM to create a branch (sandbox) of the model. You can then work in your branch of the model, in isolation to other users changes - ACS generates changes that appear only in your branch.
You should use ACS with only the following models:
• A model that only you use.
• A model version that only you use, that is, a Modeler CM branch (sandbox).
• A CM tool integration replica that only you use.
If you must use ACS with a multi-user model, that is, a model or model version to which more than one user has access:
• Set up ACS to generate code from only the Packages you are changing.
• In ACS, disable Reverse and maintain operation bodies and other reversible properties in the Model.