Skip to main content
All CollectionsFormula language reference
Engineering operations, calculations, and simulations
Engineering operations, calculations, and simulations
Updated over 2 months ago

About Environments and Simulations

Environments in Neara are used to simulate various load conditions across model objects. There are two ways to create an environment.

The first approach is on the Environments menu located among the primary dropdown options at the top of the page.

The second method is with the Schema Editor (see Concepts).

You can create custom environments using the make_environment() function, this allows objects to be simulated with dynamic or preset environmental factors such as wind and temperature. Furthermore, the simulate() function allows individual model objects to be simulated with these environments.

Dynamic Environment controlled with Parameter Sliders

An example of a dynamic environment setup is shown below. This simulation is setup on Span objects.

You can see the values for temperature and wind pressure are references by other variables. These are setup as parameters and can be controlled with Interactive Parameter controls.

These values are adjusted based on the user's input on the sliders:

Note that using temperature will set both ambient temperature and wire temperature to the constant temperature specified.

Once setup, we can visualize the cables resulting from this simulated environment using the viz() function, for example:

viz(u_environment_dynamic_cables[].Cables[].viz_cable)

The blue dashed lines in the image below represent cables simulated at a higher temperature than the stringing temperature.

We can configure clearance fields based on these simulated/dynamic cables.

The approach is the same as a normal clearance use-case setup, except we measure from the dynamic cables (u_environment_dynamic_cables[].Cables[]) rather than the static model cables.


Engineering spatial functions

There are a series of functions that can be used to spatially query and return various nearby model objects.

find_nearby_spans

find_nearby_spans(object, distance)

Returns all spans roughly within the distance around the specified object. Note only horizontal distance is used.

For a more fine-grained distance comparison, use the measure_distance function on the spans returned from this function

Example: In a custom field on a Span or Pole, find_nearby_spans(self, 10m) returns a list of spans within 10m of the given span or pole.

find_nearby_poles

find_nearby_poles(object, distance)

Returns all poles roughly within the distance around the specified object. Note only horizontal distance is used.

For a more fine-grained distance comparison, use the measure_distance function on the poles returned from this function

Example: In a custom field on a Span or Pole, find_nearby_poles(self, 10m) returns a list of poles within 10m of the given span or pole.

find_nearby_obstructions

find_nearby_obstructions(object, distance)

Returns all obstructions roughly within the distance around the specified object. Note only horizontal distance is used.

For a more fine-grained distance comparison, use the measure_distance function on the obstructions returned from this function

Example: In a custom field on a Span or Pole, find_nearby_obstructions(self, 10m) returns a list of obstructions within 10m of the given span or pole.

find_nearby_feature_points

find_nearby_feature_points(object, distance, point_types)

Returns all Feature Points roughly within the distance around the specified object. Note only horizontal distance is used.

For a more fine-grained distance comparison, use the measure_distance function on the Feature Points returned from this function

Example: In a custom field on a Span or Pole, find_nearby_Feature Points(self, 10m) returns a list of Feature Points within 10m of the given span or pole.

If a list or a single point type is provided only points of that type will be returned.

Valid point types are:

ground

ground2

water

road

veg

building

fence

vehicle

smo_gnd

smo_rt

antenna_rt

overpass

electrical

railway

pipeline

infra

special

unclassified

noise

pole_p

pole_np

stays

tower

structure

cond

Example: In a custom field on a Span or Pole, find_nearby_feature_points(self, 10m, "veg") returns a list of feature points within 10m of the given span or pole.

find_spans_below

find_spans_below(span)

Returns spans below this span on the same two poles.

Example: In a custom field on a Span, find_spans_below(self) returns a list of spans.

find_adjacent_spans_below

find_adjacent_spans_below(span)

Returns spans attached at one point below an attach point of this span, and at the other point on a different structure to this span.

Example: In a custom field on a Span, find_adjacent_spans_below(self) returns a list of spans.

find_crossing_spans_below

find_crossing_spans_below(span)

Returns crossing spans below this span.

Example: In a custom field on a Span, find_crossing_spans_below(self) returns a list of crossing spans.

find_unattached_poles

find_unattached_poles(span or stack, distance)

Returns unattached poles within the given distance of the span or span-stack.

Example: In a custom field on a Span or Spanstack, find_unattached_poles(self) returns a list of poles within 10m of the given span.

get_shared_pole

get_shared_pole(span1, span2)

Returns the pole shared by the two spans.

Example: In a custom field on a Span, get_shared_pole(self, index(find_adjacent_spans_below(self),0)) returns the shared pole.

get_section_attachment_for_pole

get_section_attachment_for_pole(span_or_section, pole)

Returns the section-attachment for the given span or section on the given pole.

Example: In a custom field on a Span, get_section_attachment_for_pole(self, self.pole1) returns the section-attachment for the given span and pole.

adjust_temperature

adjust_temperature(span_environment_pair, new_temperature)

Returns a span environment pair object, derived from the given one, with the new temperature.

Example: In a custom field on a SpanEnvironment, adjust_temperature(self, unit_value(10,"celsius")) returns a span environment pair with a new temperature of 10 degrees celsius.

make_environment

make_environment(namedArg:value, ...)

Creates an Environment with the specified parameters. The returned environment can then be used for simulations.

