Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To set up Jupyter Notebook

...

  • In Jupyter Notebook, run the following command to install a Python package from the <

    modeling_tool_installation_directory>

    install_root>\plugins\com.nomagic.magicdraw.simulation\pyST.zip

     file

     file:

    Code Block
    %pip install pyST.zip


...

The following table describes the parameters used in the request:

ParameterInRequired or optionalDescription
server_hostpathrequiredThe Teamwork Cloud server host name.
server_portpathrequiredThe Teamwork Cloud server port.
TWC_user_namepathoptional

The Teamwork Cloud user name. If you do not specify the user name in the request, an input field will be provided to specify it later.

TWC_user_passwordpathoptionalThe Teamwork Cloud password. If you do not specify the password in the request, an input field will be provided to specify it later.


Tip

For instructions on how to run server-side simulation using SSL, refer to Running server-side simulation with SSL


Get the list of Teamwork Cloud projects

...

The following table describes the parameters used in the request:

ParameterInRequired or optionalDescription
projectpathrequiredThe Teamwork Cloud project name or ID.
versionpathoptionalThe Teamwork Cloud project version.
branchpathoptionalThe project branch name or ID. If the branch is omitted, the trunk is used instead.
element_idpathoptionalThe server ID of the Instance Specification to be executed.
configpathrequiredThe Simulation Configuration name or server ID.
auto_startpathoptional

Starts the simulation automatically after the initialization phase is completed. Available values are:

    • true (default) - performs the initialization phase and then starts the simulation (the simulation clock is started).
    • false - only the initialization phase of the simulation is performed. The simulation then waits for an invocation to start the simulation, do a step, or terminate the simulation. 

      Note
      The ?autoStart query parameter is ignored when multiple iterations are running, e.g. Tradestudy, Montecarlo, or table simulation




commit_results pathoptional

Commits a new project version with the simulation results. Available values are True or False (default).

verificationpathoptional

Returns the selected verification results. Available values are:

    • All - all verification results are returned.
    • None - no verification results are returned.
    • Fail (default) - verification results with the fail status are returned.
datapathoptionalA set of output parameters, which will be obtained after the simulation is complete.


Code Block
titleRequest and response examples
 # SpaceCraftMassRollup sample

parameters = {
    "inputs":
   {
       "telecom.antenna.me":10,
        "telecom.amplifier.me":20
   },
 "outputs": 
    [ 
        "me",
        "propulsion.me",
        "propulsion.tank.me",
        "propulsion.thruster.me",
        "telecom.me",
        "telecom.antenna.me",
        "telecom.amplifier.me"
    ] 
}
        
client.run('SpacecraftMassRollup_SimWeb', config='spacecraft mass analysis', commit_results=False, data=json.dumps(parameters))

...

The following table describes the parameters used in the request:

ParameterInRequired or optionalDescription
simulation_idpathrequiredThe ID of a specific simulation.


Start simulation

Panel
borderColorlightgrey
borderWidth1

client.start(<simulation_id>)

...

The following table describes the parameters used in the request:

ParameterInRequired or optionalDescription
simulation_idpathrequiredThe ID of a specific simulation.


Start simulation and get results

...

The following table describes the parameters used in the request:

ParameterInRequired or optionalDescription
projectpathrequiredThe Teamwork Cloud project name or ID.
versionpathoptionalThe Teamwork Cloud project version.
branchpathoptionalThe project branch name or ID. If the branch is omitted, the trunk is used instead.
element_idpathoptionalThe server ID of the Instance Specification to be executed.
configpathrequiredThe Simulation Configuration name or server ID.
commit_results pathoptional

A new project version is committed with the simulation results. Available values are True or False (default).

verificationpathoptional

Returns the selected verification results. Available values are:

    • All - all verification results are returned.
    • None - no verification results are returned.
    • Fail - verification results with the fail status are returned including the main status and the status of requirements and constraints.

If the verification value is not specified, only the verification results with the fail status are returned when the get_results endpoint is called.

datapathoptionalA set of output parameters, which will be obtained after the simulation is complete.


Code Block
titleRequest and response examples
 # SpaceCraftMassRollup sample

parameters = {
    "inputs":
   {
       "telecom.antenna.me":10,
        "telecom.amplifier.me":20
   },
 "outputs": 
    [ 
        "me",
        "propulsion.me",
        "propulsion.tank.me",
        "propulsion.thruster.me",
        "telecom.me",
        "telecom.antenna.me",
        "telecom.amplifier.me"
    ] 
}
        
client.simulate('SpacecraftMassRollup_SimWeb', config='spacecraft mass analysis', commit_results=False, data=json.dumps(parameters))

...

The following table describes the parameters used in the request:

ParameterInRequired or optionalDescription
simulation_idpathrequiredThe ID of a specific simulation.


Code Block
titleRequest and response examples
 client.get_status('b583a710-c538-4d7d-b49c-337673bce9a4')

