Unread post Wed Nov 13, 2013 9:32 am

PointForce specification

In the Matlab assignment due tonight (#8) you are asked to extend the model description to include force elements (of type "PointForce" and "Torque"). Both types have a "fun" field which is currently an array of strings for a "PointForce" and a single string for a "Torque".

First of all, please note that there are a couple of typos in the assignment:
  1. the value of the torque expression provided in the example JSON snippet should be enclosed in quotes
  2. the name of the key for the body on which the torque acts should be "body1" (for consistency with how we specified constraints that only involve one body and how we specify a PointForce)
In other words, an example would look like this:
  Code:
{
"name": "my_torque",
"id": 2,
"type": "Torque",
"body1": 5,
"fun": "10*t"
}


Secondly, when dealing with the array of two strings for a "PointForce" (which represent the expressions for the X-component of the force and the Y-component, respectively) you will encounter problems similar to what we've seen when dealing with the set of constraints: depending on what the two strings actually are, the "fun" field in the structure returned by the function 'loadjson' may be either a cell array (if the two strings have different lengths, like in the example provided) or a char matrix (if the two strings happen to have the same length).

While it is possible to write your model parser to properly address both cases, I think we should make our life easier and change the definition of a "PointForce" element to the following:
  Code:
{
"name": "point_force",
"id": 1,
"type": "PointForce",
"body1": 1,
"sP1": [1.4, 0.2],
"frame": "GRF",
"funX": "sin(t + pi/3)",
"funY": "-9.81"
}

In other words, we will provide two separate key-value pairs, one for the expression of X-component of the force and one for its Y-component.

I will update the PDF with this assignment on the SBEL course webpage.

Also, I will push the due date for this assignment by one day: Matlab Assignment 8 is now due on Thursday, November 14 at 11:59pm.

Sorry for the confusion. Please let me know if you have any questions.

-Radu