Main Content

domain

Domain model keywords

Syntax

domain
variables
variables(Balancing = true)
parameters
intermediates
equations

Description

domain begins the domain model class definition, which is terminated by an end keyword. Only blank lines and comments can precede domain. You must place a domain model class definition in a file of the same name with a file name extension of .ssc.

variables begins an Across variables declaration block, which is terminated by an end keyword. This block contains declarations for all the Across variables associated with the domain. A domain model class definition can contain multiple Across variables, combined in a single variables block. This block is required.

variables(Balancing = true) begins a Through variables declaration block, which is terminated by an end keyword. This block contains declarations for all the Through variables associated with the domain. A domain model class definition can contain multiple Through variables, combined in a single through block. This block is required.

Each variable is defined as a value with unit. See Declare Through and Across Variables for a Domain for more information.

parameters begins a domain parameters declaration block, which is terminated by an end keyword. This block contains declarations for domain parameters. These parameters are associated with the domain and can be propagated through the network to all components connected to the domain. This block is optional.

See Propagation of Domain Parameters for more information.

intermediates begins a declaration block of named intermediate terms, which is terminated by an end keyword. This block contains declarations of intermediate terms that can be reused in equations of components that have nodes of this domain type. This block is optional.

See Using Intermediate Terms in Equations for more information.

equations begins the equation section, which is terminated by an end keyword. This section serves to establish the mathematical relationships between the domain Across variables, parameters, and intermediates. This section is optional.

Use the domain equations when your custom domain has more Across variables than Through variables. For more information, see Domain Equations.

Table of Attributes

For declaration member attributes, see Attribute Lists.

Examples

This file, named rotational.ssc, declares a mechanical rotational domain, with angular velocity as an Across variable and torque as a Through variable.

domain rotational
% Define the mechanical rotational domain
% in terms of across and through variables

  variables
    w = { 1 , 'rad/s' }; % angular velocity
  end

  variables(Balancing = true)
    t = { 1 , 'N*m' }; % torque
  end

end

This file, named t_hyd.ssc, declares a hydraulic domain, with pressure as an Across variable, flow rate as a Through variable, and an associated domain parameter, fluid temperature.

domain t_hyd
  variables
    p = {1e6,'Pa'}; % pressure
  end
  variables(Balancing = true)
    q = {1e-3,'m^3/s'}; % flow rate
  end
  parameters
    t = {303,'K'}; % fluid temperature
  end
end

Version History

Introduced in R2008b

expand all