0 Replies Latest reply on Jul 15, 2018 2:09 PM by Manuel González

    Update simulation parameters from external source

    Manuel González

      My simulation model is just an step in a complex simulation workflow involving other software. Therefore, I need to run the simulation studies using model parameters (e.g. force values) generated in the previous step of the simulation workflow. Design studies are not well suited for my task, so I will run the simulations from an external program using the SolidWorks API.

       

      I have created simulation parameters linked to feature parameters in the simulation model:

      http://help.solidworks.com/2017/english/solidworks/cworks/parameters_2.htm

       

      Now my problem is how to update the simulation parameters from an external source (a program, a text file …), without using the SolidWorks GUI.

       

      Workflow 1

      The idea is link simulation parameters to an external file, like global variables:

      2018 SOLIDWORKS Help - Exporting and Linking Equations to External Files

       

      Create global variables with the parameter values and link them to an external file.

      Example: “globalvar_spring_stiffness”=100

      Then, create simulation parameters of type “global variable” and link them to the global variables.

      Example: “simparam_spring_stiffness”= “globalvar_spring_stiffness” = 100

      Then link the simulation parameters of type “simulation” to the previous simulation parameter using an expression.

      Example: “spring_stiffness” = “simparam_ spring_stiffness”.

      But this always triggers an “Error: Syntax error”. I think it is related to this sentence in the help: “The units of the expression must be compatible with the defined parameter”. The problem is that global variables only can have lenthg units.

       

      Workflow 2

      Modify simulation parameters from an external program using SolidWorks Simulation API. But I could not find any API method to modify a simulation parameter.

       

      Workflow 3

      Use the API to read parameter values from an external text file and then update the model parameters directly, without using simulation parameters.

      I would like to avoid this, because it means writing more code: each kind of model parameter (force, acceleration, stiffness …) needs its own method.

       

      Thanks.