Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

CoSimulation

Janis Sprenger edited this page Feb 18, 2021 · 1 revision

Co-Simulation

As outlined in the previous chapter, the main responsibility of the co-simulation is to orchestrate multiple MMUs based on a list of specified instructions (MInstruction). In particular, the co-simulation needs to schedule the MMUs and incorporate the provided results. Analogously to the MMUs, a common interface for the co-simulation is proposed in the following. Figure 9 gives an overview of the derived interface, whereas below a detailed description is provided.

<<interface>>
MCoSimulation
+ID: string
+SceneAccess: MSceneAccess
+ServiceAccess: MServiceAccess
+SkeletonAccess: MSkeletonAccess
+Initialize(avatar: MAvatarDescription, mmus: list, priorities: map<string,double>): MBoolResponse
+Initialize(avatar: MAvatarDescription, properties: map<string,string>): MBoolResponse
+AssignInstruction(instruction: MInstruction, state: MSimulationState): MBoolResponse
+DoStep(time: double, state: MSimulationState)
+CheckPrerequisites(instruction: MInstruction)
+GetBoundaryConstraints(instruction: MInstruction)
+Abort(instructionID: string)
+Dispose(properties: map<string,string>)
+ExecuteFunction(name: string, parameters: map<string,string>): map<string,string>

Detailed description of available parameters/functions:

Function/ Parameter Name Description
ID Unique id of the Co-Simulation instance.
SceneAccess Instance provides access to the scene (automatically set by the adapter).
ServiceAccess Instance provides access to the services (automatically set by the adapter).
SkeletonAccess Instance provides access to the helper functions of the avatar (automatically set by the adapter).
Initialize Method is used to initialize the Co-Simulation. The function provides the description of the utilized avatar and additional properties as input. The co-simulation needs to return the information whether the initialization was successful. Specifically, for the co-simulation the utilized MMUs and the priorities needs to be provided. For compatibility with the MMU interface, the initialize function with the same signature as the MMU interface must be provided.
AssignInstruction The method is used to assign a specific MInstruction to the co-simulation. Note that, the MInstruction class can contain a list of multiple instructions. In this way, a set of different tasks can be assigned at once.
DoStep The DoStep method is called once a frame in order to trigger the computation of a new posture. In particular, the simulation frame time, as well as the current simulation state (MSimulationState) are provided as input. The co-simulation returns the computed results (MSimulationResult).
CheckPrerequisites Method is provided for compatibility with the MotionModelUnit interface.
GetBoundaryConstraints Method is provided for compatibility with the MotionModelUnit interface.
Abort The method aborts a specified instruction.
Dispose The method disposes the co-simulation including all ongoing computations.
ExecuteFunction Debug functionality to call additional functions. This method should be only used for debugging purposes.
Note
Deprecated: MCoSimulation could not be found in the thrift files

The interface is strongly related to the interface of the Motion Model Unit. A reason for this is, that nested MMUs that co-simulate other MMUs must be allowed within the framework. Therefore, the co-simulation must be accessible in an identical way as the MMU. The main difference between the co-simulation and MMUs are with regard to the initialization. For the co-simulation the list of the utilized MMUs as well as the priorities, need to be additionally provided as input. The overall task of the co-simulation is to coordinate multiple MMUs and instructions. To allow the specification of multiple instructions, the MInstruction class can contain a list of further instructions. Even though the interface is strongly similar to the interface of the MMU, depending on the utilized environment, the co-simulation can be extended with custom functionalities (e.g., w.r.t. behavior modeling) or directly embedded in the target engine using an entirely different interface.

MCoSimulationEvents

MCoSimulationEvents
+Events: list
+SimulationTime: double
+FrameNumber: i32

Detailed description of available parameters/functions:

Parameter Name Required Description
Events
SimulationTime
FrameNumber

MCoSimulationEventCallback

<<interface>>
MCoSimulationEventCallback
+OnEvent(event: MCoSimulationEvents)
+OnFrameEnd(newPosture: MAvatarPostureValues)

Detailed description of available parameters/functions:

Function/ Parameter Name Description
OnEvent
OnFrameEnd

MCoSimulationAccess

<<interface>>
MCoSimulationAccess
+RegisterAtEvent(clientAddress: MIPAddress, eventType: string): MBoolResponse
+UnregisterAtEvent(clientAddress: MIPAddress, eventType: string): MBoolResponse
+AssignInstruction(instruction: MInstruction, properties: map<string,string>): MBoolResponse
+Abort(): MBoolResponse
+AbortInstruction(instructionID: string): MBoolResponse
+AbortInstructions(instructionIDs: list): MBoolResponse
+GetHistoryFromTime(startTime: double, endTime: double, eventType: string): list
+GetHistoryFromFrames(fromFrame: i32, toFrame: i32, eventType: string): list
+GetHistory(eventType: string): list
+GetCurrentEvents(): MCoSimulationEvents

Detailed description of available parameters/functions:

Function/ Parameter Name Description
RegisterAtEvent
UnregisterAtEvent
AssignInstruction
Abort
AbortInstruction
AbortInstructions
GetHistoryFromTime
GetHistoryFromFrames
GetHistory
GetCurrentsEvents

MOSIM Documentation

Introduction

Documentation

Known Issues

Clone this wiki locally