{'state': "RUNNING',
 'simulationId': 'b583a710-c538-4d7d-b49c-337673bce9a4',
 'simulationTime': '310 ms',
 'ui': '<server_address>/simulation/api/ui/b583a710-c538-4d7d-b49c-337673bce9a4',
 'elapsedTime': 12539}

...

The following table describes the parameters used in the request:

ParameterInRequired or optionalDescription
simulation_idpathrequiredThe ID of the running simulation.
variablespathoptionalThe set of simulation variables that should be obtained. If no variables are specified, the values of all simulation variables are returned.

Set simulation variables

Panel
borderColorlightgrey
borderWidth1
borderStylesolid

client.set_variables(<simulation_id>, variables=json.dumps(<parameters>))

...

The following table describes the parameters used in the request:

ParameterInRequired or optionalDescription
simulation_idpathrequiredThe ID of the running simulation.
variablespathrequiredThe set of simulation variables with values that should be used during the current simulation.
contextpathoptionalThe context ID.
property_pathpathoptionalThe property path of the context specified using property names or IDs.


Code Block
titleRequest and response examples
var = {
 "variables":
 {
 "position": 40
 }
}

client.set_variables('23ceff24-28fa-47e4-b29f-b6b60b4b12e3', variables=json.dumps(var))

...

The following table describes the parameters used in the request:

ParameterInRequired or optionalDescription
simulation_idpathrequiredThe ID of the running simulation.


Get the list of running simulations

...

The following table describes the parameters used in the request:

ParameterInRequired or optionalDescription
simulation_idpathrequiredThe ID of a specific simulation.


Check for Simulation Configurations

...

The following table describes the parameters used in the request:

ParameterInRequired or optionalDescription
projectpathrequiredThe Teamwork Cloud project name or ID.
versionpathoptionalThe Teamwork Cloud project version.
branchpathoptionalThe project branch name or ID. If the branch is omitted, the trunk is used instead.
element_idpathoptionalThe server ID of the Instance Specification to be executed.


Get Simulation Configurations

...

The following table describes the parameters used in the request:

ParameterInRequired or optionalDescription
projectpathrequiredThe Teamwork Cloud project name or ID.
versionpathoptionalThe Teamwork Cloud project version.
branchpathoptionalThe project branch name or ID. If the branch is omitted, the trunk is used instead.


Get Simulation Configuration descriptor

...

The following table describes the parameters used in the request:

ParameterInRequired or optionalDescription
projectpathrequiredThe Teamwork Cloud project name or ID.
versionpathoptionalThe Teamwork Cloud project version.
branchpathoptionalThe project branch name or ID. If the branch is omitted, the trunk is used instead.
configpathrequiredThe Simulation Configuration name or server ID.


Code Block
titleRequest and response examples
 client.get_descriptor('SpacecraftMassPollup_SimWeb', config='spacecraft mass analysis')

{'config': 'spacecraft mass analysis',
 'description': 'Simulation Config that is dedicated to run spacecraft mass rollup.',
 'model': 'spacecraft',
 'parameters': {'inputs': [{'parameter': 'telecom.amplifier.me',
    'value': 32.0,
    'type': 'mass[kilogram]',
    'unit': 'kilogram',
    'requirements': [{'id': '1',
      'text': 'Estimated mass shall be less than allocated mass'}]},
   {'parameter': 'telecom.antenna.me',
    'value': 32.0,
    'type': 'mass[kilogram]',
    'unit': 'kilogram',
    'requirements': [{'id': '1',
      'text': 'Estimated mass shall be less than allocated mass'}]},
   {'parameter': 'propulsion.tank.me',
    'value': 68.0,
    'type': 'mass[kilogram]',
    'unit': 'kilogram',
    'requirements': [{'id': '1',
      'text': 'Estimated mass shall be less than allocated mass'}]},
   {'parameter': 'propulsion.thruster.me',
    'value': 68.0,
    'type': 'mass[kilogram]',
    'unit': 'kilogram',
    'requirements': [{'id': '1',
      'text': 'Estimated mass shall be less than allocated mass'}]}],
  'outputs': [{'parameter': 'telecom.me',
    'value': 32.0,
    'type': 'mass[kilogram]',
    'unit': 'kilogram',
    'requirements': [{'id': '1',
      'text': 'Estimated mass shall be less than allocated mass'}]},
   {'parameter': 'propulsion.me',
    'value': 68.0,
    'type': 'mass[kilogram]',
    'unit': 'kilogram',
    'requirements': [{'id': '1',
      'text': 'Estimated mass shall be less than allocated mass'}]},
   {'parameter': 'me',
    'value': 95.0,
    'type': 'mass[kilogram]',
    'unit': 'kilogram',
    'requirements': [{'id': '1',
      'text': 'Estimated mass shall be less than allocated mass'}]}]}}

...