Results Element |
||||||||||||||
Class NameSimulationResults Description |
||||||||||||||
SimulationResults is a container object containing the results from a simulation. A simulation can contain many output time steps. At each output time, the following information is stored:
The structure of SimulationResults is shown below.
The population of the results data is automatically done by the model.simulate() method when it is invoked with returnResults=True. |
||||||||||||||
Usage |
||||||||||||||
# # Generate a SimulationResults object #
run = model.simulate (type="DYNAMICS", end=None, dtout=None, duration=None, steps=None, dsa="", start=None, onOutputStep=None, returnResults=True)
# # Query simulationResults object for element specific data #
BodyResult = run.getObject (a_specific_body) ReqResult = run.getObject (a_specific_request) RVResult = run.getObject (a_specific_rv)
# # Extract time history of desired signal from element specific data #
signal = BodyResult.getComponent (“body_attribute”) signal = ReqResult.getObject (“request_attribute”) signal = RVResult.getObject (“rv_attribute”)
# # Extract desired signal information for a specific step #
data = BodyResult.getStep (step=timeStep) data = ReqResult.getStep (step=timeStep) data = RVResult.getStep (step=timeStep)
|
||||||||||||||
Description |
||||||||||||||
run |
SimulationResults Object Generated by the simulate method.
Upon completion of a simulation, the simulate method returns the entire time history of the simulation in a SimulationResults object -- a container that holds all BodyResults, RequestResults and RVResults. These results are generated only when returnResults=True. |
|||||||||||||
getObject |
Method on SimulationResults Object
This method queries the SimulationResults object and returns the results for a specific Body (BodyResult), a specific Request (RequestResult) or a specific RV (RVResult. getObject should be called only when returnResults=True for the simulation. |
|||||||||||||
getComponent |
Method on BodyResult, ReqResult and RVResult objects
This method queries a BodyResult, ReqResult or RVResult object and returns the time history of a specific attribute of the object. For a complete list of attributes for each type of result, see BodyResult, RequestResult and RVResult. getComponent should be called only when returnResults=True for the simulation. |
|||||||||||||
getStep |
Method on BodyResult, ReqResult and RVResult objects
This method queries a BodyResult, ReqResult or RVResult object and returns all of its data for a specific time step. For a complete list of attributes for each type of result, see BodyResult, RequestResult and RVResult. getStep should be called only when returnResults=True for the simulation. |
|||||||||||||
Comments
Example
Create a model, M. Then:
|
||||||||||||||
# Perform a simulation run = M.simulate(type=”DYNAMICS”, end=2, steps=200, returnResults=True)
# Get the force request data from the run object req = run.getObject (model.forceRequest1)
# Extract the time and FZ signals times = req.getComponent (“times”) FZ = req.getComponent ("FZ")
# Plot the signal import matplotlib.pyplot as plt plotTitle = forceRequest1.label + “ vs. Time” plt.plot (times, FZ) plt.title (plotTitle) plt.xlabel(“Time”) plt.ylabel (“force [N]”) plt.grid (True) plt.show() |