• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Adams
  3. Is it possible to call a function in GCON which is implemented...

Following Cadence Design Systems’ acquisition of the Design & Engineering (D&E) business, the D&E Community Forum on the Nexus Community Center has been migrated in the Cadence Physical System Simulation Community. For more details and if you have any questions, please refer to the FAQ.

Stats

  • State Not Answered
  • Replies 2
  • Subscribers 3
  • Views 8
  • Members are here 0
More Content

Is it possible to call a function in GCON which is implemented as user written subroutine in C++

WWitteve
WWitteve over 7 years ago
GCON forces a function to be zero. Is it possible to call such a function which is implemented as user written subroutine in C. If yes, is there an example available?
Thanks in advance,
Wolfgang Witteveen
 
  • Sign in to reply
  • Cancel
  • MK202610123211
    0 MK202610123211 over 7 years ago
    What I tried in the past was creating a solver variable that was using DM(i,j) and a GCON refering to varval(var). That worked fine.
     
    If the var is a usersub, I'd expect the solver needs to know about the dependencies. In good old Fortran that was done by calling things like SYSFNC when IFLAG being TRUE.
    I don't know how a c-code handles that, but I assume that it works the same way.
     
    In <topdir>/solver/c_usersubs/varsub.c you'll find an example that you can try.
    If you modify it to always return DZ(par(1), Par(2))-20, then I'd expect a GCON with varval(var) should keep the marker distance in Z to 20.
     
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Fredrik Sjogren
    0 Fredrik Sjogren over 7 years ago
    Hi Wolfgang,
     
    Accessing a state variable defined by a user-written subroutine (VARSUB) is not supported in a GCON. From the solver documentation:
     
    The ability of the Adams Solver (C++) to handle function expressions to provide the necessary derivatives required by the GCON does not extend to user subroutines. Consequently, a VARIABLE can only be referenced in a GCON provided it is defined using function expressions, rather than a VARSUB subroutine.
     
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2026 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information