Feature: 纸带宽度角度计算

This commit is contained in:
2025-07-10 14:35:31 +08:00
parent b7dbb443a8
commit e3f03f72d4
4 changed files with 135 additions and 8 deletions

View File

@ -1,11 +1,122 @@
<script setup lang="ts">
</script>
<template> <template>
<div class="calculator-container">
<v-row justify="center">
<!-- 参数输入区域 -->
<v-col
cols="12"
lg="5"
md="6"
>
<v-card
class="pa-6 parameter-card"
elevation="8"
rounded="xl"
>
<v-card-title class="text-h5 mb-6 d-flex align-center">
<v-icon
class="mr-3"
color="primary"
icon="mdi-tune"
size="large"
/>
{{ $t('parameters') }}
</v-card-title>
<v-row>
<v-col cols="12">
<param-input-field
v-model="paperCoreDiameter"
:label="`${$t('paperCoreDiameter')} (${paperCoreDiameter.unit})`"
/>
</v-col>
<v-col cols="12">
<param-input-field
v-model="paperRollWallThickness"
:label="`${$t('paperRollWallThickness')} (${paperRollWallThickness.unit})`"
/>
</v-col>
<v-col cols="12">
<param-input-field
v-model="innerPaperWidth"
:label="`${$t('innerPaperWidth')} (${innerPaperWidth.unit})`"
/>
</v-col>
</v-row>
<v-divider class="my-6" />
<v-row>
<v-btn
block
color="warning"
prepend-icon="mdi-refresh"
size="large"
variant="outlined"
@click="resetParameters"
>
{{ $t('reset') }}
</v-btn>
</v-row>
</v-card>
</v-col>
<!-- 结果显示区域 -->
<v-col cols="12" lg="5" md="6">
<v-card class="pa-6 result-card" elevation="8" rounded="xl">
<v-card-title class="text-h5 mb-6 d-flex align-center">
<v-icon class="mr-3" color="primary" icon="mdi-calculator" size="large" />
{{ $t('results') }}
</v-card-title>
<v-row>
<v-col cols="12">
<result-card :label="$t('beltAngle')" :value="result.beltAngle" />
</v-col>
<v-col cols="12">
<result-card :label="$t('paperHolderAngle')" :value="result.paperHolderAngle" />
</v-col>
<v-col cols="12">
<result-card :label="$t('leadingLength')" :value="result.leadingLength" />
</v-col>
<v-col cols="12">
<result-card :label="$t('paperWidth')" :value="result.paperWidth" />
</v-col>
</v-row>
</v-card>
</v-col>
</v-row>
</div>
</template> </template>
<style scoped lang="sass"> <script setup lang="ts">
import { computed, ref } from 'vue'
import ParamInputField from '@/components/ParamInputField.vue'
import { createParam, type Param } from '@/types/param'
import { degreesToRadians, radiansToDegrees } from '@/utils/angle'
</style> const paperCoreDiameter = ref<Param>(createParam(76.2, 'mm'))
const paperRollWallThickness = ref<Param>(createParam(10, 'mm'))
const innerPaperWidth = ref<Param>(createParam(105, 'mm'))
const result = computed(() => {
const paperRollExternalDiameter = paperCoreDiameter.value.value + 2 * paperRollWallThickness.value.value
const paperHolderAngle = 90 - radiansToDegrees(Math.acos(innerPaperWidth.value.value / (paperCoreDiameter.value.value * Math.PI)))
const leadingLength = innerPaperWidth.value.value / Math.sin(degreesToRadians(90 - paperHolderAngle))
const beltAngle = 90 - radiansToDegrees(Math.atan(paperRollExternalDiameter * Math.PI / leadingLength))
const paperWidth = leadingLength * Math.sin(Math.atan(paperRollExternalDiameter * Math.PI / leadingLength))
return {
beltAngle: createParam(beltAngle, '°'),
paperHolderAngle: createParam(paperHolderAngle, '°'),
leadingLength: createParam(leadingLength, 'mm'),
paperWidth: createParam(paperWidth, 'mm'),
}
})
const resetParameters = () => {
paperCoreDiameter.value = createParam(76.2, 'mm')
paperRollWallThickness.value = createParam(10, 'mm')
innerPaperWidth.value = createParam(105, 'mm')
}
</script>

View File

@ -31,5 +31,9 @@
"productionAmountPerDay": "Daily output", "productionAmountPerDay": "Daily output",
"productionAmountPerHour": "Hourly output", "productionAmountPerHour": "Hourly output",
"productionWeightPerDay": "Daily output", "productionWeightPerDay": "Daily output",
"productionWeightPerHour": "Hourly output" "productionWeightPerHour": "Hourly output",
"beltAngle": "Belt angle",
"paperHolderAngle": "Paper holder angle",
"leadingLength": "Leading length",
"paperWidth": "Paper width"
} }

View File

@ -31,5 +31,9 @@
"productionAmountPerHour": "每小时产量", "productionAmountPerHour": "每小时产量",
"productionWeightPerHour": "每小时产量", "productionWeightPerHour": "每小时产量",
"productionAmountPerDay": "每天产量", "productionAmountPerDay": "每天产量",
"productionWeightPerDay": "每天产量" "productionWeightPerDay": "每天产量",
"beltAngle": "皮带角度",
"paperHolderAngle": "纸架角度",
"leadingLength": "导程",
"paperWidth": "面纸宽度"
} }

8
src/utils/angle.ts Normal file
View File

@ -0,0 +1,8 @@
// 角度转弧度
export function degreesToRadians (degrees: number): number {
return degrees * (Math.PI / 180)
}
// 弧度转角度
export function radiansToDegrees (radians: number): number {
return radians * (180 / Math.PI)
}