implement component behavior using simscape -凯发k8网页登录

main content

implement component behavior using simscape

a physical subsystem is a simulink® subsystem with simscape™ connections.

a physical subsystem with simscape connections uses a physical network approach suited for simulating systems with real physical components and represents a mathematical model.

using simscape behaviors for components in system composer™ improves model simulation and design for systems with physical components. this functionality requires a simscape license. for more information, see (simscape).

you can simulate the simscape component implementations in system composer. use the simulation data inspector to view and compare simulation results between model designs.

to describe component behavior in simscape for a system composer architecture model, follow these steps:

open this model to interact with a system composer architecture model named fan with simscape behavior on a component dc motor. the steps in this tutorial will produce this model.

note

this example uses simscape blocks. if you do not have a simscape license, you can open and simulate the model but can only make basic changes, such as modifying block parameters.

architecture model with simscape behavior for a dc motor

this example shows a dc motor in an architecture model of a fan. the dc motor is modeled using a simscape behavior within a simulink subsystem component.

define physical ports on component

a physical port represents a simscape physical modeling connector port called a (simscape).

use physical ports to connect components in an architecture model or to enable physical systems in a simulink subsystem.

create a new system composer architecture model. add a component called dc motor to the canvas. to add physical ports to the component, pause on the boundary of the component until a port outline appears. click the port outline and, from the options, select physical.

the dc motor component with 4 physical ports

physical ports can also be used to connect to simscape blocks.

note

components with physical ports cannot be saved as architecture models, model references, software architectures, or stateflow® chart behaviors. components with physical ports can only be saved as subsystem references or subsystem component behaviors.

specify physical interfaces on ports

you can specify physical interfaces on the physical ports.

a physical interface defines the kind of information that flows through a physical port. the same interface can be assigned to multiple ports. a physical interface is a composite interface equivalent to a object that specifies any number of objects.

use a physical interface to bundle physical elements to describe a physical model using at least one physical domain.

a physical element describes the decomposition of a physical interface. a physical element is equivalent to a object.

define the type of a physical element as a physical domain to enable use of that domain in a physical model.

  1. to open the , navigate to modeling > interface editor.

  2. to add a new physical interface definition, click the list next to the add data interface icon and select physical interface. name the physical interface electricalinterface.

  3. to add a physical element to the physical interface, click the add data element icon. physical interface and physical element names must be valid matlab® variable names. create the physical elements positive and negative.

  4. in the type column, define the simscape domain to which these physical elements belong. in this case, both belong to foundation.electrical.electrical.

    physical interfaces and elements with domains for the fan model

  5. select the e port on the dc motor component. right-click the electricalinterface physical interface on the and click assign to selected port(s).

create simulink subsystem component

you can create a simulink subsystem in system composer to enable direct simscape integration. for more information, see create simulink subsystem behavior using subsystem component.

select the dc motor component. navigate to modeling > create simulink behavior, or use the right-click menu on the component.

create simulink behavior with type subsystem for dc motor

click ok.

subsystem component dc motor

you can convert a subsystem component that is part of the parent system composer model into a subsystem reference behavior then save and reuse the subsystem as a separate artifact. for more information, see convert simulink subsystem component to subsystem reference component.

describe component behavior using simscape

double-click the subsystem component to describe component behavior using simscape. for the dc motor this example is based on, see (simscape).

the physical interface can be decomposed into physical elements using a simscape bus. each physical element represents a conserving connection associated with a domain in simscape. simscape buses bundle conserving connections. for more information, see (simscape).

add a simscape bus block next to the e physical port. double-click the simscape bus and select the connection type bus: electricalinterface. connect the e physical port to the simscape bus block. the domain foundation.electrical.electrical defined under the type of the positive and negative physical elements are used for any connections from these ports.

simscape bus blocks with physical elements inside

you can also use owned interfaces defined locally on ports to enable domain-specific lines on a simscape behavior model in system composer. edit the port interface through the . navigate to modeling > property inspector. in this case, simscape bus blocks are not needed, and the port can connect directly to the physical connection of the specified domain. add an owned physical interface to the physical port r with type as a foundation.mechanical.rotational.rotational domain. selecting edit to open in enters the port interface view in the . for more information, see .

owned interface for v  physical port

using the library browser, retrieve the following simscape blocks and construct the dc motor model with electrical and rotational mechanical domain-specific connectors.

a physical connector can represent a nondirectional conserving connection of a specific physical domain. connectors can also represent physical signals.

use physical connectors to connect physical components that represent features of a system to simulate mathematically.

for more information, see (simscape).

simscape model for dc motor

physical modeling uses the network approach and is therefore different from regular simulink modeling. for more information, see (simscape) and (simscape).

see also

| | | | |

related topics

网站地图