Utility Functions

rcdesign.utils.underline(s: str, ch: str = '-') str

Return a string of characters, - by cefault, equal in length to a given string s

Parameters:
  • s (str) – String whose length is used to determine the length of the underline

  • ch (str) – Character to be used as the underline character (default: -)

Returns:

String of characters ch, equal in length to s

Return type:

str

rcdesign.utils.header(s: str, ch: str = '-') str

Return a string with an underline of ch characters

Parameters:
  • s (str) – String which is to be underlined

  • ch (str) – Character to be used as the underline character (default: -)

Returns:

String with the given input string s with an underline of ch characters.

Return type:

str

rcdesign.utils.rootsearch(func: Callable, xstart: float, xstop: float, numint: int, *args)

Search for values bracketing the roots of the function func between a given range of values by dividing the range into numint number of equal intervals.

Parameters:
  • func (Callable) – Function whose root is to be determined

  • xstart (float) – Start value of the range to search

  • xstop (float) – End value of the range to search

  • numint (int)

  • *args (tuple) – Arguments to be passed on to the function func

Returns:

Start and end values bracketing a root, else None, None
  • (x1, x2) bracketing the root, if they can be determined, else (None, None)

Return type:

tuple

rcdesign.utils.ceiling(x: float, multipleof: float = 1.0)

Returns a floating point number which is a multiple of a given number and toward the ceiling compared to a given number x

Parameters:
  • x (float) – Reference number

  • multipleof (float) – The number whose multiple we wish to be returned (default: 1.0)

Returns:

A multiple of multipleof that is toward the ceiling compared to x. Similar to the CEILING() function in Microsoft Excel

Return type:

float

rcdesign.utils.floor(x: float, multipleof: float = 1.0)

Returns a floating point number which is a multiple of a given number and toward the floor compared to a given number x

Parameters:
  • x (float) – Reference number

  • multipleof (float) – The number whose multiple we wish to be returned (default: 1.0)

Returns:

A multiple of multipleof that is toward the floor compared to x. Similar to the FLOOR() function in Microsoft Excel

Return type:

float

rcdesign.utils.bar_area(dia: float) float

Returns the cross section area of one circular bar of a given diameter

Parameters:

dia (float) – Diameter of circular bar

Returns:

Cross section area of one circular bar of diameter dia

Return type:

float

rcdesign.utils.num_bars(ast: float, dia: float) int

Calculate the integer number of circular bars required to provide cross section area greater than or equal to a required cross section area

Parameters:
  • ast (float) – Required cross section area

  • dia (float) – Diameter of circular bars to be used to provide the required cross section area

Returns:

Number of circular bars required to provide a cross section area equal to or greater than ast using circular bars of diameter dia

Return type:

int

rcdesign.utils.deg2rad(deg: float) float

Convert angle in degrees to radians

Parameters:

deg (float) – Angle in degrees

Returns:

Angle in radians

Return type:

float