Alix Chaplain

Strategies of Power and the Emergence of Hybrid Mini-Grids in Lebanon

Developing a mini-grid based on renewable energy, and so being independent from the conventional grid and private owners of generators, it's refusing to pay the bills of government incompetence and corruption. It's also planning for the future of our village when we'll have more and more power cuts and less and less subsidy on diesel." [1] In this interview extract, a local politician in Lebanon argues that the development of a collective small-scale grid based on renewable energies will guarantee local independence from the failing national Electricité du Liban (EDL) grid and from private generator owners. Without this kind of small-scale infrastructure, the Lebanese suffer from significant electricity rationing and variable power cuts, because of the structural deterioration of the conventional electricity sector following the Lebanese Civil War (1975-90) and the 2006 Israeli war.

Although the EDL grid actually covers almost ninety-nine percent of Lebanese territory, its persistent failures have led households, businesses, and municipalities to bypass it, adopting a range of alternative modes of access to electricity (collective or individual generators, renewable production, storage systems, etc.). As people take steps to cope with persistent shortages and to minimize disruptions to daily life, they have articulated a novel decentralized technical and organizational model.

To explore this new model, this article investigates the operation of collective electricity supply systems, particularly photovoltaic (PV) and diesel local mini-grids, and explores how these sociotechnical innovations strengthen or destabilize local and national solidarity. While this kind of local collective infrastructure has succeeded in guaranteeing energy security on a small scale, access to the technology needed to implement it is unequal, and depends on the capacity of local actors to mobilize economic and political resources.

A Wide Variety of Modes of Access to Electricity in Parallel with the Conventional Grid

The Lebanese national electric utility, Electricité du Liban, does not produce nearly enough electricity to meet Lebanese demand. In 2018, it covered just sixty-three percent of electricity demand-a shortfall of 1.5 gigawatts (GW). This is equivalent to the amount of power needed to more than 430,000 consumers in Lebanon (considering the average consumption of an EDL subscriber regardless of the sector). EDL, which operates under the supervision of the Ministry of Energy and Water (MoEW), is a near monopoly. It controls ninety percent of electricity production, transmission, and distribution sectors in Lebanon. With the exception of two relatively small concessions, EDL is the only operator authorized to sell electricity directly to consumers in Lebanon.

Despite this monopoly, privately-owned diesel generators have been an integral component of the Lebanese cityscape since the nineties. At the end of the civil war, some households bought generators individually or collectively to compensate for power cuts. But diesel generators soon became profitable business opportunities with neighbourhood-based subscription services. Private generator owners offer monthly subscriptions to the inhabitants of the district they invest in. In 2019, diesel generators provided electricity to eighty-four percent of the population during load shedding(electricity rationing).

The supply offered by private generators is often held up as an example of the alleged individual entrepreneurship of the Lebanese in the face of policy failures and infrastructural breakdown (e.g., electricity shortages). However, scholars argue that this situation is a political artifact of particular regimes of tolerance and regulation at both the national and local levels. Though illegal, authorities tolerate these supply systems, considering them a residual and temporary palliative to power cuts. Locally, business regulations governing subscription rates and managing competition depend on the relations between municipalities and generators' owners. Despite being framed as a temporary stop-gap, these generators have been operating for so long that their owners hold local micro-monopolies. Furthermore, by offering alternatives to households with the financial means to pay a second bill, this system deepens socioeconomic and territorial inequalities. Diesel generators cost three times more per kilowatt hours (kWh) than EDL tariff. Moreover, areas outside Beirut, especially in the poor regions of the North and South of Lebanon, suffer as much as four times as many power cuts as the city.

At the same time, for over a decade distributed renewable energy systems have been blooming throughout Lebanon. Driven by the need to secure electricity supply and cut down bills, households, businesses, and municipalities have installed distributed renewable production systems like photovoltaic installations. Because renewable energies and the Lebanese grid are both intermittent, renewable systems require fallback sources of power. So, most installations are actually hybrid systems which incorporate diesel generators, photovoltaic panels and sometimes batteries. Hybrid systems have promise for both individual and collective production. In some localities where supply is insufficient, municipalities have set up hybrid PV/Diesel mini-grids ranging from 80 kilowatts peak (kWp) to almost 800 kWp. An 800 kWp mini-grid can potentially cover the average consumption of 500 to 1,300 rural households in Lebanon for basic needs (low consumption).[2]

Construction of Powers and Access to Electricity

The proliferation of mini-grids, along with the continued operation of diesel micromonopolies and the national grid has led to a massive diversification of Lebanese energy supply configurations. The rest of the article explores four distinct mini-grids based on renewables and diesel in order to understand how and to what extent the development of renewable energies has destabilized existing sociotechnical configurations and associated local social and political systems. It argues that the configuration and regulation of these local electricity services is primarily determined by the interests, powers, and strategies of the dominant actors in the project. Electricity provision is locally regulated by a set of technical, political, economic, social and cultural factors, which explains why access to electricity varies depending on the territory. In this context, local governance is not monolithic, but rather refers to complex plural systems of actors and resources. Consequently, mini-grids vary spatially and in terms of their effects on social, environmental and territorial justice.

