Jump to content
Sign in to follow this  
CdricCd

Evaluate functions in template

Recommended Posts

Hello guys,

 

I'm new here and I have a little problem I'm sure you can handle ;)

 

I will present you my model so if you want you can suggest different solution than mine :)

 

[MODEL]

 

I'm trying to model the stiffness of a spring acting on a shift moving along his X axis by putting a force. The "difficulty" is that we have different responses whether the shift is moving along +X or -X. So I have two curves (force vs displacement), one for the stiffness while the shift is moving along +X and the other one for the stiffness while the shift is moving along -X.

 

[SOLUTION]

 

The idea was to create 2 forces (with one curve attached to each other) at the point where the spring acts, and for example deactivate one force while the shift is moving in one direction and when it moves in the other direction, deactivate this force and activate the the other one etc.

So I wanted to create a template in which I activate/deactivate the concerned forces as a function of the sense of the velocity of the shift by using two markers (see picture).

 

[PROBLEM]


So I use the VX({marker0},{marker1}) function in the template but it says " Unknown function "VX" in expression: velx = VX({m_1.idstring},{m_0.idstring}) "

I tried with " ` ` " but it had non effect.

 

So my question is : How to evaluate this function is the template ?

 

I join you a picture of the model and the little script I use for the Simulation Commands (Write text to solver command file).

I'm a beginner with the scripted simulation so it can be totally wrong :)

 

Thank you !

 

 

Here the script :

 

 

<Simulate

   analysis_type  = "Transient"

   end_time       = "1.0"

   print_interval = "0.001"

/>

 

{velx = VX({m_1.idstring},{m_0.idstring})}

 

{if (velx<0)}

     <Activate

   element_type = "FORCE"

   element_id   = "30101"

/>

 

<Deactivate

   element_type = "FORCE"

   element_id   = "30102"

/>

 

{elseif(velx>0)}

     <Activate

   element_type = "FORCE"

   element_id   = "30102"

/>

 

<Deactivate

   element_type = "FORCE"

   element_id   = "30101"

/>

 

{endif}

 

<Stop/>

model.PNG

Share this post


Link to post
Share on other sites
Guest

Hi @CdricCd

 

Use ` ` (the key below Esc on keyboard) and check if there are any syntax errors.

 

If everything is fine and you still get the same error, please share the model file. (use the flie transfer link in my signature)

Share this post


Link to post
Share on other sites
Guest

Hi,

VX({m_1.idstring},{m_0.idstring})`  is a MotionSolve runtime expression

it is evaluated by MotionSolve..

template cannot do it...

 

But this can be done through expression, I will update to you soon. 

Share this post


Link to post
Share on other sites
19 hours ago, CdricCd said:

[MODEL]

 

I'm trying to model the stiffness of a spring acting on a shift moving along his X axis by putting a force. The "difficulty" is that we have different responses whether the shift is moving along +X or -X. So I have two curves (force vs displacement), one for the stiffness while the shift is moving along +X and the other one for the stiffness while the shift is moving along -X.

 

 

I also stuck in the same problem. Though couldnt find out the solution. Your idea is pretty cool

Share this post


Link to post
Share on other sites

So I come back for the news and the solution works perfectly. I just have to use the LINSPL function instead of the AKISPL one and add a lot of point on the curve in order to make a correct interpolation.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...