WithinDomain model

Requirements.ChecksInFixedWindow.WithinDomain  · source

Icon of WithinDomain

In every true condition phase, point input must be within the domain defined by a polygon

Syntax

property = WithinDomain(condition=..., point=..., polygon=...).y;

Description

In every duration where the Boolean input condition is true, the point must be within the domain defined by the polygon. The polygon is defined by a set of points polygon[:,2], where polygon[i,1] is the x-coordinate of polygon point i and polygon[i,2] is the y-coordinate. The last point of the polygon can be identical to the first point, so polygon[1,:] = polygon[end,:]. If this is not the case, the block assumes that the last point polygon[end,:] is connected implicitely to the first point polygon[1,:]. The area inside the polygon is the desired domain.

When condition is true, output y = Satisfied if the point is on or within the polygon, and y = Violated if the point is outside of the polygon. When condition is false, y = Undefined (not applicable).

The block provides additionally output distance which is the minimum distance between the point and the polygon.
If distance > 0, then point is inside of the polygon.
If distance < 0, then point is outside of the polygon.
If distance = 0, then point is on the polygon.

Violated, Undecided, and Satisfied are elements of enumeration Property.

Example

This block is demonstrated with the following example:

The polygon and the point are dynamically displayed in the icon of the block. If the point is within the polygon, the point is displayed in green and the polygon area in grey (the grey point on the polygon marks the polygon point that is closest to the point). If the point is outside of the polygon, it is displayed in red and the polygon area in light red:

Simulating this examples results in

simulation result

Note, that the point is outside of the domain defined by the polygon if distance < 0.

Margin

Output margin (present if computeMargin = true, the default) is the signed distance of the check to its limit, the output distance, divided by parameter scale: margin ≥ 0 exactly when the check holds, margin = 1 is one scale of headroom, margin < 0 a violation by that many. Set scale to the requirement's tolerance so that margins of different requirements compare; with the default scale = 1 the margin is the raw robustness in the quantity's unit. The block computes the instantaneous value only; the worst value over a run and the instant it occurs are taken from the stored trajectory.

Parameters

NameTypeDescription
scale parameterRealScale of the margin: margin = distance/scale, with scale the requirement's tolerance (1 = the raw distance)
computeMargin parameterBoolean= true, if the normalized margin output is provided
polygon[…] parameterRealPolygon defining the boundary of the domain (polygon[i,2] is point i of polygon)

Outputs

NameTypeDescription
polygonPoint[…] outputRealPoint on polygon that is closest to point

Components and variables

NameTypeDescription
conditionModelica.Blocks.Interfaces.BooleanInputBoolean input condition signal
point[…]Modelica.Blocks.Interfaces.RealInputPoint to test
yRequirements.Interfaces.PropertyOutputProperty output signal (Satisfied, if point is within polygon)
distanceModelica.Blocks.Interfaces.RealOutputMinimum distance of point to polygon (>= 0 if inside or on polygon, otherwise outside of polygon)
marginRequirements.Interfaces.MarginOutputNormalized margin of the check: >= 0 exactly when the point is inside, in units of scale