/**
 *  Copyright (c) 2017 CentraleSupélec & EDF.
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  which accompanies this distribution, and is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 *
 *  This file is part of the RiseClipse tool
 * 
 *  Contributors:
 *      Computer Science Department, CentraleSupélec
 *      EDF R&D
 *  Contacts:
 *      dominique.marcadet@centralesupelec.fr
 *      aurelie.dehouck-neveu@edf.fr
 *  Web site:
 *      http://wdi.supelec.fr/software/RiseClipse/
 */

import scl: 'http://www.iec.ch/61850/2003/SCL'

package scl

context LN0

    --  The GSE control block name shall be unique within the LLN0, i.e. the
    --  logical device.
    -- The GSEControl in LN0 shall have unique name (from SCL_IED.xsd)
    inv LN0_GSEControl_name_unique
        ( 'Unique name in GSEControl from LN0 (line ' + self.lineNumber.toString() + ')' )
    :
        self.GSEControl -> isUnique ( c : GSEControl | c.name )
       
    -- The GSEControl in LN0 shall have unique datSet (from SCL_IED.xsd)
    inv unique_datSet_in_GSEControl_from_LN0
    ( 'Unique datSet in GSEControl from LN0 (line ' + self.lineNumber.toString() + ')' )
    :
        self.GSEControl -> isUnique(c:GSEControl|c.datSet)       
       
    --  The SV control block name shall be unique within the LLN0, i.e. within the
    --  LDevice.
    -- The SampledValueControl in LN0 shall have unique name (from SCL_IED.xsd)
    inv LN0_SampledValueControl_name_unique
    ( 'Unique name in SampledValueControl from LN0 (line ' + self.lineNumber.toString() + ')' )   
    :
        self.SampledValueControl -> isUnique( c : SampledValueControl | c.name )
       
    -- The SampledValueControl in LN0 shall have unique datSet (from SCL_IED.xsd)
    inv LN0_SampledValueControl_datSet_unique
    ( 'Unique datSet in SampledValueControl from LN0 (line ' + self.lineNumber.toString() + ')' )   
    :
        self.SampledValueControl -> isUnique( c : SampledValueControl | c.datSet )
       
    -- The ReportControl in LN0 shall have unique name (from SCL_IED.xsd)
    inv unique_name_in_ReportControl_from_LN0
    ( 'Unique name in ReportControl from LN0 (line ' + self.lineNumber.toString() + ')' )
    :
        self.ReportControl -> isUnique(c:ReportControl|c.name)
       
       
    -- The LogControl in LN0 shall have unique name (from SCL_IED.xsd)
    inv unique_name_in_LogControl_from_LN0
    ( 'Unique name in LogControl from LN0 (line ' + self.lineNumber.toString() + ')' )
    :
        self.LogControl -> isUnique(c:LogControl|c.name)
       

    -- The DataSet in LN0 shall have unique name (from SCL_IED.xsd)
    inv unique_name_in_DataSet_from_LN0
    ( 'Unique name in DataSet from LN0 (line ' + self.lineNumber.toString() + ')' )
    :
        self.DataSet -> isUnique(d:DataSet|d.name)
       
    -- The DOI in LN0 shall have unique name (from SCL_IED.xsd)
    inv unique_name_in_DOI_from_LN0
    ( 'Unique name in DOI from LN0 (line ' + self.lineNumber.toString() + ')' )
    :
        self.DOI -> isUnique(d:DOI|d.name)
       
    -- The Log in LN0 shall have unique name (from SCL_IED.xsd)
    inv unique_name_in_Log_from_LN0
    ( 'Unique name in Log from LN0 (line ' + self.lineNumber.toString() + ')' )
    :
        self.Log -> isUnique(l:Log|l.name)



endpackage