gdbaldw / BlenderAndMBDyn

Combines Blender's graphical interface and rendering capabilities with MBDyn's multi-body dynamics, aerodynamics, and aeroelastics simulation and analysis, for rapid modeling and realistic rendering of physics based multi-body simulations.
GNU General Public License v3.0
25 stars 13 forks source link

driving element must have the same label of the driven one #13

Closed timgow closed 8 years ago

timgow commented 8 years ago

I'm following the 'BAM v2 - Simulate a Double Pendulum' video and get a problem at the stage where the driven element is introduced.

The error message that I get is: Error: the driving element must have the same label of the driven one An error occurred during the execution of MBDyn; aborting...

The MBDyn input file contents:

begin: data;
    problem: initial value;
end: data;

begin: initial value;
    initial time: 0;
    final time: 10;
    strategy: no change;
    time step: 0.001;
    tolerance: 1e-06;
    max iterations: 10;
    derivatives tolerance: 2;
    derivatives max iterations: 1;
    derivatives coefficient: 0.001;
end: initial value;

begin: control data;
    select timeout: forever;
    default orientation: orientation matrix;
    output meter: meter, 0, forever, steps, 1;
    output precision: 6;
    default output:
        reference frames,
        abstract nodes,
        electric nodes,
        hydraulic nodes,
        structural nodes,
        accelerations,
        aerodynamic elements,
        air properties,
        beams,
        electric elements,
        forces,
        genels,
        gravity,
        hydraulic elements,
        joints,
        rigid bodies,
        induced velocity elements;
    structural nodes: 2;
    joints: 2;
    forces: 1;
    rigid bodies: 1;
    gravity;
end: control data;

set: const integer Cube = 0;
set: const integer Cube_001 = 1;
begin: nodes;
    structural: Cube, static,
        reference, global, 0, 0, 0,
        reference, global, matr,
            1, 0, 0,
            0, 1, 0,
            0, 0, 1,
        reference, global, null,
        reference, global, null;
    structural: Cube_001, dynamic,
        reference, global, 0, 0, -4,
        reference, global, matr,
            1, 0, 0,
            0, 0, -1,
            0, 1, 0,
        reference, global, null,
        reference, global, null;
end: nodes;

set: const integer Constant_drive = 0;
set: const integer Meter_drive = 1;
set: const integer String_drive = 2;
set: const integer Unit_drive = 3;
drive caller: Constant_drive, 5;
drive caller: Unit_drive, unit;
drive caller: Meter_drive, meter, 0, forever, steps, 1;
drive caller: String_drive, string, "time<1.0";

set: const integer Body = 0;
set: const integer Clamp = 1;
set: const integer Distance = 2;
set: const integer Driven = 3;
set: const integer Gravity = 4;
set: const integer Structural_force = 5;
begin: elements;
    body: Body,
        Cube_001,
            1,
            0, 0, 0, 
            eye,
            inertial, matr,
                1, 0, 0,
                0, 1, 0,
                0, 0, 1;
    force: Structural_force, follower,
        Cube_001,
            position, 0, 0, 0,
            0, 0, 1,
        reference, String_drive;
    joint: Clamp, clamp,
        Cube, node, node;
    joint: Distance, distance,
        Cube,
            position, 0, 0, 0,
        Cube_001,
            position, 0, 0, 0,
        from nodes;
    gravity: 
            0, 0, -1, scale, 9.81, reference, Unit_drive;
    driven: Driven,
String_drive,
        existing: force, Structural_force;
end: elements;

Below are images of the Structural Force, Driven and String Drive edit windows: screenshot structuralforce screenshot driven screenshot stringdrive

Please point me in the right direction on the creation of force, driven and drive within BAM. Tim

gdbaldw commented 8 years ago

Hi Tim, Thanks. Bug is fixed. -Doug

gdbaldw commented 8 years ago

