In theory, I don't think there is anything wrong with your logic .
Reality, however, will throw a curve. The camera doesn't use black
& white film (or sensors), but is a mosaiced RGB, which uses fancy
math to 'guesstimate' the picture. While the result will be close,
it will be slightly off. (You can see this by running the sample
tool in PS over each pixel, and noting that the pixels are not
identical to each other, and will NOT have equal RGB values.) It
would seem much easier to simply use a paint program to choose a
specific shade of grey (ie, 128,128,128) and then 'paint' the
entire canvas in that single color.
My guess (purely a guess), would be that an RGB value of 128, 128,
128 would produce 18% grey. My reasoning is that, in B&W
photography, 18% grey represents the middle tone between white &
black. In the RGB world, 128,128,128 is halfway between 0,0,0 &
255,255,255.
An additional difficulty, however, is that even assuming
128,128,128 is 18% grey, does your printer know this? And as noted
by a previous poster, your ink & paper must combine to produce a
'reflectance' of 18%. Unless you already have a sample of an 18%
grey card, or some other way to accurately measure reflectance, and
even with the correct RGB values, it may be difficult to know
whether you've actually printed an 18% grey card.
I find the experiment interesting. It would be neat to know if 18%
grey cards could be printed from an inkjet. Could be useful in an
emergency, or to print up 'disposable' grey cards. Good luck.
Howdy.