Different strategies, interests, and actor systems have shaped the collective energy systems in the four municipalities the article explores. Respectively, they reflect the development of energy systems for community empowerment (1-Baaloul), the municipal electricity service as a tool for local government and political legitimacy (2-Menjez), international experimentation as an instrument of public policy and national reform l (3-Qabrikha), and the lucrative entrepreneurship project for new markets and ventures (4-Jabbouleh). These four case studies highlight the essential role of municipal and national public actors, but also private players, in reconfiguring local energy territories in Lebanon.

The article focuses on small, rural municipalities (between six hundred and three thousand inhabitants) which have developed collective electricity supply systems that incorporate renewable energies in the last five years. It is based on fieldwork conducted in 2020 and 2021 in four Lebanese municipalities of different sizes and diverse communities. The research used a qualitative method including field observations, press and social media review, and semi-structured interviews with residents, local elected officials, buyers, and providers of renewable energy equipment.

The Community-led Project for the Construction of Territorial Commons

The mini-grid of Baaloul was described by the president of the municipality, Mohammed Nasser Mohiedddine, as "a common good in which everyone is a partner." The local grid, which embodies a cooperative and participatory model, was financed by fundraising,[3] is owned collectively and is governed by a collective decision-making process which determines investment, fees, and hiring. The development of the mini-grid is based in the strong solidarity of a relatively homogeneous and well-off community.

Baaloul is a rural residential municipality located in the Western Bekaa which experiences six to twelve hours of daily power cuts. With six hundred inhabitants in winter and up to 1200 in summer, Baaloul is a majority Sunni and Spanish-speaking municipality. The residents have close personal and professional links with Latin America due to immigration from Lebanon to the South American continent dating from the nineteenth century. Local politics is characterized by a strong collective commitment of the inhabitants to the protection of the local environment,[4] in particular through the"junta de Baaloul," a participatory committee which brings together volunteer residents to discuss municipal projects.

Before 2012, most of the inhabitants of Baaloul had their own individual generators, while others were connected to a private generator whose owner charged high tariffs and did not offer night-time supply. Dissatisfied with the services of the private generator's owner and the pollution caused by individual generators, the inhabitants decided in 2012 to install their own local diesel grid funded by Baaloul families and the rich immigrant diaspora in Latin America ($300,000 for two generators of 650 and 500 kVa,[5] as well as transmission lines and individual meters). In 2018, Baaloul received a grant of $200,000 from the USAID-funded BALADI project to install 80 kWp of photovoltaic panels to replace some EDL and diesel consumption with solar energy.

The BALADI project, "Building Alliance for Local Advancement, Development, and Investment," is a program funded by the United States Agency for International Development (USAID) and carried out by CARITAS and the René Moawad Foundation, two foundations whose mission is to develop projects around issues of access to basic services such as education, health, or energy for the benefit of Lebanese communities and municipalities. CARITAS and USAID selected Baaloul on the condition that they also provide solar energy to the Syrian refugees living in a nearby camp. However, the refugees benefit very little from this project. They are not integrated into local decision-making processes, and do not benefit from the electricity of the generators. Syrian refugees only receive solar electricity via the EDL grid when it is available to reduce their bills (so rarely). The residents of Baaloul seized this funding opportunity for their own community by including the hybrid mini-grid as part of the local community project "Baaloul Verde," which aims to protect the living environment by reducing pollution from diesel generators. This project is interesting because it is not owned by the municipality, but by the inhabitants, and profits are directly distributed to inhabitant-shareholders. The tariff is locally determined according to the price of diesel, the salaries of the employees who manage the municipal electricity sector, and the cost of maintaining and replacing generators. The integration of solar energy into the grid increased profit margins, making it possible to reduce the bills of all village inhabitants by fifty percent, twice, and apply tariffs lower than those proposed by the government. By mobilizing civil society in decision-making, project financing and the redistribution of profits, this project has strengthened local solidarity.

The Demonstration Project to Legitimate the Municipal Regulatory Capacity

The second mini-grid, in Menjez, was spearheaded by a local leader (the mayor), and primarily embodies his political project. Menjez, which is located in Akkar on the northern border of Lebanon, is a rural municipality created in 2012 with one thousand inhabitants, mostly Maronites. In office since the municipality was created, the mayor has worked to promote spatial development initiatives in close partnership with international actors who subsidize environmental and local projects.

Until 2013, there were few alternative sources of electricity during EDL cuts, which were about twelve hours per day in Menjez. A minority of the inhabitants were connected to a private generator, whose owner charged very high tariffs. Consequently, in 2013 the municipality funded and installed a municipal grid of generators (two generators of 180 kVa and 300 KVa, transmission lines and meters for the three hundred subscribed households). In 2018, after applying for USAID's BALADI project, the municipality got a grant of $200,000 to install 100 kWp of solar panels.

For this young municipality with its new municipal team, the municipalization of the hybrid PV/diesel mini-grid is a tool to legitimize the local government. Unlike in Baaloul, the Menjez grid belongs to the municipality, which largely controls the energy committee and its decisions. The mayor, who chairs the energy committee, applies the Government's tariffs for generator subscriptions, and profits are not directly redistributed to the inhabitants but are included in the municipality's budget and used to finance other local projects. Thus, the supply of electricity in Menjez is becoming established as a fully-fledged municipal sector of action.

