interface Electrical_System
( extent Electrical_Systems
keys system_code
)
{
attribute string system_code;
attribute string description;
attribute string location;
attribute string client_code;
attribute integer min_temperature;
attribute integer max_temperature;
attribute range{0,100} min_humidity;
attribute range{0,100} max_humidity;
attribute integer altitude;
relationship set composed_of
inverse Component::system;
};
interface Component
( extent Components
keys component_code
)
{
attribute string component_code;
attribute string casa_costruttrice;
attribute string series;
attribute string model;
attribute string sales_code;
attribute string description;
attribute string trademark_code;
attribute string trademark_material;
relationship Electrical_System system
inverse Electrical_System::composed_of;
};
interface Electrical_Component : Component
( extent Electrical_Components
)
{
relationship Circuit supplied
inverse Circuit::supply;
relationship list has
inverse Terminal::part_of;
relationship set contacts
inverse Contact::part_of;
};
interface Primary_Component : Electrical_Component
( extent Primary_Components
)
{
attribute range{0.0,+inf} input_current;
relationship set control
inverse Computed_Component::drift;
relationship Auxiliary_Component contained
inverse Auxiliary_Component::contains;
relationship Auxiliary_Component part_in
inverse Auxiliary_Component::contain_part_of;
relationship Auxiliary_Component collected_in
inverse Auxiliary_Component::collected;
};
interface Actuator : Primary_Component
( extent Actuators
)
{
attribute real power;
attribute range {0.0,1.0} cosfi;
attribute integer work_hour_cycle;
attribute range {0,24} hour_per_day;
attribute range{1,8} category;
/* can be :
1 -> 'DC-20'
2 -> 'DC-21'
3 -> 'DC-22'
4 -> 'DC-23'
5 -> 'AC-20'
6 -> 'AC-21'
7 -> 'AC-22'
8 -> 'AC-23'
*/
attribute real simultaneous_coefficient;
};
rule Act1 forall X in Actuator: X.supplied.supply_type="DC"
then X.category > 1 and X.category < 4;
rule Act2 forall X in Actuator: X.supplied.supply_type="AC"
then X.category > 5 and X.category < 8;
rule Act3 forall X in Actuator:
X.input_current =
range{0.0,100.0} current_computation
(X.power,X.cosfi,X.supplied.voltage)
then X in Actuator;
interface Sensor : Primary_Component
( extent Sensors
)
{
attribute string output;
};
interface Human_Interface_Component : Primary_Component
( extent Human_Interface_Components
)
{
attribute string output;
attribute real width;
attribute real height;
attribute real depth;
};
interface Computed_Component : Electrical_Component
( extent Computed_Components
)
{
attribute string computed_component_type;
relationship set drift
inverse Primary_Component::control;
};
interface Subcomponent : Computed_Component
( extent Subcomponents
)
{
attribute range{0.0,+inf} nominal_current;
attribute string category;
attribute range{0.0,+inf} cut_power;
};
rule Sub1 forall X in Subcomponent: X.computed_component_type = "Q"
then X.category = string category(X.drift);
rule Sub2 forall X in Subcomponent: X.computed_component_type = "Q"
then X.nominal_current =
range {0.0,100.0} sum_nominal_current(X.drift,1);
rule Sub3 forall X in Subcomponent: X.computed_component_type = "Q"
then X.cut_power =
range {0.0,100000.0} compute_cut_power
(X.nominal_current,X.drift);
rule Sub4 forall X in Subcomponent: X.computed_component_type = "F"
then X.nominal_current =
range {0.0,100.0} sum_nominal_current(X.drift,1.3);
rule Sub5 forall X in Subcomponent: X.computed_component_type = "K"
then X.category = string category(X.drift);
rule Sub6 forall X in Subcomponent: X.computed_component_type = "K"
then X.nominal_current =
range {0.0,100.0} sum_nominal_current(X.drift,1);
rule Sub7 forall X in Subcomponent: X.computed_component_type = "K"
then X.cut_power =
range {0.0,50000.0} compute_cut_power(X.nominal_current,X.drift);
rule Sub8 forall X in Subcomponent: X.computed_component_type = "T"
then X.nominal_current =
range {0.0,100.0} sum_nominal_current(X.drift,1);
interface Auxiliary_Component : Component
( extent Auxiliary_Components
)
{
attribute string material_type;
attribute string color;
attribute real width;
attribute real height;
attribute real depth;
relationship set contains
inverse Primary_Component::contained;
relationship set contain_part_of
inverse Primary_Component::part_in;
relationship set collected
inverse Primary_Component::collected_in;
};
interface Circuit : Primary_Component
( extent Circuits
keys circuit_code
)
{
attribute string line_type;
attribute string circuit_type;
// "power"
// "auxiliary"
attribute string supply_type;
// "DC"
// "AC"
attribute range{1,6} voltage;
// 1 = 6V
// 2 = 12V
// 3 = 24V
// 4 = 110V
// 5 = 220V
// 6 = 380V
attribute range{1,2} frequency;
// 1 = 50Hz
// 2 = 60Hz
relationship set supply
inverse Electrical_Component::supplied;
};
rule Cir1 forall X in Circuit: X.supply_type = "DC"
then X.voltage > 1 and X.voltage < 3;
rule Cir2 forall X in Circuit: X.supply_type = "AC"
then X.voltage > 4 and X.voltage < 6;
rule Cir3 forall X in Circuit: X.input_current =
range {0.0,100.0} compute_circuit_current(X.supply)
then X in Circuit;
interface Wire : Computed_Component
( extent Wires
)
{
attribute range{1,2} wire_type;
attribute range{0.0,+inf} section;
attribute range{0.0,+inf} normal_current;
};
rule Wir1 forall X in Wire: X.normal_current =
range{0.0,100} sum_normal_current(X.drift)
then X in Wire;
rule Wir2 forall X in Wire: X.supplied.circuit_type = "power"
then X.section = range{0.0,50} divide(X.normal_current,2.5);
rule Wir3 forall X in Wire: X.supplied.circuit_type = "ausiliario"
then X.section = (real)1.5;
interface Terminal: Computed_Component
( extent Terminals
)
{
attribute range{0.0,+inf} section;
attribute range{0.0,+inf} normal_current;
relationship Electrical_Component part_of
inverse Electrical_Component::has;
};
rule Term1 forall X in Terminal: X.normal_current =
range {0.0,100} sum_normal_current(X.drift)
then X in Terminal;
rule Term2 forall X in Terminal: X.supplied.circuit_type = "power"
then X.section = range{0.0,50} divide(X.normal_current,2.5);
rule Term3 forall X in Terminal: X.supplied.circuit_type = "auxiliary"
then X.section = (real)1.5;
interface Contact: Computed_Component
( extent Contacts
)
{
attribute range{1,4} contact_type;
relationship Electrical_Component part_of
inverse Electrical_Component::contacts;
};