hexagon logo

Contact incinident information

Hello,
 
I am trying to extract information about the contact incidents in Adams, in order to exact the times at wich more than 1 gear tooth pair of an involute gear model come into contact. I understand that after the simulation, I can look at the contact incidents and tracks, but if possible, I'd like to be able to extract the incidents during simulation, in the form of measurements.
 
Thanks,
 
Josef K.
  • 1. Yes. You can compile subroutines that are written in FORTRAN or C and use the with Adams Solver (C++).
     
    2. For the FORTRAN routines, you see that we use the IMPACT() utility routine. To learn more about the available utility routines, please refer to the Adams Online Help and navigate to:
     
    Adams Basic Package > Adams Solver > Welcome to Adams Solver Subroutines > Utility Subroutines
     
    3. As stated in #2, you can find the IMPACT() utility routine and CALL it in your CNFSUB. Please refer to the example articles shared above. The docs for the IMPACT() utility routine is found in the Adams Online Help at:
     
    Adams Basic Package > Adams Solver > Welcome to Adams Solver Subroutines > Utility Subroutines > IMPACT
     
    The CONTACT statement also details the theory behind Adams Contact, which is found at:
     
    Adams Basic Package > Adams Solver > Welcome to the C++ Version of Adams Solver > C++ Statements > CONTACT
     
    --
    I also recommend that you review the Adams Contact webinar below:
     
     
    Thank you,
    Maziar Rostamian
     
  • Hi Maziar,
     
    So far I have viewed and studied extensively all the documentation you provided and while it was helpful in understanding how subroutines work, I still have the same problems with the utilties such as the c_errmes function. I am attatching a screenshot of the error I get when trying to create the dll. I am using MVSC 2022 developer command propmt, and an adams2020 version. I tried creating a dll with the default cffsub.c function, so that I am certain that the source code is correct.
     
    image
    I know that the warnings realted to the x86 version of windows are because of the MVSC version, however the c_errmes and c_step functions are still nowhere to be found. I have unclude the slv_c_utils.h file since it is automatically included in the cffsub.c routine, but the c_errmes and c_step functions are still not located by the code.
     
    If I got how subroutines work in Adams correctly, I am guessing that one of the .lib/.dll files in the win64 directory contains the actual bodies of the c_errmes and c_step functions, as in the slv_c_utils.h file, only their definition is included with no function "body". I still don't get why Adams can't access them in order for them to be included in my dll.
     
    To summarize, it's as if I am trying to call a function without having ever defined it (for the c_errmes and c_step functions).
     
    Thanks,
     
    Josef
  • Josef,
     
    Where have you placed the slv_c_utils.h file? Is it in your working directory?
     
    Thank you,
    Maziar
  • Hi Maziar,
    Yes, I have it in the same directory as the cffsub.c file.
    The process I follow is to create a new directory, copy the cffsub.c and slv_c_utils.h files inside it, launch Microsoft Visual Studio 2022 and its developer command prompt, and access the directory via the cd command
    ​regards,
    Josef​
  • Hi Josef,
     
    I have prepared a simple example of C code (sfosub.c) in which c_errmes is used and an Adams model (platform_isolator_start.cmx) which are attached here. You may use this example to check if you can generate a subroutine. Then you can modify this code to generate your subroutine.
     
    Open an Adams command prompt and navigate to the directory where your model and the source C code exist and use the following commands to generate the .dll file:
     
    adams20xx_x (for example adams2021_4) -> cr-user -> n -> the name of your C code file (for example sfosub.c) -> Enter -> name of .dll file (for example solverc.dll)
     
    As such, a .dll file is generated. Now you can import the attached Adams model to your Adams view session.
     
    Modify the force, damping_actuator, and insert the following expression in front of User Parameters:
     
    (.platform_isolator.base.MARKER_33.adams_id),(.platform_isolator.ground.MARKER_34.adams_id),1.0,0.0
     
    In order to use the subroutine insert, solverc, in front of Routine.
     
    Now if you run the simulation an error message should pops up. This shows that the function, c_errmes, in the code in working properly.
     
    Change the extension of the model from .cmx to .cmd before using.
     
    Thank you,
    Ghasem

    Attached Files (1)
  • Hello gabba,
     
    thank you for the code provided, but still, this doesn't seem to work. The error remains exactly the same. The only other possible explanation that I have, is if the problem is the compiler version, which is the 2022 version of Visual studio and not the 2017 one. Is it possible that changing the comipler will fix this?
     
    Thanks,
     
    Josef K.
  • Hello,
     
    I figured out what my problem was. The default setting of MVSC was x86 build. Using the developer command prompt for x64 build did the trick.
     
    Thanks!
     
    Josef