Additionally, unlike in Baaloul, BALADI's project (funded by USAID) was not implemented by CARITAS, but by the René Moawad Foundation (RMF) which is headed by Michel Moawad, a former member of the Parliament and of the World Maronite Foundation. Michel Moawad is able to use this kind of project to promote himself politically, presenting himself as the sponsor of BALADI projects and of the local, social and rural development that RMF promotes. This has helped him conquer electoral territories around Zgharta district and more broadly in northern Lebanon, and also differentiate himself and his party, the Independence Movement, from other traditional Christian parties. It is interesting to note that the mayor of Menjez won the municipal elections with an independent list against two opposition lists made up of traditional Christian parties, the Lebanese Forces and the Free Patriotic Movement.

While the Baaloul and Menjez mini-grids are technically quite similar, they have been shaped by divergent sociopolitical interests. However, both projects carry significant legal risks. Theoretically, these projects are illegal, because they involve the resale of electricity by a third party to private consumers without a license. But the EDL's position is ambiguous. In Baaloul, the EDL has tacitly recognized the legitimacy of the local grid, and even integrated it into the national grid, through the installation of "net metering" on the meter for public lighting and on the meter for the refugee camp.[6] Net metering is a technical and legal mechanism which enables electricity exchange between the conventional grid and a subscriber who produces renewable energy for their own consumption (a "prosumer"). Through a bidirectional meter, the prosumer can either take electricity from the grid or feed electricity back to the grid depending on their level of production and consumption.

Despite their potential, the Baaloul and Menjez mini-grids do not solve the fundamental problem of collective solar energy production in Lebanon: How should municipalities with substantial solar energy production use the energy when local consumption is low while the solar production is high and EDL available? To solve this problem and support small municipalities in developing local renewable generation, CEDRO,[7] a project of the United Nations Development Programme, designed a system to exchange this excess energy with the EDL grid.

International Experimentation as an Instrument of Public Policy to Reform a Monopolistic Model

In 2014, CEDRO selected the village of Qabrikha to host the first pilot project of "communityled virtual net metering."CEDRO is a project of the United Nations Development Programme (UNDP), created in 2007 through a partnership with the MoEW within the framework of the Lebanese Recovery Fund to foster the development of renewable energy market in Lebanon (encourage demand for renewable systems and structure the offer by financing suppliers). To this end, the Qabrikha pilot project aimed to rescale the net metering mechanism at the collective and municipal levels through a European Union grant ($300,000).

Because the main issue in residential photovoltaic production is the mismatch between production (sunshine during the day) and consumption schedules (residential consumption in the evening), devices are needed to store solar energy produced during the day for evening consumption. Net metering makes it possible to use the grid as a storage system. When solar power is not available, the household can consume electricity from the conventional grid, but when the household generates more electricity than it uses, it can feed it back to the grid and the electricity meter will work backwards. While this mechanism has existed in Lebanon since 2011 for individual consumers, CEDRO wanted to generalize it for collective production distributed across multiple meters.

Qabrikha is a suburban municipality with almost 3000 inhabitants in a hilly area with villas in the south of Lebanon. Before the beginning of the CEDRO project, the municipality bought up generators which belonged to private owners and installed meters for its 350 households. Then, in 2016, a 250-kWp photovoltaic system was connected both to the EDL and to the local diesel-generator grid, with smart meters for all subscribers. In December 2018, EDL and the energy committee of Qabrikha formalized the project, with a contract covering 124 participating households. Thanks to CEDRO's experimentation and to solar energy, the beneficiaries of the mini-grid should see a reduction not only in their generator bill, but also in their conventional EDL bill. Unlike in Baaloul and Menjez, surplus solar energy exported back to the EDL grid should be deducted from local utility bills . So, for example, if the municipal PV system produces 20,000 kWh and 100 residents participate in the project, then EDL would have to deduct 200 kWh from every individual invoice.

The main goal of this experimental project led by an international player was to encourage the EDL to reform its monopolistic model, and to foster the decentralization of collective energy systems. However, despite the formal agreement with the EDL, "community-led virtual net metering" has not yet been implemented because of a lack of EDL cooperation. EDL is not capable to provide the electricity bills after deduction of the local photovoltaic production value (lack of skills and human resources). The system's problems are not only technical but also reflect the reluctance of the national utility to risk eroding its monopoly by promoting decentralized energy systems. So, to fill the gap created by the lack of technical and legal mechanisms negotiated with the public monopoly, several companies in other Lebanese villages have not only bypassed the public grid but are competing with it by offering consumers an autonomous energy supply with batteries.

The Lucrative Entrepreneurship Project for the Conquest of New Consumer Markets

Several Lebanese renewable energy companies have recently started marketing hybrid PV/Diesel mini-grids in order to diversify their activities and market shares. These capitalist players designed collective renewable electricity supply systems that they install in rural villages, where they provide residents with monthly subscriptions. Their goal is to use batteries not only to provide electricity during outages but to supply electricity twenty-four hours a day. Generally, these companies aim to develop an autonomous and competitive energy offer to EDL through attractive economic models and tariff structures for consumers, who are encouraged to consume more energy on the local grid than on the national one.

The mini-grid in Jabbouleh was developed in a territory with no competing private generator owner, in close partnership with a local convent of nuns. The latter signed a Build-Operate-Transfer contract which establishes that the private investor (Kenergy) and the operator (Matrix Energy) will operate the mini-grid for twelve years, after which the convent will recover the property and management of the system. The investors partnered with the convent rather than the municipality because the convent had the land necessary to install the solar farm.

