Code Creation
Overview
Now that you have finished updating the state diagrams to reflect the new approach to modeling the behavior, you are ready to start writing some code. Ensure that you have Gradle installed and configured correctly, as that is the build script you will be using for this example.
Behavior Execution Engine provides a delegate source code project template to assist you in authoring the code base for execution. The folder can be found in the <BEE Install Directory>/samples/sysml2/build.
The prepared template files will serve as the skeleton to which you can add all the meat (backing code) that facilitates the bespoke functionality you need for the simulation. To start this process, you’ll need to configure the directory to work with the delegate files.
Prerequisites
| Prerequisite | Description |
|---|---|
| Behavior Execution Engine Installation | You must have installed Behavior Execution Engine. |
| Tutorial Project | You must start this section with the Behavior Execution Engine simulation project from the previous section. |
Instructions
Configure Directory for Delegate Files
- Create a folder called
DelegateSourcein a location you have permission to write to. - Copy the contents of the
buildfolder into theDelegateSourcefolder.
Initial Setup of Delegate Module Source Files and Environment
While the template has provided all the necessary build files required for your project, you need to verify and modify some of these files.
- Open the newly copied
settings.gradlefile you just created within theDelegateSourcedirectory. - Change the root project name from the default to:
sample-tutorial-tortoise-vs-hare-part-2.
To make sure the project builds properly, please fill in your gradle.properties file to point Gradle to the correct locations
on all fields required to build and debug.
You are now ready to build the project:
- Open a command prompt and navigate to the
DelegateSourcedirectory, where yourbuild.gradle,gradle.properties, andgradle.settingsfiles are located. - Type
gradle install.
You may run into errors if you do not have adequate permissions to write to the default location specified in
the gradle.properties file for the com.agi.mbse.delegateModuleDir setting.
If that is the case, modify the com.agi.mbse.delegateModuleDir
setting to reflect a directory you can write to.
If the operation is successful, you should now have a folder in your specified location named
sample-tutorial-tortoise-vs-hare-part-2.
Inside the folder is your JAR file for the delegate.
To attach Javadoc to the API Libraries, follow the developer environment setup guide
Next Section >