🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Evaluate functions in template

User: "CdricCd"
Altair Community Member
Updated by CdricCd

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/>

<?xml version="1.0" encoding="UTF-8"?>model.PNG

Find more posts tagged with