주요 콘텐츠

domain

Domain model class definition

Parent Section: none (top-level)

Syntax

domain DomainName
  variables
    ... % Across variables
  end
  variables(Balancing = true)
    ... % Through variables
  end
end

Description

domain begins the domain model class definition, which is terminated by an end keyword. Only blank lines, comments, and import statements 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.

A domain model class definition can contain these sections:

  • variables — Declarations for all the Across variables associated with the domain. This section is required.

  • variables(Balancing = true) — Declarations for all the Through variables associated with the domain. This section is required.

    For more information, see Declare Through and Across Variables for a Domain.

  • parameters — 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 section is optional.

    For more information, see Propagation of Domain Parameters.

  • intermediates — Declarations of intermediate terms that can be reused in equations of components that have nodes of this domain type. This section is optional.

    See Using Intermediate Terms in Equations for more information.

  • equations — 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.

For a list of declaration member attributes, see Attribute Lists.

Examples

expand all

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