3 SaveText simulation

This "UML state diagram" sample illustrates the basic functionality of the UML state diagram and contains the following UML SC elements:

Sample project: TF1910_UmlSC_Sample3_SaveTextSimulation.zip

Overview

UML SC is used to simulate the behavior of an application in which text is to be saved in XML or text format. The information is then to be sent to a client and a master.

This behavior has not actually been implemented in the sample project. Instead, the outer shell or basic structure of the state machine is implemented using UML SC as an example.

States

The UML SC diagram has the following states:

Counter/call frequency

The states each contain a DO action and an ENTRY and/or EXIT action. Each action increments a corresponding counter. This indicates that:

Selection element

If the "XmlFormat" or "TextFormat" state is activated, the selection element is used as a decision basis. The element has two outgoing transitions. The transition with the higher priority (i.e. with the lower priority number) is checked first. If the associated transition condition is met, the target state is activated.

Composite state

The "PublishToMaster" and "PublishToClient" states are located in different regions of a composite state, so that they are processed in pseudo-parallel mode. This means that both states are active simultaneously, but the region with the higher priority (i.e. with the lower priority number) is executed first. Colored highlighting on the visualization indicates which region was processed first. Furthermore, during the execution of the sample project it becomes apparent that the composite state is only exited when both substate machines have reached their end state.

Project modification possible: the priorities of the regions can be changed by adjusting the number in the upper right corner of the region. If you configure Region1 with priority 1 and download this change via an online change, next time you activate the composite state you can see that "Client first" is now highlighted instead of "Master first". Consequently, Region1 was executed first.

Visualization

In addition to the convenient online mode of the UML SC diagram, the behavior of the state machine and the values of the counters can be tracked via the visualization. Switches on the visualization facilitate switching back and forth between the states.

3 SaveText simulation 1:

The values of the transition conditions can be changed not only via the visualization or the declaration editor of the FB, but also directly via the UML SC diagram.

If the transition consists of only one transition variable, the value of the variable can be changed for writing or forcing by double-clicking on the monitoring value. If a value was prepared for writing or forcing, this is indicated in the upper right-hand corner of the monitoring area (see also: Online Mode).