With an investment of $1.8 million, the system is made up of 800 kWp of solar panels over 15,000 square meters with 500 kWh of batteries, three generators of 330, 200 and 160 kVa, transmission lines, and prepayment meters for the 340 subscribers. The tariff structure is based on profitability and cost optimization with a variable tariff depending on the EDL rationing hours (to make the tariff more attractive than EDL when the national grid is available). Unlike the municipally and collectively-owned projects in Baaloul, Menjez, and Qabrikha, the electricity suppliers in Jabbouleh have adopted a market-driven strategy and participate in the commodification of electricity services in territories considered to be potential consumer markets.

Conclusion

These four case studies show the great diversity of strategies, powers, and interests driving the development of mini-grids. This diversity is the result of territorial differentiation, caused by different systems of actors, local governance and sociopolitical regulation. Energy change is a multiscalar, fundamentally political process, which shapes and is shaped by technical, political, and social systems in relation to one another. This article began with the question of how renewable energy-based mini-grids destabilize existing sociopolitical configurations and solidarities. Ultimately, I found that these emerging systems do not radically reconfigure local energy territories but rather reflect structural dynamics and hybridize existing systems.

If only some socioterritorial conditions foster the development of mini-grids, their use and proliferation raises questions of social and territorial justice. The projects in Menjez, Baaloul and Qabrikha were possible because of the capacity of local and/or international actors to mobilize external funding. In areas with limited financial, human, and technical capacities, private interest in investment could compensate for the lack of public action (like in Jabbouleh). However, substituting a private service for a public service, or leaving each municipality to chart its own path, raises questions of national solidarity. By widening inequalities between well-off communities capable of securing their electricity supply, and the most precarious communities, which are neither an attractive market for investors, nor endowed with a municipality capable of mobilizing external funds, this dynamic risks exacerbating Lebanon's socioterritorial fragmentation.

While hybrid mini-grids offer opportunities to reduce costs and dependence on fuel oil, to strengthen community capacities, and to reduce the pressure of electricity demand on the national grid, they also create the risk of social and territorial polarization between those who have access to these alternative systems and those who remain trapped by failed conventional infrastructure.

[1] Author interview with a local elected official, 14 March 2019.

[2] In Lebanon, a rural household consumes on average between 80 and 200 KWh per month. To cover this residential consumption, a rural household would require a PV system ranging from 0.6 kWp (for 80 KWh per month) to 1.5 kWp (for 200 KWh per month). However, as renewable energies are intermittent, an additional source of energy is necessary (batteries or generators in addition to the conventional grid which is not available 24/7).

[3] The mini-grid was funded by donations gathered from locals and the diaspora on a voluntary basis and now inhabitants hold shares in the collective electricity supply system.

[4] The protection of the local environment results in securing the municipal space with a video camera project and 24-hour security guards, a village beautification project with public gardens and work on roads and sidewalks as well as the development of a water and a sanitation network.

[5] On average, a 500 kVa generator is supposed to supply 312 consumers for a 5-amp subscription (Ahmad, 2020). So, a system with two generators for a total of 1150 kVa can theoretically provide 718 consumers for 5-amp subscriptions. For instance, a subscription of 5 amperes will cover at most the electrical needs for a fridge, a television, some kitchen appliances, and a washing machine. But in Baaloul the consumption of the inhabitants is higher than the Lebanese average, and subscriptions range from 5 amps to 40 amps.

[6] It must be emphasized, nonetheless, that in Baaloul the net metering mechanism only works for the municipal lighting meter, the inhabitants do not take advantage of this mechanism (which differentiates it from the following case Qabrikha).

[7] CEDRO: Country Energy Efficiency and Renewable Energy Demonstration Project for the Recovery of Lebanon.


Guy Pierra
email: pierra@ensma.univ-poitiers.fr

Jean-Claude Potier

Patrick Girard

The EBP System : Example Based Programming System for Parametric Design 1

This paper investigates the problem of parametrics within the perspective of generating and exchanging families of cognate products. Two ways are discussed. A parametric representation gathers together within the same structure the parametric definition and one specific instance: the current instance. An EXPRESS model that follows this approach is presented. Its integration within the STEP Standard would enable the exchange of (simple) parametric designs. The use of a parametric program, based on a standard API, is a more conventional approach. We present the EBP system which enables such a program to be generated through purely graphical interactions. This system provides for all the constructs required in the target program: variables, expressions, functions, and control structures. If the API itself supports all these constructs, the parametric representation may be restored on the receiving system.

Introduction

Portability of parts libraries is a major economic concern for Computer Aided Design (CAD) System users, for component manufacturers, and for CAD system vendors. Such a portability would enable the level of granularity of the data model of future CAD Systems to be changed. Besides dealing with points, curves, surfaces and solids, the data model of these systems will consist of technical objects like bearings, capacitors or stairs according to their field of application. To allow such a portability, a whole set of concepts, known as the CAD/LIB approach, has been developed in Europe [START_REF] Pierra | Modelling classes of pre-existing components in a CIM perspective: the ISO 13584/ENV 40004 approach[END_REF]. This set of concepts is based on the experience gained using proprietary solutions and/or national standards that only partially fulfilled the end-user needs. These concepts constitute the agreed basis of both the European and the International standardization work in this area (CEN/TC310-PR ENV 40004 and ISO/TC184/SC4-ISO 13584).

