2023.1.1344.2 Logic Simulator
Overview
A Logic Simulator enables Prespective to connect to external logic controllers like PLCs. A Simulator object is a container that manages the connection to an adapter and a collection of Logic Components.
The configuration result is saved as a XML policy file for easy exchange and adaptation.
In this article you find information on how to setup this manager to establish a connection. Specific adapter configurations can be found at each adapter page.
Where to find
The Logic Simulator can be found under Logic.
This will create a PreLogicSimulator in the Hierarchy.
Feature overview
Gateway Settings are adapter-specific, please see the Adapter page for more information about specific adapters.
Simulation Settings |
|
---|---|
Simulator Name | Name used for to identify the simulator. |
Start in Playmode | Automatically start the simulator when entering playmode. Buttons Start / Pause / Stop are used to control the simulator and the connection to the external device |
Stream Connection | Shows the current state of the connection to the external source. |
Content Lifecycle State | Returns the current status of the lifecycle management if supported by the selected adapter. |
Stream Client State | Returns the state of the simulator. |
Content life cycle management is not (yet) supported for most adapters
Logic Components |
|
---|---|
Logic Component (0) | Shows a list of all child components of this simulator |
Logic Components automatically updates when a logic component is attached to the simulator
Signal Naming Rule Overrides | The naming rule override field can be used to apply the set rules to all connected child components. Increment the size generates a new rule. |
---|---|
Signal Naming rules (#1) |
|
Size | Amount of signal naming rules |
Rule: $ALL |
|
Target | $ALL : this rule applies to all signals within this instance, overruled by all below options $INPUT : this rule applies to all PLC Input signals within this instance, overruled only by a custom rule $OUTPUT : this rule applies to all PLC Output signals within this instance, overruled only by a custom rule $VARIABLE : this rule applies to all PLC Variable signals within this instance, overruled only by a custom rule [CUSTOM] : applies only to the signal with the name [CUSTOM], overrides all other rules. This can be used to override a specific IO for example |
PLC Address Formatting | Naming used within on the PLC to identify the IO
Variables that can be used here: {{SIM_ROOTPATH}} : unity path to the active simulator root object {{SIM_NAME}} : name of the simulator used in unity {{COMP_SIMPATH}} : Unity path to the prelogic component {{COMP_NAME}} : name of the prelogic component {{IO_NAME}} : Name of the IO defined in the signal definition {{INST_NAME}} : variable that can be modified by the instance naming rule |
PLC Path Separator | Sepearator character used in the the PLC Address Formatting “.” by default |
Apply Signal Naming Rule Overrides | Overrides the sginal naming rules on all connected child components |
Instance Naming Rule Overrides | One can set the implicit naming rule override in this field per simulation component type. |
---|---|
Instance Naming rule (#0) |
|
Add new rule | Adds a new rule field |
X | Remove this rule |
Delete All | Removes all rules |
Target Component | The component script file on which the naming rule applies |
Naming Rule | The actual implicit naming rule that should be applied |
Apply Instance Naming Rule Overrides | Applies the set rule to all connected child components with attached TargetScript. |
{{INST_NAME}} needs to be used in the signal naming rule to apply an implicit naming rule
Policy Settings |
|
---|---|
Policy Directory | Path relative to the assets folder for storing the policy file |
Policy Filename | Name for the saved XML file |
Policy Export Settings |
|
Export Type Policy | Exports the type definition for the specific adapter. On by default. |
Legacy Commenting | When on it does not export a Description element. Off by default. |
Comment to Split Signals By Component | Split the IO definition in inputs, output and variable blocks. On by default |
Name And Address On Single Line | Puts the name and address element on a single line,. On by default |
Allow Initial Value | Adds the initValue field in the export. On by default |
Allow Priority | Adds the priority element on the export. On by default |
Export Policy to XML | Exports the file to the given XMLPath provided by the Adapter settings. |
Open Policy File | Opens the exported file with the default xml program defined in windows if the file exists. |
Policy File
A policy file has all the necessary information to connect to the external source. Everything in the XML will be loaded when entering playmode or starting the Unity build. Everything in the policy file will update the simulator. Make sure they are synchronized. Reexport when unsure.
The dataset consist of two parts:
Active Controller Definition and Type Definitions
Active controller definition consist of two parts. The adapter specific connection parameters and the IO definition.
<Server settings example >
< Input definition export example >
< Type Definition export example>
Prespective Documentation