The following named arguments are all optional:

  • template: an environment to copy as a baseline

  • temperature: constant temperature

  • wire_temperature: constant temperature for conductors (including aerial stays/guys)

  • ambient_temperature: constant temperature for objects that are not conductors

  • windPressureCond: conductor wind pressure

  • windPressurePole: pole wind temperature

  • windPressure: used to specify all wind pressure values at once

  • iceRadialThickness: radial ice thickness

  • iceDensity: ice density (default to density at sea level)

Note that using temperature will set both ambient temperature and wire temperature to the constant temperature specified.

Example

make_environment(ambient_temperature: unit_value(20, "celsius"))

make_cable_pair

make_cable_pair(cabenv1, cabenv2)

An object representing a pair of env-state cables, which can then be queried for a number of properties including voltage RMS difference, separations, etc.

Example

In a custom field on a Span, make_cable_pair(index(Environments[].Cables,0),index(Environments[].Cables,1)) returns a cable environment pair.

make_clash_pairs

make_clash_pairs(bay, environment)

Gets all the pairs of cables within the bay, modelled in the given environment.

If you want a pair of two specific env-state cables then see the function make_cable_pair.

Example

In a custom field on a Spanstack,


make_clash_pairs(self, find(model().Environments, model().Environments[].label = "Everyday"))


returns a list of cable environment pairs.

find_nearby_trenches

find_nearby_trenches(trench, distance)

Returns trenches within the given distance to the given trench

Example: In a Trenches report, find_nearby_trenches(self, 10m) returns a list of trenches within 10m of the given trench.

find_unattached_ug_cables

find_unattached_ug_cables(ugCable)

Returns unattached underground cables near to the given underground cable.

Example: In a UgCables report, find_unattached_ug_cables(self) returns a list of nearby unattached underground cables.

geo_query

geo_query(collection, geometry, distance)

Queries a collection of geometric objects returning those that are within some distance of the given geometry, in order of closest to furthest.

The geometry input can either be a geometry object or of a type that is coercible to a geometry object, e.g. vec2.


Engineering calculations

get_rms_difference

get_rms_difference(span1, span2)

Returns the worst-case Root Mean Square (RMS) Vector difference between the two spans. Uses the voltages of the spans as the three phase RMS voltages.

Example: get_rms_difference(self, index(find_adjacent_spans_below(self),0)) returns the worse-case RMS difference between the given span and an adjacent span below.

rate_span

rate_span(span_environment_pair, pass_field, [vary:temperature|wind, max_wind_pressure:1500.0Pa, wind_pressure_increment:50.0Pa])

Returns a span environment pair object, derived from the given one, by trying either temperatures between -20C and 120C inclusive, or wind pressures between 0Pa and max_wind_pressure (inclusive), depending on weather the vary argument is 'temperature' or 'wind'.

In the instance when vary is set to 'temperature', temperatures between -20C and 120C, inclusive, are tried using the given pass_field. For performance, this function will execute a binary search, meaning that the pass_field must be monotonic over the range of temperatures, such that for any given temperature that passes, all greater temperatures also pass.

In the instance when vary is set to 'wind', wind pressures are tried incrementally from 0Pa to max_wind_pressure (inclusive), in discrete step sizes of wind_pressure_increment. Once a wind pressure is found where pass_field is false, the previous wind pressure is returned. As a result, pass_field does not need to be monotonic over the range of wind pressures. If all wind pressures fail, then the first wind pressure is returned.

The following named arguments are optional:

  • vary: Determines which environment condition that the pass field is checked against. It must be either “temperature” (default) or ”wind"

  • max_wind_pressure: The maximum wind pressure that is checked (default of 1500Pa) when vary is set to "wind". This argument can not be larger than 1500.0Pa.

  • wind_pressure_increment: The discrete wind pressure increment (default of 50Pa) used when vary is set to "wind". This argument can not be smaller than 20Pa.

Example

rate_span(simulate(self, environment: make_environment(temperature: unit_value(20, "celsius"))), "u_ground_clearance_pass")

where u_ground_clearance_pass is defined as ground_clearance>u_ground_clearance_required

returns the first span environment which satisfies the pass_field.

simulate

simulate(span, environment: environment)

Simulates the given span in the given environment, producing a SpanEnvironment. Works well in combination with make_environment().

Example: In a custom field on a Span, simulate(self, environment: make_environment(temperature: unit_value(20, "celsius"))) returns a span environment pair.

simulate_structure_fea

simulate_structure_fea(pole, environment: environment)

Simulates the given structure in the given environment, using Finite Element Analysis (FEA).

Example: simulate_structure_fea( pole, environment: environment, network_solve: true, wind_dirs: 12,)

returns a list of pole reports for each of the 12 simulations.

simulate_structure_broken_wires

simulate_structure_broken_wires(structure_report, {spans:(all terminating spans), num_cables:1, factor:0.0})

Re-simulates the given structure, with some point loads removed or factored.

For each span, all combinations of num_cables (number of cables) have their point loads reduced by factor. This is done per-span; cables are not dropped in combinations across multiple spans at once.

The default spans are the set of spans terminating at this structure (e.g. not on suspension or post insulators).

simulate_strain_section_fea

simulate_strain_section_fea(strain_section, environment: environment)

Simulates the given strain_section in the given environment, using FEA.

Example:

simulate_strain_section_fea(section, environment: environment, network_solve: true)

returns a list of section reports for each of the simulations.

get_assembly_endpoint_difference

get_assembly_endpoint_difference(type1, type2)

Returns the average difference in assembly endpoints for the given two types.

Useful for finding similarly-shaped assemblies.

Did this answer your question?