DiscoverLearnDocumentationGet OpenPLXSearch Contact

Model Definition

An OpenPLX model is a named definition of something in your simulation, for example a wheel, a chassis, a sensor, or a complete vehicle.

Start with a model without a base type

In OpenPLX, position and indentation matter:

At root level (no indentation), you define models. Inside a model (indented), you define attributes that become members of the model. These attributes can themselves be instances of or references to any OpenPLX model type.

Example:

MyModel:
    my_attribute is Real

Here:

  • MyModel: at root level declares a model.
  • my_attribute is Real is not a new model since it is indented. It declares an attribute named my_attribute of type Real inside MyModel.

So, root-level declarations define reusable models, while indented declarations extend/configure the current model.

Physics3D.System models

To load an OpenPLX file, we need to have at least one Physics3D.System model. A Physics3D.System may contain any number of child systems, rigid bodies, mates, and other simulation components. In practice, a simulation runtime loads a single Physics3D.System, which contains the complete hierarchy of systems and components needed for the simulation.

Set model attribute values

We can set the value of my_attribute in our MyModel model by creating an instance of MyModel and then accessing its attribute:

MyModel:
    my_attribute is Real

MySystem is Physics3D.System:
    model is MyModel:
        my_attribute: 2.0

Create a model with default attribute values

We can create a model with default attribute values:

MyModel:
    my_attribute is Real: 2.0

MySystem is Physics3D.System:
    model is MyModel

Here model.my_attribute will be 2.0. Just as before we can modify our attribute just as we did in the previous section.

Reuse a model multiple times

Once defined, a model can be reused many times.

MyModel:
    my_attribute is Real
    my_second_attribute is Int

MySystem is Physics3D.System:
    model0 is MyModel:
        my_attribute: 2.0
        my_second_attribute: 1
    model1 is MyModel:
        my_attribute: 3.0
        my_second_attribute: 5
    model2 is MyModel:
        my_attribute: 1.0
        my_second_attribute: 1
    model3 is MyModel:
        my_attribute: 1.0
        my_second_attribute: 2

Each is MyModel creates a separate instance with the same structure.

OpenPLX is a work in progress. This draft version will evolve with user feedback and experience. We welcome your input and collaboration.
X