import models/SimpleClassDiagrams as SCD
include "primitives.alh"

SCD CausalBlockDiagrams_Design{
    Class Float {
        $
            if (bool_not(is_physical_float(self))):
                return "Natural has no float value"!
            else:
                return "OK"!
        $
    }

    Class Block{}

    Class ConstantBlock{
        value : Float {
            target_lower_cardinality = 1
            target_upper_cardinality = 1
        }
    }

    Class AdditionBlock{}
    Class NegatorBlock{
    }
    Class MultiplyBlock{}
    Class InverseBlock{
    }
    Class DelayBlock{
    }

    Association Link(Block, Block){}
    Association InitialCondition(Block, DelayBlock){
        source_lower_cardinality = 1
        source_upper_cardinality = 1
    }

    Inheritance (ConstantBlock, Block){}
    Inheritance (AdditionBlock, Block){}
    Inheritance (NegatorBlock, Block){}
    Inheritance (MultiplyBlock, Block){}
    Inheritance (InverseBlock, Block){}
    Inheritance (DelayBlock, Block){}
}

export CausalBlockDiagrams_Design to models/CausalBlockDiagrams_Design

CausalBlockDiagrams_Design my_CBD{
    ConstantBlock a{
        value = 1.0
    }

    ConstantBlock b{
        value = 1.0
    }

    AdditionBlock c{}

    Link(a, c){}
    Link(b, c){}
}

export my_CBD to models/my_CBD
