Computational Science Asked by Supremum on February 27, 2021
I am a newbie to convex optimisation and I am learning with the aid of CVXPY. I am requesting for clarity on the illumination problem as described in Boyd & Vandenberghe lecture 1 slides here. I have adapted the code from here and tried to visualise what the illuminance from within a room would look like. I have inserted my code and I hope it’s not too cumbersome to look at.
I am using four lamps and I have two detectors (patches) labeled Rx0 and Rx1 as seen on the attached image. I desire to have an illuminance of 450 lux at both of these detectors but in my many attempts, none of the detectors is at 450 lux. Rx0 is around 380 lux while Rx1 is around 510. I only get somewhat the exact desired value for one of the detectors if I place one of the detectors at the centre of the room.
With the definition of illuminance on surface $mathsf{s}$ as
begin{equation}
mathcal{E}_{textsf{s}}^{textsf{tx}} = underbrace{frac{mathcal{I}_{N_{l,u}}cos^{m_{1}}left(phiright)}{d_{l,u}^{2}cosleft(psiright)}}_{mathcal{E}_{textsf{TX}}} + underbrace{sum_{jin mathcal{L}backslashlbrace lrbrace}frac{mathcal{I}_{N_{j,u}}cos^{m_{1}}left(phiright)}{d_{j,u}^{2}cosleft(psiright)}}_{mathcal{E}_{textsf{nTX}}},
end{equation}
where $mathcal{I}_{N_{l,u}}$ is the luminous intensity (normal to surface) of one of the four LED arrays, $phi$ is the irradiance angle, $psi$ is the incidence angle, $d$ is the distance between the lamp and the surface/patch, $mathcal{I}_{N_{j,u}}$ is the luminous intensity (normal to surface) of the other three LED arrays, $mathcal{E}_textsf{s}^{textsf{tx}}$ is the illuminance due to all four LED arrays and $mathcal{E}_{textsf{r}_u}$ is the required illuminance at patch $u$.
I have formulated my problem as follows;
begin{align}
underset{mathcal{I}_{N_{l,u}}> 0,~mathcal{I}_{N_{j,u}}geq 0}{mathtt{minimise}} quad& mathtt{max}_{textsf{s}}fleft(mathcal{E}_textsf{s}^{textsf{tx}}/mathcal{E}_{textsf{r}_{u}}right), &label{equ:objectiv2}
% mathtt{subject~to} quad& mathcal{I}_{N_{l,u}} leq mathcal{I}_{N_{l,u}}^{max}, &
mathtt{subject~to} quad& mathcal{I}_{N_{l,u}} leq mathcal{I}_{N_{l,u}}^{textsf{csk}}, &
& mathcal{I}_{N_{j,u}} leq mathcal{I}_{N_{j,u}}^{max}, &
& mathcal{E}_textsf{s}^{textsf{tx}} geq mathcal{E}_{textsf{r}_u}, &
end{align}
where $fleft(xright) = maxleftlbrace x, 1/xrightrbrace$.
What I am trying to achieve is to have a particular illuminance level at patch $u$. However, the code I have written only gives me the desired illuminance when the patch is at the centre.
Basically, the luminous intensity of one of the LED arrays is being modulated through the use of colour shift keying in visible light communication to transmit some data. In the end I would like to end up having a constraint makes the intensity of the transmitting LED array dominant amongst all four but for now, I need to be able to get the desired illuminance at the two patches labelled $Rx_{0}$ and $Rx_{1}$.
import cvxpy as cp
import matplotlib.pyplot as plt
import numpy as np
np.set_printoptions(precision=3, suppress=True)
plt.rcParams.update({'font.size': 16})
plt.rcParams['text.latex.preamble'] = [r'usepackage{amsmath}'] # for text command
plt.rc('font', **{'family': 'serif', 'serif': ['Palatino']})
plt.rc('text', usetex=True)
tx_array_max_int = 1465 # max_intensity of transmitting array
nttx_array_max_int = 2743 # max_intensity of non-transmitting array
desired_illuminance = 450 # In lux
txrx_geo = np.array(([0.163265306122449, 0.06201550387596899, 0.163265306122449, 0.06201550387596899],
[0.0761904761904762, 0.17777777777777778, 0.0761904761904762, 0.17777777777777778]))
n, m = txrx_geo.shape
lamp_intensity = cp.Variable(m)
objective = cp.Minimize(cp.max(cp.maximum((txrx_geo * lamp_intensity) / desired_illuminance,
cp.inv_pos((txrx_geo * lamp_intensity) / desired_illuminance))))
constraints = [lamp_intensity[0] <= tx_array_max_int,
lamp_intensity >= 0,
lamp_intensity <= nttx_array_max_int,
desired_illuminance <= txrx_geo * lamp_intensity]
problem = cp.Problem(objective, constraints)
print(problem.solve())
print("Our solution is: ", problem.status)
print("--------------------------------------------------------------------------------------------")
optimal_intensities = np.ravel(lamp_intensity.value)
print("The optimal intensities (per transmitter array) are: ", optimal_intensities)
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP