Torque Input for bike model

Hi Guys,

I am currently trying to put a torque profile into the bike model
provided in the repository.
As the torque ( or crank moment) was being calculated like this :
AnyForce CrankMoment ={
AnyJoint &Jnt=.CrankJoint;
F=
{…BikeParameters.CrankMomentOffset-…BikeParameters.CrankMomentAmpcos
(4
pi*t/…BikeParameters.T+ …BikeParameters.CrankMomentPhase)};
};

i had hoped that i would be able to give it the torque like this:

AnyForce CrankMoment =
{
AnyJoint &Jnt=.CrankJoint;

 AnyInputFile TorqueIn = {
   FileName = "TorqueInput.txt";
 };

 AnyVector Time_T = TorqueIn.T;
 AnyMatrix Data_mat = TorqueIn.Data;
 F = {Data_mat[t*303/2]};

};

However i get this error:
‘[’ : Illegal operation for given argument types : ‘AnyFloat[1]
[101]’ ‘[’ ‘AnyFloat’
For the line which calculates F, i thought it might just be that it
wants a second argument so i added [1] infront of [var] but that just
returns
‘F’ : Index [1] out of range for ‘AnyFloat[1][101]’

Is it possible to get AnyBody to do this? Or is it necessary to go
about this in a different way?

the file TorqueInput.txt has two columns of data, one with the time
and the other with the torque at that time.

Best Regards
Alex Purdue

Hi Alex,

I think the easiest way is to use an AnyFunInterpol, the code would look
like this :

AnyForce CrankMoment =
{
AnyJoint &Jnt=.CrankJoint;

AnyFunInterpol TorqueIn = {

Type = Bspline;
FileName = “TorqueInput.txt”;
};

F = TorqueIn(t);
};

This way the moment applied to the joint is directly read the text file.

Best regards,

Sylvain, AnyBody Support


From: anyscript@yahoogroups.com [mailto:anyscript@yahoogroups.com] On Behalf
Of alex.purdue
Sent: 26. januar 2009 16:02
To: anyscript@yahoogroups.com
Subject: [AnyScript] Torque Input for bike model

Hi Guys,

I am currently trying to put a torque profile into the bike model
provided in the repository.
As the torque ( or crank moment) was being calculated like this :
AnyForce CrankMoment ={
AnyJoint &Jnt=.CrankJoint;
F=
{…BikeParameters.CrankMomentOffset-…BikeParameters.CrankMomentAmpcos
(4
pi*t/…BikeParameters.T+ …BikeParameters.CrankMomentPhase)};
};

i had hoped that i would be able to give it the torque like this:

AnyForce CrankMoment =
{
AnyJoint &Jnt=.CrankJoint;

AnyInputFile TorqueIn = {
FileName = “TorqueInput.txt”;
};

AnyVector Time_T = TorqueIn.T;
AnyMatrix Data_mat = TorqueIn.Data;
F = {Data_mat[t*303/2]};

};

However i get this error:
‘[’ : Illegal operation for given argument types : ‘AnyFloat[1]
[101]’ ‘[’ ‘AnyFloat’
For the line which calculates F, i thought it might just be that it
wants a second argument so i added [1] infront of [var] but that just
returns
‘F’ : Index [1] out of range for ‘AnyFloat[1][101]’

Is it possible to get AnyBody to do this? Or is it necessary to go
about this in a different way?

the file TorqueInput.txt has two columns of data, one with the time
and the other with the torque at that time.

Best Regards
Alex Purdue

[Non-text portions of this message have been removed]

Hi Sylvain,

Thanks a lot, that works well.

Alex

— In anyscript@yahoogroups.com, AnyScript Support
<anyscriptsup@…> wrote:
>
> Hi Alex,
>
>
>
> I think the easiest way is to use an AnyFunInterpol, the code would
look
> like this :
>
>
>
> AnyForce CrankMoment =
> {
> AnyJoint &Jnt=.CrankJoint;
>
> AnyFunInterpol TorqueIn = {
>
> Type = Bspline;
> FileName = “TorqueInput.txt”;
> };
>
> F = TorqueIn(t);
> };
>
>
>
> This way the moment applied to the joint is directly read the text
file.
>
>
>
> Best regards,
>
> Sylvain, AnyBody Support
>
>
>
>
>
> _____
>
> From: anyscript@yahoogroups.com [mailto:anyscript@yahoogroups.com]
On Behalf
> Of alex.purdue
> Sent: 26. januar 2009 16:02
> To: anyscript@yahoogroups.com
> Subject: [AnyScript] Torque Input for bike model
>
>
>
> Hi Guys,
>
> I am currently trying to put a torque profile into the bike model
> provided in the repository.
> As the torque ( or crank moment) was being calculated like this :
> AnyForce CrankMoment ={
> AnyJoint &Jnt=.CrankJoint;
> F=
>
{…BikeParameters.CrankMomentOffset-…BikeParameters.CrankMomentAmpcos
> (4
pit/…BikeParameters.T+ …BikeParameters.CrankMomentPhase)};
> };
>
> i had hoped that i would be able to give it the torque like this:
>
> AnyForce CrankMoment =
> {
> AnyJoint &Jnt=.CrankJoint;
>
> AnyInputFile TorqueIn = {
> FileName = “TorqueInput.txt”;
> };
>
> AnyVector Time_T = TorqueIn.T;
> AnyMatrix Data_mat = TorqueIn.Data;
> F = {Data_mat[t
303/2]};
>
> };
>
> However i get this error:
> ‘[’ : Illegal operation for given argument types : ‘AnyFloat[1]
> [101]’ ‘[’ ‘AnyFloat’
> For the line which calculates F, i thought it might just be that it
> wants a second argument so i added [1] infront of [var] but that
just
> returns
> ‘F’ : Index [1] out of range for ‘AnyFloat[1][101]’
>
> Is it possible to get AnyBody to do this? Or is it necessary to go
> about this in a different way?
>
> the file TorqueInput.txt has two columns of data, one with the time
> and the other with the torque at that time.
>
> Best Regards
> Alex Purdue
>
>
>
>
>
> [Non-text portions of this message have been removed]
>

Hi,

I’m now trying to use the same method to put the cadence in for each
time step (my cadence changes throughout the revolution. Unfortunately
when i try and run this I get an error message saying that the
DriverVel expression is failing at moment ‘DesignVar’ and that the
‘CrankRotation.t’ argument will not be ready for evaluation until
moment ‘TimeVar’.

Here is the code where the error occurs:
AnyKinEqSimpleDriver CrankRotation = {
AnyRevoluteJoint &Jnt = .CrankJoint;
AnyFunInterpol LocalCadence = {
Type = Bspline;
FileName = “CadenceInput.txt”;
};

 DriverPos = {0};
 DriverVel = {-(LocalCadence(t)/60)*pi*2};
 Reaction.Type = {Off};

};

The cadence file is set up exactly like the torque file was and the
array used for the time matches up exactly with all the times in both
files. Do the drivers get initialised at the start and as such have
issues with time dependence? Any assistance would be greatly
appreciated

Best Regards
Alex Purdue

— In anyscript@yahoogroups.com, “alex.purdue” <alex.purdue@…>
wrote:
>
> Hi Sylvain,
>
> Thanks a lot, that works well.
>
> Alex
>
> — In anyscript@yahoogroups.com, AnyScript Support
> <anyscriptsup@> wrote:
> >
> > Hi Alex,
> >
> >
> >
> > I think the easiest way is to use an AnyFunInterpol, the code
would
> look
> > like this :
> >
> >
> >
> > AnyForce CrankMoment =
> > {
> > AnyJoint &Jnt=.CrankJoint;
> >
> > AnyFunInterpol TorqueIn = {
> >
> > Type = Bspline;
> > FileName = “TorqueInput.txt”;
> > };
> >
> > F = TorqueIn(t);
> > };
> >
> >
> >
> > This way the moment applied to the joint is directly read the text
> file.
> >
> >
> >
> > Best regards,
> >
> > Sylvain, AnyBody Support
> >
> >
> >
> >
> >
> > _____
> >
> > From: anyscript@yahoogroups.com [mailto:anyscript@yahoogroups.com]
> On Behalf
> > Of alex.purdue
> > Sent: 26. januar 2009 16:02
> > To: anyscript@yahoogroups.com
> > Subject: [AnyScript] Torque Input for bike model
> >
> >
> >
> > Hi Guys,
> >
> > I am currently trying to put a torque profile into the bike model
> > provided in the repository.
> > As the torque ( or crank moment) was being calculated like this :
> > AnyForce CrankMoment ={
> > AnyJoint &Jnt=.CrankJoint;
> > F=
> >
> {…BikeParameters.CrankMomentOffset-
…BikeParameters.CrankMomentAmpcos
> > (4
pit/…BikeParameters.T+ …BikeParameters.CrankMomentPhase)};
> > };
> >
> > i had hoped that i would be able to give it the torque like this:
> >
> > AnyForce CrankMoment =
> > {
> > AnyJoint &Jnt=.CrankJoint;
> >
> > AnyInputFile TorqueIn = {
> > FileName = “TorqueInput.txt”;
> > };
> >
> > AnyVector Time_T = TorqueIn.T;
> > AnyMatrix Data_mat = TorqueIn.Data;
> > F = {Data_mat[t
303/2]};
> >
> > };
> >
> > However i get this error:
> > ‘[’ : Illegal operation for given argument types : ‘AnyFloat[1]
> > [101]’ ‘[’ ‘AnyFloat’
> > For the line which calculates F, i thought it might just be that
it
> > wants a second argument so i added [1] infront of [var] but that
> just
> > returns
> > ‘F’ : Index [1] out of range for ‘AnyFloat[1][101]’
> >
> > Is it possible to get AnyBody to do this? Or is it necessary to go
> > about this in a different way?
> >
> > the file TorqueInput.txt has two columns of data, one with the
time
> > and the other with the torque at that time.
> >
> > Best Regards
> > Alex Purdue
> >
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>

Hi Alex,

What happens is that the AnyKinEqSimpleDriver takes only constant values as
input for the position and velocity. Interpolation functions are not allowed
as input for this driver. So it expects the constant to be evaluated at a
certain moment during the loading, but as you input a variable (variables
are evaluated after constants in the sequence) you got this time dependency
error.

So the solution is to use an AnyKinEqInterpolDriver, this one will
interpolate data like an AnyFunInterpol and use it to drive the measure.
However notice that the AnyKinEqInterpolDriver can only drive the position
and not the velocity. So you will have to calculate the position
corresponding to the cadence and input this data in the
AnyKinEqInterpolDriver.

Best regards,

Sylvain, AnyBody Support


From: anyscript@yahoogroups.com [mailto:anyscript@yahoogroups.com] On Behalf
Of alex.purdue
Sent: 30. januar 2009 17:40
To: anyscript@yahoogroups.com
Subject: [AnyScript] Re: Torque Input for bike model

Hi,

I’m now trying to use the same method to put the cadence in for each
time step (my cadence changes throughout the revolution. Unfortunately
when i try and run this I get an error message saying that the
DriverVel expression is failing at moment ‘DesignVar’ and that the
‘CrankRotation.t’ argument will not be ready for evaluation until
moment ‘TimeVar’.

Here is the code where the error occurs:
AnyKinEqSimpleDriver CrankRotation = {
AnyRevoluteJoint &Jnt = .CrankJoint;
AnyFunInterpol LocalCadence = {
Type = Bspline;
FileName = “CadenceInput.txt”;
};

DriverPos = {0};
DriverVel = {-(LocalCadence(t)/60)pi2};
Reaction.Type = {Off};
};

The cadence file is set up exactly like the torque file was and the
array used for the time matches up exactly with all the times in both
files. Do the drivers get initialised at the start and as such have
issues with time dependence? Any assistance would be greatly
appreciated

Best Regards
Alex Purdue

— In anyscript@yahoogrou <mailto:anyscript%40yahoogroups.com> ps.com,
“alex.purdue” <alex.purdue@…>
wrote:
>
> Hi Sylvain,
>
> Thanks a lot, that works well.
>
> Alex
>
> — In anyscript@yahoogrou <mailto:anyscript%40yahoogroups.com> ps.com,
AnyScript Support
> <anyscriptsup@> wrote:
> >
> > Hi Alex,
> >
> >
> >
> > I think the easiest way is to use an AnyFunInterpol, the code
would
> look
> > like this :
> >
> >
> >
> > AnyForce CrankMoment =
> > {
> > AnyJoint &Jnt=.CrankJoint;
> >
> > AnyFunInterpol TorqueIn = {
> >
> > Type = Bspline;
> > FileName = “TorqueInput.txt”;
> > };
> >
> > F = TorqueIn(t);
> > };
> >
> >
> >
> > This way the moment applied to the joint is directly read the text
> file.
> >
> >
> >
> > Best regards,
> >
> > Sylvain, AnyBody Support
> >
> >
> >
> >
> >
> > _____
> >
> > From: anyscript@yahoogrou <mailto:anyscript%40yahoogroups.com> ps.com
[mailto:anyscript@yahoogrou <mailto:anyscript%40yahoogroups.com> ps.com]
> On Behalf
> > Of alex.purdue
> > Sent: 26. januar 2009 16:02
> > To: anyscript@yahoogrou <mailto:anyscript%40yahoogroups.com> ps.com
> > Subject: [AnyScript] Torque Input for bike model
> >
> >
> >
> > Hi Guys,
> >
> > I am currently trying to put a torque profile into the bike model
> > provided in the repository.
> > As the torque ( or crank moment) was being calculated like this :
> > AnyForce CrankMoment ={
> > AnyJoint &Jnt=.CrankJoint;
> > F=
> >
> {…BikeParameters.CrankMomentOffset-
…BikeParameters.CrankMomentAmpcos
> > (4
pit/…BikeParameters.T+ …BikeParameters.CrankMomentPhase)};
> > };
> >
> > i had hoped that i would be able to give it the torque like this:
> >
> > AnyForce CrankMoment =
> > {
> > AnyJoint &Jnt=.CrankJoint;
> >
> > AnyInputFile TorqueIn = {
> > FileName = “TorqueInput.txt”;
> > };
> >
> > AnyVector Time_T = TorqueIn.T;
> > AnyMatrix Data_mat = TorqueIn.Data;
> > F = {Data_mat[t
303/2]};
> >
> > };
> >
> > However i get this error:
> > ‘[’ : Illegal operation for given argument types : ‘AnyFloat[1]
> > [101]’ ‘[’ ‘AnyFloat’
> > For the line which calculates F, i thought it might just be that
it
> > wants a second argument so i added [1] infront of [var] but that
> just
> > returns
> > ‘F’ : Index [1] out of range for ‘AnyFloat[1][101]’
> >
> > Is it possible to get AnyBody to do this? Or is it necessary to go
> > about this in a different way?
> >
> > the file TorqueInput.txt has two columns of data, one with the
time
> > and the other with the torque at that time.
> >
> > Best Regards
> > Alex Purdue
> >
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>

[Non-text portions of this message have been removed]

Hi Sylvain,

Thanks for that.

Best Regards
Alex

— In anyscript@yahoogroups.com, AnyScript Support <anyscriptsup@…>
wrote:
>
> Hi Alex,
>
>
>
> What happens is that the AnyKinEqSimpleDriver takes only constant
values as
> input for the position and velocity. Interpolation functions are not
allowed
> as input for this driver. So it expects the constant to be evaluated
at a
> certain moment during the loading, but as you input a variable
(variables
> are evaluated after constants in the sequence) you got this time
dependency
> error.
>
>
>
> So the solution is to use an AnyKinEqInterpolDriver, this one will
> interpolate data like an AnyFunInterpol and use it to drive the
measure.
> However notice that the AnyKinEqInterpolDriver can only drive the
position
> and not the velocity. So you will have to calculate the position
> corresponding to the cadence and input this data in the
> AnyKinEqInterpolDriver.
>
>
>
> Best regards,
>
> Sylvain, AnyBody Support
>
>
>
>
>
>
>
>
>
>
>
> _____
>
> From: anyscript@yahoogroups.com [mailto:anyscript@yahoogroups.com]
On Behalf
> Of alex.purdue
> Sent: 30. januar 2009 17:40
> To: anyscript@yahoogroups.com
> Subject: [AnyScript] Re: Torque Input for bike model
>
>
>
> Hi,
>
> I’m now trying to use the same method to put the cadence in for each
> time step (my cadence changes throughout the revolution.
Unfortunately
> when i try and run this I get an error message saying that the
> DriverVel expression is failing at moment ‘DesignVar’ and that the
> ‘CrankRotation.t’ argument will not be ready for evaluation until
> moment ‘TimeVar’.
>
> Here is the code where the error occurs:
> AnyKinEqSimpleDriver CrankRotation = {
> AnyRevoluteJoint &Jnt = .CrankJoint;
> AnyFunInterpol LocalCadence = {
> Type = Bspline;
> FileName = “CadenceInput.txt”;
> };
>
> DriverPos = {0};
> DriverVel = {-(LocalCadence(t)/60)pi2};
> Reaction.Type = {Off};
> };
>
> The cadence file is set up exactly like the torque file was and the
> array used for the time matches up exactly with all the times in
both
> files. Do the drivers get initialised at the start and as such have
> issues with time dependence? Any assistance would be greatly
> appreciated
>
> Best Regards
> Alex Purdue
>
> — In anyscript@yahoogrou <mailto:anyscript%40yahoogroups.com>
ps.com,
> “alex.purdue” <alex.purdue@>
> wrote:
> >
> > Hi Sylvain,
> >
> > Thanks a lot, that works well.
> >
> > Alex
> >
> > — In anyscript@yahoogrou <mailto:anyscript%40yahoogroups.com>
ps.com,
> AnyScript Support
> > <anyscriptsup@> wrote:
> > >
> > > Hi Alex,
> > >
> > >
> > >
> > > I think the easiest way is to use an AnyFunInterpol, the code
> would
> > look
> > > like this :
> > >
> > >
> > >
> > > AnyForce CrankMoment =
> > > {
> > > AnyJoint &Jnt=.CrankJoint;
> > >
> > > AnyFunInterpol TorqueIn = {
> > >
> > > Type = Bspline;
> > > FileName = “TorqueInput.txt”;
> > > };
> > >
> > > F = TorqueIn(t);
> > > };
> > >
> > >
> > >
> > > This way the moment applied to the joint is directly read the
text
> > file.
> > >
> > >
> > >
> > > Best regards,
> > >
> > > Sylvain, AnyBody Support
> > >
> > >
> > >
> > >
> > >
> > > _____
> > >
> > > From: anyscript@yahoogrou <mailto:anyscript%40yahoogroups.com>
ps.com
> [mailto:anyscript@yahoogrou <mailto:anyscript%40yahoogroups.com>
ps.com]
> > On Behalf
> > > Of alex.purdue
> > > Sent: 26. januar 2009 16:02
> > > To: anyscript@yahoogrou <mailto:anyscript%40yahoogroups.com>
ps.com
> > > Subject: [AnyScript] Torque Input for bike model
> > >
> > >
> > >
> > > Hi Guys,
> > >
> > > I am currently trying to put a torque profile into the bike
model
> > > provided in the repository.
> > > As the torque ( or crank moment) was being calculated like this
:
> > > AnyForce CrankMoment ={
> > > AnyJoint &Jnt=.CrankJoint;
> > > F=
> > >
> > {…BikeParameters.CrankMomentOffset-
> …BikeParameters.CrankMomentAmpcos
> > > (4
pit/…BikeParameters.T+
…BikeParameters.CrankMomentPhase)};
> > > };
> > >
> > > i had hoped that i would be able to give it the torque like
this:
> > >
> > > AnyForce CrankMoment =
> > > {
> > > AnyJoint &Jnt=.CrankJoint;
> > >
> > > AnyInputFile TorqueIn = {
> > > FileName = “TorqueInput.txt”;
> > > };
> > >
> > > AnyVector Time_T = TorqueIn.T;
> > > AnyMatrix Data_mat = TorqueIn.Data;
> > > F = {Data_mat[t
303/2]};
> > >
> > > };
> > >
> > > However i get this error:
> > > ‘[’ : Illegal operation for given argument types : ‘AnyFloat[1]
> > > [101]’ ‘[’ ‘AnyFloat’
> > > For the line which calculates F, i thought it might just be that
> it
> > > wants a second argument so i added [1] infront of [var] but that
> > just
> > > returns
> > > ‘F’ : Index [1] out of range for ‘AnyFloat[1][101]’
> > >
> > > Is it possible to get AnyBody to do this? Or is it necessary to
go
> > > about this in a different way?
> > >
> > > the file TorqueInput.txt has two columns of data, one with the
> time
> > > and the other with the torque at that time.
> > >
> > > Best Regards
> > > Alex Purdue
> > >
> > >
> > >
> > >
> > >
> > > [Non-text portions of this message have been removed]
> > >
> >
>
>
>
>
>
> [Non-text portions of this message have been removed]
>