Utility/Data Access SubroutineMODIFY is a utility subroutine that can execute an ADAMS/Solver command from a CONSUB. This function is provided to maintain compatibility between user subroutines already written for ADAMS and MotionSolve.


If you are writing CONSUBs for MotionSolve, it may be easier to use MODSET instead. MODSET is more general. Any attribute in the XML file may be changed.


Fortran Calling Syntax
CALL MODIFY (command, status)
C/C++ Calling Syntax
c_modify (char* command, int* status);
Python Calling Syntax
status = py_modify(command)
MATLAB Calling Syntax
status = m_modify(command)


Character array
Any valid ADAMS/Solver command stored in a character array.


A flag that return the status of the call to MODIFY. ISTAT can have the following values:
  • 0 = Success
Any other value indicates failure.


def consub (par, npar):
    #Purpose of the CONSUB

    #This CONSUB performs 2 simulations:
    #   1. gravity = 1g     (surface of Earth)
    #   2. gravity = 0.38g  (surface of Mars)

    # Behavior on Earth
    istat = py_datout()
    status = py_analys ("TRANSIENT", "Simulation on Earth", 0.0, 1.0, 1)

    # Behavior on Mars
    command = "ACCGRAV/IGRAV=0, JGRAV=0, KGRAV=-3.72742"
    istat = py_modify (command)
    istat = py_datout()
    status = py_analys ("TRANSIENT", "Simulation on Mars", 1.0, 2.0, 1)

    return status


  1. MODIFY may only be called from a CONSUB.
  2. When coupled with other functions that allow you to perform analyses and write output, this is an extremely powerful capability to create higher-level analysis functions.
  3. After a call to MODIFY to change the model topology, the succeeding call to ANALYS must set its initialization flag to 1. This causes the equations to be reformulated and the effect of the model modification is taken into account.
  4. In cases where only some model parameters are being changed with MODIFY, it is acceptable to not reformulate the equations in the succeeding call to ANALYS.