Building a first flat problem

We propose here to represent a very simple problem of calculating the current I in a passive resistor of value r in Ohms subjected to a voltage e in volts.

Warning

Be careful because DEPS is a case sensitive language !

../_images/SimpleCircuit.png

Using Quantities

In DEPS, Constants and Variables are typed with Quantities. The package Universal.deps available with the DEPS Studio Community Edition distribution give the user a set of predefined Quantities.

Of course the Real, Integer and Boolean quantities are predefined but the Current and Voltage are also predefined. Let us have a look to those quantities:

QuantityKind Current
Type : real ;
Min  : -maxreal ;
Max  : +maxreal ;
Dim  : I ;
End

Quantity Current
Kind : Current ;
Min  :  -maxreal  ;
Max  : +maxreal ;
Unit : A ;
End

QuantityKind Voltage
Type : real ;
Min  : -maxreal ;
Max  : +maxreal ;
Dim  : ML2Tminus3Iminus1 ; (* M.L^2.T^-3.I^-1 *)
End

Quantity Voltage
Kind : Voltage ;
Min  : -maxreal ;
Max  : +maxreal ;
Unit : V ;
End

Then, we would like to built our own Resistance quantity. According to physic and the Internal System of Units , a Resistance is in Ohm and it is a positive real value. In DEPS, we make the difference between the Quantity expressed in a unit and the QuantityType which characterises the dimension using Dimensional analysis. On the one hand, we define a QuantityType Resistance which is a real between 0 and the positive infinity (+maxreal in DEPS) and with the right dimension. On the other hand, we define the Resistance Quantity which refers to the Resistance QuantityType with a possible domain value between 0 and +maxreal in Ohm. That is to say that several Quantities can refer to the same QUantityType because in physics, a quantity has a unique dimension but can be expressed in several units.

QuantityKind Resistance
Type : real ;
Min  : 0 ;
Max  : +maxreal ;
Dim  : ML2Tminus3Iminus2 ; (* M.L^2.T^-3.I^-2 *)
End

Quantity Resistance
Kind : Resistance ;
Min  : 0 ;
Max  : +maxreal ;
Unit : ohm ;
End

Structure of a Problem

In DEPS a problem has a name (here it is URI) and is structured around a number of different zones, some of which may be empty. The keyword End symbolises the end of the problem description.

Problem URI

Constants

Variables

Elements

Properties

End

Warning

In DEPS there is only one Problem per project.

Defining constants

First of all we need to define the constants of the problem in the dedicated part of the problem (Constants). Here, the constants are the supply voltage e=10V and the value of the resistor r=100 Ohm. For doing that we will use the previous Voltage and Resistance quantities.

Problem URI

Constants

e : Voltage = 10;
r : Resistance = 100;

Variables

Elements

Properties

End

Declaring Variables

Then we have to declare the unknown(s) of the problem in the dedicated part (Variables). In our problem the only unknown is the I current.

Problem URI

Constants

e : Voltage = 10;
r : Resistance = 100;

Variables

I : Current;

Elements

Properties

End

Posting properties inside the problem

Following the Ohm’s law.`

\[e = R*I\]

we can post this property in the Properties field of the DEPS Problem. After that, every instances of the OneResistor problem has to satisfy this property.

Problem URI

Constants

e : Voltage = 10;
r : Resistance = 100;

Variables

I : Current;

Elements

Properties
e = r*i;

End

Compiling and solving the problem

A zipfile containing the whole DEPS project URI.proj described in this section can be downloaded via this link .

If we open the deps file of the probem URI.deps, we see that deps files are organised as packages. Each package has a name, following the Package directive and can use other packages, followint the Uses directive.

Package URI ;

Uses Universal  ;

QuantityKind Resistance
Type : real ;
Min  : 0 ;
Max  : +maxreal ;
Dim  : ML2Tminus3Iminus2 ; (* M.L^2.T^-3.I^-2 *)
End

Quantity Resistance
Kind : Resistance ;
Min  : 0 ;
Max  : +maxreal ;
Unit : ohm ;
End

Problem URI
Constants
e: Voltage = 10;
R : Resistance = 100;

Variables
I : Current;

Elements

Properties
e = R*I;

End

After opening the URI.proj project file in DEP Studio, we can compile the project (project > build the problem).

../_images/URICompile.png

Then the problem can be solved (Solve > Firts Solution).

../_images/URISolve.png