Bookmark this: tool.io/lighting/lighting-layout-calculator/source-code
Lighting Layout Calculator Source Code
Browse the implementation files for Lighting Layout Calculator.tool.ts typescript
const parseFinite = (value: unknown): number | null => {
if (value === '' || value === null || value === undefined)
return null;
const parsed = Number(value);
return Number.isFinite(parsed) ? parsed : null;
};
export const calculateFixtureCount = (
lengthInput: unknown,
widthInput: unknown,
targetIlluminanceInput: unknown,
lumensPerFixtureInput: unknown,
utilizationFactorInput: unknown,
maintenanceFactorInput: unknown
) => {
const values = [
lengthInput,
widthInput,
targetIlluminanceInput,
lumensPerFixtureInput,
utilizationFactorInput,
maintenanceFactorInput
].map(parseFinite);
if (values.some((value) => value === null)) return '';
const [
length,
width,
targetIlluminance,
lumensPerFixture,
utilizationFactor,
maintenanceFactor
] = values as number[];
if (
length <= 0 ||
width <= 0 ||
targetIlluminance < 0 ||
lumensPerFixture <= 0 ||
utilizationFactor <= 0 ||
maintenanceFactor <= 0
)
return '';
const requiredLumens = length * width * targetIlluminance;
const effectiveLumensPerFixture =
lumensPerFixture * utilizationFactor * maintenanceFactor;
return Math.ceil(requiredLumens / effectiveLumensPerFixture);
};
export const Tool: TypeTool = {
name: 'Lighting Layout Calculator',
slug: 'lighting/lighting-layout-calculator',
tool: calculateFixtureCount,
intro:
'Estimate the number of light fixtures needed for a rectangular room using the lumen method and explicit utilization and maintenance factors.',
i: [
{
example: '5',
label: 'Room length',
placeholder: 'Meters (m)',
type: 'number'
},
{
example: '4',
label: 'Room width',
placeholder: 'Meters (m)',
type: 'number'
},
{
example: '300',
label: 'Target illuminance',
placeholder: 'Lux (lx)',
type: 'number'
},
{
example: '1000',
label: 'Lumens per fixture',
placeholder: 'Lumens (lm)',
type: 'number'
},
{
example: '0.8',
label: 'Utilization factor',
placeholder: 'Example: 0.8',
type: 'number'
},
{
example: '0.8',
label: 'Maintenance factor',
placeholder: 'Example: 0.8',
type: 'number'
}
],
o: [
{
example: '10',
label: 'Required fixtures',
placeholder: 'Whole fixture count',
render: 'textarea',
type: 'number'
}
],
equation:
'N = ceil((length × width × Eᵥ) / (Φfixture × UF × MF))',
alternative: [
{
title: 'Room Lighting Calculator',
url: '/lighting/room-lighting-calculator'
},
{
title: 'Lumens to Lux Calculator',
url: '/lighting/lumens-to-lux-calculator'
},
{
title: 'Convert illuminance',
url: '/convert/illuminance'
}
],
cite: [
{
title: 'Lux — Wikipedia',
url: 'https://en.wikipedia.org/wiki/Lux'
},
{
title: 'Lumen — Wikipedia',
url: 'https://en.wikipedia.org/wiki/Lumen_(unit)'
}
]
};
export default Tool;
Description
Browse the implementation files for Lighting Layout Calculator.