Matrix Attributes

Hello,

Is it possible to specify a matrix as an attribute? I want to specify the attributes of an item with a 4x4 homogeneous transformation matrix.

Thanks!

Tom

Hello Tom,

You can use Collections::Array. You can set the size of rows/columns/etc. by redefining dimensions, then use the indexing operator (#(i, j,...)) to access and bind the elements. For example:

attribute my3DArray : Collections::Array {
    :>> dimensions = (3, 4, 5);
}
attribute oneCorner = my3DArray#(1, 1, 1);
attribute otherCorner = my3DArray#(3, 4, 5);

Thanks Vince, that is helpful! How can I specify a “complete” item using these arrays? Like in the following example?

package Ontology {
    enum def SoftwareDataType {
        double;
    }
}

package Model {

    private import SI::*;

    item def MotionVector {
        doc 
        /* A 6 DoF motion vector, ordered as translational velocity (x, y, z) followed by rotational velocity (a, b, c)
         */

        attribute motionVector : Collections::Array {
            :>> dimensions = (6, 1);
        }

        attribute x_velocity = motionVector#(1, 1) {
            doc /* Translational velocity along the frame's x-axis. */
            attribute dataType = Ontology::SoftwareDataType::double;
            attribute unit :> ISQ::speed default 0 [m / s];
        }

        attribute y_velocity = motionVector#(2, 1) {
            doc /* Translational velocity along the frame's y-axis. */
            attribute dataType = Ontology::SoftwareDataType::double;
            attribute unit :> ISQ::speed default 0 [m / s];
        }

        attribute z_velocity = motionVector#(3, 1) {
            doc /* Translational velocity along the frame's z-axis. */
            attribute dataType = Ontology::SoftwareDataType::double;
            attribute unit :> ISQ::speed default 0 [m / s];
        }

        attribute a_velocity = motionVector#(4, 1) {
            doc /* Rotational velocity about the frame's x-axis. */
            attribute dataType = Ontology::SoftwareDataType::double;
            attribute unit :> ISQ::angularVelocity default 0 [rad / s];
        }

        attribute b_velocity = motionVector#(5, 1) {
            doc /* Rotational velocity about the frame's y-axis. */
            attribute dataType = Ontology::SoftwareDataType::double;
            attribute unit :> ISQ::angularVelocity default 0 [rad / s];
        }

        attribute c_velocity = motionVector#(6, 1) {
            doc /* Rotational velocity about the frame's z-axis. */
            attribute dataType = Ontology::SoftwareDataType::double;
            attribute unit :> ISQ::angularVelocity default 0 [rad / s];
        }

    }
}

When extracting from the model (for example to auto-generate a software interface), how would I know which attribute(s) to choose?

Thanks!

Tom

I’m basically trying to formalize the following .toml file using SysML v2.

[[software_interface.topic.software_datum]]
name = "MotionVector"
dimension = [6]
data_type = "double"
engineering_units = "[m/s, m/s, m/s, rad/s, rad/s, rad/s]"
description = """A 6 DoF motion vector, ordered as translational velocity (x, y, z) followed by rotational velocity (a, b, c)."""