The question of parametrics is crucial for such a topic, and a lot of effort has been deployed in order to clarify the concept of parametrization, and its relationship to the concept of a product. For ISO 13584, parametrization is related to the concept of product (or part) classes. A product class is a set of products which are described together, which are assigned a common name, and whose instances may be distinguished from each other by the values of some numericvalued, string-valued or Boolean-valued parameters called product (or part) identification_attributes. Fixing the identification_attributes within the class fully identifies the product instance. A representation class is a set of representations which are described together and whose instances may be distinguished from each other by the values of some numeric-valued, string-valued or Boolean-valued parameters called representation_attributes. Fixing the representation_attributes within the class fully specifies the representation instance. A shape class, also called a (geometric) parametric model, is only a special case of a representation class. Each instance is fully defined by its parameter values. Exchanging libraries of parts requires a capability for generating, for exchanging, and for interpreting parametric models. The goal of this paper is to present the two innovative approaches developed within the ESPRIT PLUS project, whose role is to validate and to improve the CAD/LIB concepts, for parametric model generation and exchange.

In the next section of this paper, we define the requirements for parametric modelling in the context of parts library definition and exchange. In the third section, we investigate the concept of parametrics, and we relate it to the concept of a program and to the example-based programming paradigm. In the fourth section, we outline the general framework developed to allow parametric representation exchange within the context of the emerging Standard ISO 10303 (STEP). This recent proposal [START_REF] Pierra | A general framework for parametric product modelling, ISO-STEP meeting[END_REF] is under consideration for insertion within STEP. In the fifth section, we present the EBP system. Its role is to allow an end-user to generate a parametric model in the format of a program. The use of such a format is not quite as old-fashioned as it may appear at first glance. Firstly, as shown in this paper, this parametric description may be generated by purely graphic interactions, even for those programs that contain control structures, which is not usual in parametric or variational systems. Secondly, the interpretation of such programs may generate a parametric representation on the receiving system, if this system provides such a facility.

Over the last few years a lot of effort has been made in order to ensure more flexibility of a designed shape. The different approaches, sometimes grouped under the name dimension-driven geometry [START_REF] Roller | Dimension-driven geometry in CAD : a survey in : Theory and Practice on Geometric Modeling[END_REF], address two very different problems.

Declarative Model

Declarative approaches [START_REF] Sunde | A CAD system with declarative Specification of Shape[END_REF], and in particular variational geometry, consist of geometry problem solving: "given a model with a sufficient number of geometric constraints and a topological or approximate geometric description, we want the precise model to be evaluated automatically" [START_REF] Roller | Dimension-driven geometry in CAD : a survey in : Theory and Practice on Geometric Modeling[END_REF]. The solution may be unknown to the user. He or she states the constraints. The role of the system is to compute the (possible) solution(s).

Mathematically, let P be the set of parameters defined over a domain D ⊂ P (often P = R n ), and let S (shape) be the set of values (points, curves, numeric values,...) that describe an explicit instance. S belongs to the set S of all the possible shapes. A declarative model is an equation :

A(P,S) = 0; P D, S S
where A is an operator which is, generally, neither linear nor convex.

A lot of methods have been used to solve this problem: algebraic approaches, often based on the Newton-Raphson iterative method [START_REF] Hillyard | Analysis of dimensions and tolerances in computer-aided mechanical design[END_REF] [6] [START_REF] Lee | Inference of the positions of components in an assembly : Part 2[END_REF], inference engine [START_REF] Sunde | A CAD system with declarative Specification of Shape[END_REF] [8], Buchberger's Gröbner Bases Method [START_REF] Chou | Proving-Elementary Geometry Theorems Using Wu's Algorithm[END_REF] [10], constraint graphs [START_REF] Sutherland | A Man-Machine Graphical Communication System[END_REF] [START_REF] Kin | PictureEditor : A 2D Picture Editing System Based on Geometric Constructions and Constraints[END_REF], and many others [START_REF] Dufour | Programmation et résolution de problèmes de construction géométrique[END_REF]. The popular 2D "sketcher", available on various CAD systems, corresponds to this approach. Unfortunately, there exist only partial solutions that address specific problems [START_REF] Verroust | Construction d'objets géométriques définis par des contraintes[END_REF]. There is no declarative modeller, to our knowledge, able to generate in a deterministic way all the shape instances that belong to a shape class which represents any families of parts.

Parametric Model

The imperative approach, discussed in this paper, addresses a very different problem: "given a class of shapes whose design process is well known and may be supported by the interface of some CAD systems, we want any instance, characterized by its parameter values to be generated automatically in a deterministic way". We call such a structure a parametric model.

Mathematically, using the above notations, a parametric model is a function:

F: D a S; S = F(P)
Where F is the function that defines the instance from its parameter values.

Since the domain D is often non-specified, the function may "fail". This means that the parameter values do not belong to the domain D. Nevertheless, for all sets of parameter values that belong to D, the parametric model defines exactly one instance. In the context of Parts Library we are only interested in the parametric model.

Structure of a Parametric Model

The function F is always expressed as a composition of functions (which may consist of a singleton):

F = f n o f n-1 ... o f 1
we call the f i functions the parametric functions.

To provide for parametric modelling and exchange requires a capability for designing, for exchanging and for restoring this composition of functions.

Parametric Representations, Imperative Programs and Example-Based Programming

The characteristic of the parametric approach is that the class level, in fact the function , is always designed and represented together with one instance. We call this instance the current instance.

+ (15,5)

Fig. 1. A (parametric) expression