Hi Tim, All operations, except Object location and orientation, MUST in most cases be done through the BAM interface. To duplicate Objects, use Selected Objects -> Duplicate. For delete, select the Object(s) to be deleted and look for either the Delete button, or Selected Objects -> Users to identify and subsequently delete (or suitably edit) all MBDyn entities using the Object(s), and then the Delete button will appear. Duplicating or deleting Objects within the 3D-VIEW will have unexpected outcomes if the Object is associated with any MBDyn entity. -Doug

Hi Doug, Thank you for the bug fix, I haven't had a chance to download and try yet. In the same double pendulum example, when I select the 2 bodies, shift+d for duplicate, move to Z=-3, all looks ok, but when I make a fresh Initial Value Problem and simulate, the duplicate items disappear from the model space and the extra pendulum is not present in the MBDyn input file. The additional 2 object remain in the RH blender tree but there is no evidence of the second pendulum in the LH BAM element list. I hope that I'm not missing a vital step, I've retried a couple of times. Tim

timgow commented 8 years ago

Thanks, Doug, I'll get that a try-out. Please guide me on building linkage arms for mechanisms. I need a body with at joint at each end and the mass lumped at the CofG. I can create a node at the CofG position and attach the body there with the mass and inertia properties. I'm not clear on the best way to attach the joints relative to the node at the CofG and whether to create blender objects at the joint positions. Tim

gdbaldw commented 8 years ago

Tim, Yes, Blender Objects at the joint positions. Rigid offsets from your Body Object to each joint position Object. Then, a new Object for whatever you are to join, perhaps a new Body. And then, select 1) the new Body, 2) one of the Rigid offset Objects. Now, create your joint. Node 1 will be Rigid offset from the original Body node. Node 2 will be the new Body. -Doug

timgow commented 8 years ago

Hi Doug, Thank you for answering my link creation question. I've got the latest BAM code and building a crank-slider model; initially it's a 2-link pendulum until the slider is added. I tried to run this intermediate stage and I get the error:

reading from file "Scene.001.mbd"
Creating scalar solver with Naive linear solver
Reading Structural(1)
Reading Structural(0)
Reading Body(1)
Reading Body(0)
Reading Joint(2)
[mathp.cc:3635,func=TypedValue MathParser::expr()] (unknown token) at line 114
HighParser::GetValue(): error return from MathParser at line 114, file <Scene.001.mbd>
An error occurred during the execution of MBDyn; aborting... 

The MBDyn input file doesn't include the definition of the 'Node_Ground'. I modified the input file to include the definition and it runs ok; the DIFF output is:

4a5
> set: const integer Node_Ground = 99;
65c66
<   structural nodes: 2;
---
>   structural nodes: 3;
71a73,80
>   structural: Node_Ground, static,
>       reference, global, 0, 0, 0,
>       reference, global, matr,
>           1, 0, 0,
>           0, 1, 0,
>           0, 0, 1,
>       reference, global, null,
>       reference, global, null;

Please see the attached files. Tim


On Fri, 2/10/15, gdbaldw notifications@github.com wrote:

Subject: Re: [BlenderAndMBDyn] driving element must have the same label of the driven one (#13) To: "gdbaldw/BlenderAndMBDyn" BlenderAndMBDyn@noreply.github.com Cc: "timgow" tim@gowingeng.co.uk Date: Friday, 2 October, 2015, 22:38

Tim,

Yes, Blender Objects at the joint positions. Rigid offsets from your Body Object to each joint position Object. Then, a new Object for whatever you are to join, perhaps a new Body. And then, select 1) the new Body, 2) one of the Rigid offset Objects. Now, create your joint. Node 1 will be Rigid offset from the original Body node. Node 2 will be the new Body.

-Doug

— Reply to this email directly or view it on GitHub.

gdbaldw commented 8 years ago

Hi Tim, No files were attached. Unfortunately, github supports only limited file types as attachments. For now, the best way to communicate the model is through images, similar to what you had done before. Click on the 1st item in the Elements list to highlight its associated objects and take an image, then click on the 2nd item in the Element's list and take an image, repeat for all items. To make communications of this nature much easier in the future, I'll look into having this same model information commented into the input file. -Doug