Constant RPM Gearbox problem

About advanced scenes, and the Thyme scripting language used in Algodoo.

Constant RPM Gearbox problem

Postby nansjes1 » Fri Dec 27, 2013 8:19 pm

Hey guys! I'm busy with a car, but I'm stuck at the gearbox. I want to make a constant RPM gearbox.

It works like this:
The input-circle has a radius of 2 meter and the output-circle a radius of 1 meter.
When the input-speed = > 50 rad/s the output has to grow.
When the input-speed = < 50 rad/s the output has to crimp.
(The output radius must be smaller than 2.95m and bigger than 0.55)
But the output circle doesn't do anything!

Here is the script im using on the input:
Spoiler: show
Code: Select all
(e)=>{
    angvel = angvel < scene.my.rads_setting(?)({
        scene.my.radius = scene.my.radius - 0.1
    });
    angvel = angvel > scene.my.rads_setting(?)({
        scene.my.radius = scene.my.radius + 0.1
    })
}


And here is the script im using for the output:
Spoiler: show
Code: Select all
(e)=>{
    radius = scene.my.radius;
    scene.my.radius = scene.my.radius < 0.55(?)({
        scene.my.radius = 0.55
    });
    scene.my.radius = scene.my.radius > 2.95(?)({
        scene.my.radius = 2.95
    })
}


Yes is set the scene.my.radius = 1 and scene.my.rads_setting = 50
It would be awesome if you guys could help me out :D
Attachments
Constant RPM Gearbox.phz
Constant RPM Gearbox
(19.94 KiB) Downloaded 20 times
User avatar
nansjes1
 
Posts: 4
Joined: Thu Jun 13, 2013 6:19 pm

Re: Constant RPM Gearbox problem

Postby Kilinich » Sat Dec 28, 2013 7:32 pm

Incorrect syntax in scrips.

Should be something like this:
Code: Select all
(e)=>{
    e.this.angvel < scene.my.rads_setting ? {scene.my.radius = scene.my.radius - 0.1} : {scene.my.radius = scene.my.radius + 0.1}
}
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 2 guests