Provided that the user builds this expression on the display computer of the CAD system, and provided that the expression itself is recorded, the (implicit) parametric program is perfectly defined: real: x, y, z, result integer: i,l,k z := x -y; k := i**l; result := z + k;

Fig. 2. The corresponding program

One difficulty remains. When the user reintroduces, in a subsequent expression, the value "15.5" on the display computer, the system is incapable of knowing whether it is a new "parameter", or whether it is the previously computed value. Fortunately, this problem does not exist in geometry design. Since the entities are graphical entities stored in the CAD system database, the values for the current instance are database pointers. Picking up the same entity refers to the same database pointer (in the current instance), and therefore to the same variable in the (implicit) program (Fig. 3).

Fig. 3. A sequence of parametric constructs

When, in the above example, <Point_2> is referred to within the second construct, the implicit variable is clearly identified.

Since numeric values are largely used in geometric design, the same solution shall be applied for the numeric values of the current instance. In parametric design (and in the EBP system), numeric values are considered as database entities. They are stored in the database and they may be accessed through a menu. Picking up such a value clearly identifies the (implicitly referenced) variable.

In the parametric approach the current instance is embedded within the program (or inversely). Example-Based programming allows us to split it up, should we want to do so.

The concept of example-based programming shares a lot of commonality with this approach to parametric design. First analysed in HALBERT's PhD Dissertation [START_REF] Halbert | Programming by example[END_REF], and formalised in MYERS' works [START_REF] Myers | Visual Programming, Programming by Examples, and Program Visualization : A Taxonomy[END_REF] [17], the main idea of example-based environments for program design is to avoid the abstraction level of variables by permitting the user to deal with a specific value of each variable (the "example"). In an example-based visual environment, instead of selecting the functions and picking up the variables to which each function shall apply, the user (programmer) does the function on values that stand for the program variables. The difference with parametric design is that, in example-based programming systems, the (implicit) program is separated from the example (the current instance). All created values (in the example) stand for implicit variable declaration (in the program context). All references to values (in the example) stand for reference to variables (in the implicit program). One main role of these systems is to manage the context of the program which ensures the indirect link between example values and program variables [START_REF] Girard | Command Recording versus Parametric and Variational Systems, and old/new third way of parametrizing CAD models by End Users[END_REF]. Fig. 4 shows the dynamic context management of the EBP system presented in section 5.

A Neutral STEP-Compatible Data Model of Parametric Representations

STEP is an International Standard for the computer-interpretable representation and exchange of product data. Its objective is to provide a neutral mechanism capable of describing product data throughout the life cycle of a product, independent from any particular system. STEP, which is now being published, contains a lot of innovative features such as:

-the use of formal methods for data specification, -the definition of mappings from data models to implementation forms, -the definition of powerful resources for product modelling, and, in particular, geometric modelling. Nevertheless, in its development process STEP focused on explicit product modelling, and, in particular, on explicit geometry. In STEP a representation is defined as a set of (explicit) representation_items (e.g., in geometry: points, curves, surfaces or solids) associated with a representation_context. Since the goal of the programs generated by the EBP system presented in section 5 is to create geometry within the database of any target CAD-systems (supporting the standardized API), and since more and more CAD-systems provide proprietary parametric modelling facilities, it appeared necessary to try to develop a formal model of the database of such systems. The main objective of this model was to investigate whether or not it was possible, from a parametric program created by the EBP system, to generate a parametric representation if the receiving system provided for such modelling facilities. The result of this investigation, outlined in this section was twofold. (1) It showed that the answer to this question was positive provided that the numeric entities and the numeric expressions might be defined by interface functions. ( 2) It provides a global framework for the integration of parametric product modelling facilities within the context of STEP [START_REF] Pierra | A general framework for parametric product modelling, ISO-STEP meeting[END_REF].

As discussed in section 3, the basis of this model is to propose to link systematically a parametric model with one specific instance (the current instance). We call such a parametric model a parametric representation. This approach enables us to consider the current instance of a parametric representation, and therefore the parametric representation itself as a special case (a SUBTYPE) of a STEP representation. This is shown in Figure 6 using the EXPRESS-G graphic formalism . The particularities of this SUBTYPE are two fold. (1) Each representation_item is referred to by one entity, called a pm_definition_relationship, which provides its parametric definition and corresponds to the functions f i of clause 2.3. (2)The set of representation_items is now ordered. The parametric definition of each entity defines this entity on the basis of some representation parameter and/or some other representation items but these latter shall precede the referenced entity in the entity list.

Moreover, a (parametric) representation instance may itself be dependent on the context in which the instance is inserted. For example, the extended length of a pneumatic cylinder depends on the other parts of the global design. When an instance is inserted in a higher-level assembly, it becomes an occurrence. And an occurrence representation depends on the value of some other parameters called context_parameters. Modifying context_parameters (e.g., compressed length of a spring) only modifies the occurrence representation, it does not change the product (instance) itself. Generally speaking, the values of the occurrence context parameters result, directly or indirectly, from the representations attributes or context parameters of the (parametric) representation in which the occurrence is inserted.

Finally, context_integrity_constraints and global_integrity_constraints enables the modelling of the domain D (see clause 2.2), and an output interface specifies the representation_items (often called the "datums") that shall be instantiated in any occurrence representation. A pm_canonical_definition is a special case of pm_definition_relationship which is associated one to one to any representation_item and which: -associates to each numeric-valued, string-valued or Boolean-valued attribute of this representation_item one expression that enables its computation, and, -collects, in the used_items derived attribute:

(1) the representation_items directly or indirectly referred to by these expressions, (through the used_representation_item expression tree traversal function) and, (2) the representation_items directly referred to by the representation_item itself. This entity shall be subtyped for each representation_item.

The role of the used_items attribute is to assert that the composition of parametric functions (see clause 2.3) is consistent.

Fig. 9. A (simplified) example of a pm_constraint_based_definition for cartesian_point

Besides its interest for exchanging directly parametric models in the format of pm_representations, this data model points out the role of expressions, and, in particular, of numeric expressions. In program-oriented parametric model exchange, these expressions shall be:

-captured by the EBP system during interactive program construction, and -restored (through the interface) on the receiving system in order to be able to restore not only the current instance but also the parametric representation itself.

It should be emphasised that these expressions shall contain not only the usual operators and functions (+,*,/..., SIN, ...), but also grapho-numeric functions which enables a value which results from some other representation_items (e.g., distance_of(.,.); radius_of (.),...) to be involved in a numeric expression.

The EBP System

Parametric programs constitute the other method of exchanging parametric models. The EBP system is a programming environment for designing such programs. Based on the visual example-based-programming paradigm, EBP is intended to reduce the programming tasks required for parametric program generation to a minimum. During an interactive session, a draftsman only designs one instance (the example) on a CAD system. As long as the draftsman acts, the EBP system records his work, and translates it into a real program.

The CAD system builds up the example representation by means of system procedures involving parameters. These procedures and parameters are implicitly controlled, in interactive mode, by the user manipulating commands and (values) operands. To record a program requires the explicit description of the (implicitly) involved procedures and parameters. Is this translation easy?

Obviously, this translation is not straightforward. The first difficulty concerns the management of objects, what we have called the "dynamic context" in the third section of this paper. This object management allows direct translation of operands (values) in references (variable names). The second difficulty split into the two classical problems known in compilation theory as interpretation and code generation. We will describe how these different problems are addressed in the EBP system.

Object Management

The first difference between designing an explicit representation and specifying a program lies at the level of the manipulated objects. Command languages refer to values. Programs refer to variables. If we consider the designed representation as an example of the (implicit) program, the problem is to identify what values stand for parameters, constants and internal variables.

As far as the geometric entities are concerned we have already pointed out that the (example) values may be captured as CAD database pointers. The condition, applied in the EBP system, is to capture their values above the designation layer of the dialogue interface (see Fig. 10). Therefore, the only problem is to create and to manage the (dynamic) context of the program. Each entity creation has to generate an internal variable (implicit) declaration. Recording does not only consist of noticing interactions: it requires the object manager (named "context manager") to be notified for each object creation or deletion. This is done through a specific link between the CAD System database and EBP context manager (see fig. 10).

As far as numeric values are concerned, all the parameters shall be declared by a specific command and are considered as database entities. When an explicit numeric value is involved in an expression, it is implicitly considered as a constant.

Parsing the Command Script

In compilation theory, program interpretation is based on parsing. The syntactic abstract tree is the basis of semantic analysis and code generation. Unfortunately, this approach may not be used for the interpretation of interactive command languages.

Firstly, command languages have in fact no (or an extremely limited) syntax. All the sequences of interactions are allowed, even if they are useless. No fatal error is raised after any interaction inputs (i.e., a command language never crashes with an "error # 347" message !). The user is intended to react to the interactive command messages. Therefore, interpretation of such incomplete or incoherent sequences of commands and operands would lead to incorrect syntactic abstract trees.

Secondly, command languages are heavily context-sensitive. Dialogue interfaces contain a lot of dialogue context variables that enable command remanence, multiplicity of "threads of task accomplishment" [START_REF] Bass | Developing Software for the User Interface[END_REF] or inhibition of previous commands. Command remanence means that some procedure may be invoked twice, without repetition of the interactive command. Multiple threads of task accomplishment allow the user to stop an unfinished sequence of interactions in order to carry out realise another one, and to terminate the first sequence after the end of the second one. So, the operands of one command are embedded within the operands of another.

Such dialogue threads act in fact as non context-free languages, which are known to be hardly translatable. These two aspects show the non-feasibility of syntax-driven translation.

From Syntax-to Semantic-Driven Translation

Even if, for ergonomic reasons, dialogue interfaces enable any dialogue (or near any dialogue) sequences, some representation is in fact built as a result. The CAD system procedures which are really triggered constitute the semantics of the command sequence. Capturing these semantics enables the semantic tree of the parametric program to be directly built. In the EBP system, the user commands are captured only when a system procedure is triggered, and not within (or below) the dialogue interface.

The Problem of Expressions

We emphasised, in section four, the need to capture expressions. These expressions may be numeric (e.g., <Param_2> * <Param_2>), grapho-numeric (e.g., distance_of <Point_1>, <Point_2>) or graphic (e.g., projection_of <Point_1> onto <Line_1>). When a procedure is triggered, only the result of such expressions is transferred. Recording only this result would be a loss of the real parametric function. When constants are the unique objects involved in an expression, there is no real loss. On the other hand, when parameters or representation_items are involved, such a loss is unacceptable. The solution used in the EBP system (in fact, in the dialogue interface of the CAD system) consists of gathering within the same token the expression value and its syntactic abstract tree. When an expression is not used (the user changes his "thread of task accomplishment", or his mind) the expression remains in the dialogue interface and does not appear within the program. When the result of an expression is sent to a CAD system procedure, the EBP system captures the name of the procedure together with the expression abstract trees.

