Basic types
The most basic types inato are a module and an interface.
An Electrical is a special built-in type of interface that represents a single electrical interface.
A component is a subclass of a module that expects to represent a single physical component.
You can also define your own types, in a similar way to defining a class in Python.
Like classes in most modern languages, you can subclass and inherit from blocks.
You can subclass a
module as a component, but not the other way around. A component is expected to represent a specific component.Configuring blocks
Configuration of amodule or interface is done by assigning to its attributes.
self. Instead, any assignments you make within the scope of a block, are automatically assigned to the block.
Built-in attributes influence the behavior of the compiler with respect to the block.
Setting the package attribute, for example, makes the compiler select only components with the specified package to use in that componentâs slot.
Connecting it up
Anyinterface can connect to any other interface of the same type using the ~ operator.
Units and tolerances, assertions and maths
Remember how NASA slung a rocket straight into Mars because of a metric/imperial error? Letâs not do that again.Units
Resistorsâ resistances must be a resistance; whether1.23Ω (option+Z on macOS), 1.23ohm, 4.56Kohm, 7.89Mohm or similar.
Any attribute of any block may have a unit attached, written (without a space) after any number.
Unsurprisingly, a capacitorâs capacitance needs to be a capacitance (for example, 23.4uF); other limits are in volts, amperes, degrees, and so on.
Add units.
Tolerances
Another unfamiliar first-class language feature when dealing with the physical world is the ability (and generally specification) to spec tolerances for attributes. You could try to find a10kΩ resistor, but it probably wonât exist - itâll likely be at least 10kΩ +/- 0.1% (which you can write!).
Tolerances can be written in the forms of:
1V to 2V3uF +/- 1uF4Kohm +/- 1%
Units and Tolerances
With Units and Tolerances together, physical attributes can be defined. Several legal ways exist to combine them.3V to 3.6Vperhaps for a supply rail3V +/- 10mVmaybe for a reference4.7uF +/- 20%for a generic cap- even
25lb +/- 200gđ€Ł
Sweet, so now that all these values are around the place, what can be done with them?
âš Maths âš atopile does two things for you with these values:- Check that assertions about their relationships to one another are true
- Solve systems of constraints based on these relationships to find component values
assert keyword to apply constraints on the values of attributes to one another.
Supported operators are currently <, > and within (all are inclusive of the bounds).
Specialization
The-> operator will specialize a module from its existing instance to an instance of the type on the right-hand side.
Imports
You can import assets by specifying what you want to import and where you want to import it from using the following syntax within your.ato files:
from "where.ato" import What, Why, Wow
Notes on that statement:
- Add quotes on the âwhere.atoââitâs a string.
What,Why, andWoware capitalized because they are in the source file. It has to match preciselyâitâs a type, and types should be capitalized, though this isnât enforced, and you can import things other than types from other files.
ato.yaml is), or within the standard library (.ato/modules/)