Calculating loan interest and overpayments.¶
This model shows the calculation of loan interest and overpayment for known payment months, monthly payment amount and total loan amount.
The model itself is shown in the figure below.
Next, let's add an auxiliary function to the model and specify the loan data.
In [ ]:
# Подключение вспомогательной функции запуска модели.
function run_model( name_model)
Path = (@__DIR__) * "/" * name_model * ".engee"
if name_model in [m.name for m in engee.get_all_models()] # Проверка условия загрузки модели в ядро
model = engee.open( name_model ) # Открыть модель
model_output = engee.run( model, verbose=true ); # Запустить модель
else
model = engee.load( Path, force=true ) # Загрузить модель
model_output = engee.run( model, verbose=true ); # Запустить модель
engee.close( name_model, force=true ); # Закрыть модель
end
sleep(5)
return model_output
end
Out[0]:
In [ ]:
Term = 12*7;
Monthly_payment = 25000;
Sum = 1300000;
Let's run the model and see the calculated tax amount.
In [ ]:
run_model("Overpayment_on_loan") # Запуск модели.
Loan_interest = collect(simout["Overpayment_on_loan/Процент по кредиту"]);
Overpayment = collect(simout["Overpayment_on_loan/Переплата"]);
println("Процент переплат по кредиту: " * string(Loan_interest.value))
println("Переплата: " * string(Overpayment.value))
Conclusion¶
In this example we have demonstrated the possibilities of using Engee to realise everyday tasks.