Ambiguity in Constraint-Based Geometry

The other major difficulty is the ambiguity of constraint-based geometry. In a graphical command language, such an ambiguity is removed by the pointing device coordinates. To capture such coordinates is useless: changing the program parameters would change the meaning of the position coordinates. In EBP, this problem is solved by duplicating all the ambiguous constraint-based construction. The version used during program (implicit) construction obtains the pointing device coordinates as input parameters, and returns some specific value (based on entity orientations) as output parameter. The version used during program execution (and code generation) uses this specific value as input parameter to remove the ambiguity of the construction. It should be noted that this problem is a general one in parametric design. All geometric programming interfaces must address it, or be restricted to non-ambiguous (very poor indeed) constructs. For example, in 2D geometry, most of the constructs that involve a line extremity, or a tangency to a circle are ambiguous.

Introducing Control Structure in Command Languages

Unlike the usual parametric or variational systems, and unlike most command languages, EBP provides purely interactive graphic facilities for control structure design.

We only outline here the solution used which was developed for the LIKE system [START_REF] Girard | Environnement de programmation pour nonprogrammeurs et parametrage en conception assistée par ordinateur: le système Like[END_REF] [START_REF] Girard | One more step towards end-user programming environments: introducing control structures in visual example-based programming[END_REF].The predicates of these control structures are defined using the display computer which is part of the interface provided to the user. The recurrence definition of a loop is specified by the interactive user by designing successively (1) the control predicate, (2) the first (example) step of the loop and (3) the second step of the loop. EBP may then infer (algorithmically) the recurrence relationship. Therefore, it may generate the other steps and store, in the semantic tree, the recurrence relationship.

The reason for the lack of control structures in most example-based programming systems is to be found in the dynamic context management. Identifying objects during the interaction process requires, as we have previously shown, an object management, with an automatic naming process of the created objects. This automatic process is in all cases some kind of numbering. Control structures are very inappropriate for this automatic naming. Alternative structures create different objects for each branch. Iterations create inherently varying numbers of objects. What are the consequences for the subsequent naming?

In the EBP system, we defined strong rules to manage the dynamic context. The idea is based on the concept of local variables in subroutines. The exchange between the calling process (the embedding context of the program) and the called the subroutines (contexts that are local to control structure branches) are governed by this metaphor. For example, an object which was created during a loop structure is not individually attainable in the embedding program (after the end of the loop structure). The set of entities that were created during the same loop structure are attainable as a whole. These rules, which seem to be quite natural for end-users, solve all the context management problems that result from the introduction of control structures in example-based programming systems [START_REF] Girard | One more step towards end-user programming environments: introducing control structures in visual example-based programming[END_REF].

Conclusion

Parametrics is an emerging technology that encompasses several different problems. In this paper we have defined a parametric model as a function that depends on an explicit set of parameters and that may generate each representation instance by composition of internal functions. There are two ways of representing such a parametric model: either as a data structure that we called a parametric representation, or as a parametric program referring to an API. As far as the parametric representation is concerned, we represented the global function by embedding in its description one specific instance: the current instance. The values contained in this instance stand for the functions variables and are referred to by the functions that constitute the global function. We have presented the overall architecture of an EXPRESS model that follows this approach and that might be integrated into the STEP standard to provide for parametric product modelling facilities exchange.

As far as the second approach is concerned, which corresponds to the parametric modelling facilities provided in the first release of the Parts Library Standard (ISO 13584), we have used the Example Based Programming paradigm to enable the design of such a program by an end-user. In the EBP system, the user designs an example. The values of the example are captured by the EBP system which creates corresponding variables. The recorded functions refer to these variables, and EBP manages, both in recording and in running mode, a dynamic context where program variables are associated with example values. The functions are captured on the surface of the user interface, and each token contains not only the operand values, but also their whole expression tree if these values result from expressions. These expressions are stored within the program, and, when running such a program on a parametric system supporting the API , the parametric representation may be restored within its database provided that the API supports both the parametric functions and the expressions, and provided that the parametric program is only sequential. Finally EBP also enables to generation of parametric programs that contain control structures. Their expressive power is therefore greater than the usual parametric representations.

Figure 1

 1 shows a very simple example based on numeric expression. The values which appear on the tree are the current instance values. In fact these values play two roles. (1) They explicitly represent the current instance. (2) These values stand for variables whose types may be deduced from the values.

Fig. 4 .

 4 Fig. 4. The dynamic context management of example-based programming systems

Fig. 5 .

 5 Fig. 5. The STEP data model for representation in EXPRESS

Fig. 6 .

 6 Fig. 6. The (simplified) data model of a parametric representation

Fig. 7 .

 7 Fig. 7. The proposed EXPRESS model for parametric representation Two categories (i.e., SUBTYPES) of parametric functions exist, modelled as pm_definition_relationship.

Fig. 10 .

 10 Fig. 10. Architecture of the EBP system

Fig. 11 .

 11 Fig. 11. Content of the captured tokens

The research described in this paper was funded partially by EU under project ESPRIT III # 8984 (PLUS), and partially by the French Ministry of Industry under grant 93.4.930080.