﻿ Electrical Circuit Simulation Example | Enterprise Architect User Guide

#### Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

 Contents
 Prev Next

# Electrical Circuit Simulation Example

In this section, we will walk through the creation of a SysML parametric model for a simple electrical circuit, and then use a parametric simulation to predict and chart the behavior of that circuit.

Circuit Diagram

The electrical circuit we are going to model, shown here, uses a standard electrical circuit notation. The circuit includes an AC power source, a ground and a resistor, connected to each other by wires.

Create SysML Model

This table shows how we can build up a complete SysML model to represent the circuit, starting at the lowest level types and building up the model one step at a time.

Component

Action

Types

Define Value Types for the Voltage, Current and Resistance. Unit and quantity kind are not important for the purposes of simulation, but would be set if defining a complete SysML model. These types will be generalized from the primitive type 'Real'. In other models, you can choose to map a Value Type to a corresponding simulation type separate from the model. Additionally, define a composite type called ChargePort, which includes properties for both Current and Voltage. This type allows us to represent the electrical energy at the connectors between components. Blocks

In SysML, the circuit and each of the components will be represented as Blocks. Create a Circuit Block in a Block Definition Diagram (BDD). The circuit has three parts: a source, a ground, and a resistor. These parts are of different types, with different behaviors. Create a Block for each of these part types. The three parts of the Circuit Block are connected through Ports, which represent electrical pins. The source and resistor have a positive and a negative pin. The ground has only one pin, which is positive. Electricity (electric charge) is transmitted through the pins. Create an abstract block 'TwoPinComponent' with two Ports (pins). The two Ports are named 'p' (positive) and 'n' (negative), and they are of type ChargePort.

This figure shows what the BDD should look like, with the blocks Circuit, Ground, TwoPinComponent, Source and Resistor. Internal Structure

Create an Internal Block Diagram (IBD) for Circuit. Add properties for the Source, Resistor and Ground, typed by the corresponding Blocks. Connect the Ports with connectors. The positive pin of the Source is connected to the negative pin of the Resistor. The positive pin of the Resistor is connected to the negative pin of the Source. The Ground is also connected to the negative pin of the Source. Notice that this follows the same structure as the original circuit diagram, but the symbols for each component have been replaced with properties typed by the Blocks we have defined.

Constraints

Equations define mathematical relationships between numeric properties. In SysML, equations are represented as constraints in Constraint Blocks. Parameters of Constraint Blocks correspond to SimVariables and SimConstants of Blocks ('i', 'v', 'r' in this example), as well as to SimVariables present in the type of the Ports ('pv', 'pi', 'nv', 'ni' in this example).

Create a Constraint Block 'TwoPinComponentConstraint' to define parameters and equations common to sources and resistors. The equations should state that the voltage of the component is equal to the difference between the voltages at the positive and negative pins. The current of the component is equal to the current going through the positive pin. The sum of the currents going through the two pins must add up to zero (one is the negative of the other). The Ground constraint states that the voltage at the Ground pin is zero. The Source constraint defines the voltage as a sine wave with the current simulation time as a parameter. This figure shows what these constraints should look like in a BDD. Bindings

The values of Constraint parameters are equated to variable and constant values with binding connectors. Create Constraint properties on each Block (properties typed by Constraint Blocks) and bind the Block variables and constants to the Constraint parameters to apply the Constraint to the Block. These figures show the bindings for the Ground, the Source and the Resistor respectively.

For the Ground constraint, bind gc.pv to p.v. For the Source constraint, bind:

• sc.pi to p.i
• sc.pv to p.v
• sc.v to v
• sc.i to i
• sc.ni to n.i and
• sc.nv to n.v For the Resistor constraint, bind:

• rc.pi to p.i
• rc.pv to p.v
• rc.v to v
• rc.i to i
• rc.ni to n.i
• rc.nv to n.v and
• rc.r to r Configure Simulation Behavior

This table shows the detailed steps of the configuration of SysMLSim.

Step

Action

SysMLSimConfiguration Artifact

• Select 'Simulate > SysMLSim > Manage > SysMLSim Configuration Manager'
• From the first toolbar icon drop-down, select 'Create Artifact' and create the Artifact element
• Select the Package that owns this SysML Model

Create Root elements in Configuration Manager

• ValueType
• block
• constraintBlock

ValueType Substitution

Expand ValueType and for each of Current, Resistance and Voltage select 'SysMLSimReal' from the 'Value' combo box.

Set property as flow

• Expand 'block' to ChargePort | FlowProperty | i : Current and select 'SimVariable' from the 'Value' combo box
• For 'SysMLSimConfiguration' click on the button to open the 'Element Configurations' dialog
• Set 'isConserved' to 'True'

SysMLSimModel

This is the model we want to simulate: set the block 'Circuit' to be 'SysMLSimModel'.

Run Simulation

In the 'Simulation' page, select the checkboxes against 'resistor.n.v' and 'resistor.p.v' for plotting and click on the . The two legends 'resistor.n.v' and 'resistor.p.v' are plotted, as shown.
{"ft_lang_label":"__label__en","ft_lang_prob":0.86811763,"math_prob":0.91487277,"size":5143,"snap":"2019-35-2019-39","text_gpt3_token_len":1064,"char_repetition_ratio":0.13718623,"word_repetition_ratio":0.025270758,"special_character_ratio":0.1996889,"punctuation_ratio":0.11363637,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97279644,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24],"im_url_duplicate_count":[null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-09-23T17:42:05Z\",\"WARC-Record-ID\":\"<urn:uuid:d63a8d8d-943a-4b27-aee1-7a24a25e136e>\",\"Content-Length\":\"61165\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:a794213c-6b69-49d5-a7eb-f89a19f5c73d>\",\"WARC-Concurrent-To\":\"<urn:uuid:bca67776-5745-4b48-b19e-5f9c88fd1529>\",\"WARC-IP-Address\":\"166.78.241.26\",\"WARC-Target-URI\":\"https://www.sparxsystems.com/enterprise_architect_user_guide/13.5/model_simulation/sysml_simulation_circuit.html\",\"WARC-Payload-Digest\":\"sha1:I64PGGILQF7HBPRRL2YZUCPKS3VFJQIO\",\"WARC-Block-Digest\":\"sha1:75TJ6GTCHI7PORWGJ5T5N2T3BTUKSLQF\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-39/CC-MAIN-2019-39_segments_1568514577478.95_warc_CC-MAIN-20190923172009-20190923194009-00559.warc.gz\"}"}