Пример #1
0
def build_reactor(request):
    try:
        theV = Decimal(request.POST['V'])
        theN = Decimal(request.POST['N'])
        theelement = request.POST['element']
    except:
        return index(request, 'Please enter valid values.')
    else:
        if theelement == 'U-233':
            gamas = GAMA['U3']
            sf = SIGMAF['U3']
            sa = SIGMAA['U3']
        elif theelement == 'Pu-239':
            gamas = GAMA['Pu']
            sf = SIGMAF['Pu']
            sa = SIGMAA['Pu']
        else:
            gamas = GAMA['U5']
            sf = SIGMAF['U5']
            sa = SIGMAA['U5']

        new_reactor = Reactor(V=theV,
                              N=theN,
                              gamaI=gamas['I'],
                              gamaXe=gamas['Xe'],
                              gamaPm=gamas['Pm'],
                              sigmaf=sf,
                              sigmaa=sa,
                              element=theelement,
                              pub_date=timezone.now())
        new_reactor.save()
        #Initiate the Reactor
        first_stage = CalAndDraw.initiate_reactor(new_reactor)

        return show_stage(request, new_reactor, first_stage, first_stage)
Пример #2
0
def cal_stage(request):
    try:
        reactor_id = int(request.POST['reactor_id'])
        next_power = Decimal(request.POST['next_power'])
        next_time = Decimal(request.POST['next_time'])
    except:
        reactor = get_object_or_404(Reactor, pk = reactor_id)
        next_stage = reactor.stage_set.all().order_by('-sn')[0]
        if next_stage.sn == 1:
            last_stage = next_stage
        else:
            last_stage = reactor.stage_set.all().order_by('-sn')[1]
        return show_stage(request, reactor, last_stage, next_stage, 'Please enter valid values.')
    else:
        reactor = get_object_or_404(Reactor, pk = reactor_id)
        last_stage = reactor.stage_set.all().order_by('-sn')[0]
        next_stage = CalAndDraw.create_next_stage(reactor, last_stage, 
            next_power, next_time)
        return show_stage(request, reactor, last_stage, next_stage)
Пример #3
0
def cal_stage(request):
    try:
        reactor_id = int(request.POST['reactor_id'])
        next_power = Decimal(request.POST['next_power'])
        next_time = Decimal(request.POST['next_time'])
    except:
        reactor = get_object_or_404(Reactor, pk=reactor_id)
        next_stage = reactor.stage_set.all().order_by('-sn')[0]
        if next_stage.sn == 1:
            last_stage = next_stage
        else:
            last_stage = reactor.stage_set.all().order_by('-sn')[1]
        return show_stage(request, reactor, last_stage, next_stage,
                          'Please enter valid values.')
    else:
        reactor = get_object_or_404(Reactor, pk=reactor_id)
        last_stage = reactor.stage_set.all().order_by('-sn')[0]
        next_stage = CalAndDraw.create_next_stage(reactor, last_stage,
                                                  next_power, next_time)
        return show_stage(request, reactor, last_stage, next_stage)
Пример #4
0
def build_reactor(request):
    try:
        theV = Decimal(request.POST['V'])
        theN = Decimal(request.POST['N'])
        theelement = request.POST['element']
    except:
        return index(request, 'Please enter valid values.')
    else:
        if theelement == 'U-233':
            gamas = GAMA['U3']
            sf = SIGMAF['U3']
            sa = SIGMAA['U3']
        elif theelement == 'Pu-239':
            gamas = GAMA['Pu']
            sf = SIGMAF['Pu']
            sa = SIGMAA['Pu']
        else:
            gamas = GAMA['U5']
            sf = SIGMAF['U5']
            sa = SIGMAA['U5']

        new_reactor = Reactor(
            V = theV,
            N = theN,
            gamaI = gamas['I'],
            gamaXe = gamas['Xe'],
            gamaPm = gamas['Pm'],
            sigmaf = sf,
            sigmaa = sa,
            element = theelement,
            pub_date = timezone.now()
            )
        new_reactor.save()
        #Initiate the Reactor
        first_stage = CalAndDraw.initiate_reactor(new_reactor)

        return show_stage(request, new_reactor, first_stage, first_stage)